Author Topic: A plugin update  (Read 566 times)

Offline tinman

  • Full Member
  • ***
  • Posts: 167
  • Karma: +10/-0
A plugin update
« on: June 18, 2018, 05:08:26 pm »
I've made several updates the to RFXtrx plugin. They are:
1) I've improved the data provided by the rain gauge code. It now keeps track of the amount of rainfall measured of the last 60 minutes, the last 24 hours, the last 7 days, the last 7 weeks and months. The values are displayed in inches or millimeters. NOTICE: Be aware that if you look at the data in the Advanced -> Variables tab, it is always in millimeters. Conversion to inches if required is done automatically by the display code. Note that if you want to set notifications you must enter values in millimeters.
2) The rain gauge code now handles the LaCrosse TX5 sensors though I doubt many of these are in use. If you are using a Lacrosse TX5 be sure that the Vera hub consistantly gets the signal from the sensor. The sensor sends a count that wraps around every 16 counts. If it's raining hard and the signal is not received before the count wraps around then the rain data will not be accurate.
3) If your particular model rain gause does not report a rain rate, the plugin will attempt to calculate a rain rate based on consecutive readings.
4) I've tested the rain gauge functionality with both the LaCrosse TX5 and the Oregon Scientific PCR800 and I believe the data to be accurate.
5) If you want to have a more appropriate graphic for a rain gauge I'd suggest searching for one online. I found one at icons8.com. If you find one, rename it to rain-gauge.png (so the name matches that in the static json file) and the copy it to /overlay/www/cmh/skins/default/img/devices/device_states
6) I've made a number of code changes to improve performance but these will probably not be noticeable.
7) I've recreated the RFXtrx Settings tab. This is the one where the receiving protocols are selected and set. My previous versions of the plugin actually had 5 different static JSON files. There was one for each type of firmware and one that displayed all the protocols even though some protocols are not available in all firmware types. If you choose to upgrade to this new version of the plugin, you may want to delete the unused JSON files. This is easily done if you're using WINSCP. It can also be done if you use PuTTY to log into your Vera. The files that can be deleted are:
/etc/cmh-ludl/D_RFXtrxType1.json.lzo
/etc/cmh-ludl/D_RFXtrxType2.json.lzo
/etc/cmh-ludl/D_RFXtrxExt.json.lzo
/etc/cmh-ludl/D_RFXtrxExt2.json.lzo
/overlay/etc/cmh-ludl/D_RFXtrxType1.json.lzo
/overlay/etc/cmh-ludl/D_RFXtrxType2.json.lzo
/overlay/etc/cmh-ludl/D_RFXtrxExt.json.lzo
/overlay/etc/cmh-ludl/D_RFXtrxExt2.json.lzo
It won't do any harm to leave these files in place if you don't want to bother removing them.
8) The plugin can now control a Sonoff smart switch. Not all Sonoff switches include 433Mhz operation in addition to Wi-Fi. The plugin will only work with ones that do. To add one go to the New Device tab of the RFXtrx transceiver. Select the Sonoff Smart Switch. Enter a name and any ID you want within the displayed range. Then click Create. Once the new device appears on the Vera devices page, initiate pairing at the Sonoff switch and press the Toggle button on the Vera device display. You may have to do this a couple of times. Be aware that control of these Sonoff switches is open-loop. There is no feedback from the Sonoff switch to Vera to confirm its state. The Sonoff switch only responds to one command and that command toggles its state from on to off or off to on.

The attached ZIP file contains all the files for the plugin. 4 old files have been removed, 7 files have been modified and 2 new files have been added. I've done a good bit of testing but you should be sure to have a copy of all the files you're currently using before uploading the new ones.

Update: the attached zip file has been modified to fix an error. If you've updated to version 1.40 get this zip file and upload only I_RFXtrx.xml and L_RFXtrx.lua.
« Last Edit: June 24, 2018, 10:02:18 am by tinman »

Offline halo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Re: A plugin update
« Reply #1 on: June 24, 2018, 03:40:17 am »
Hi,

Tinman, can you please help to troubleshooting the BinaryLight switch with new plugin version?
I am using Livolo switch for the home lights.

Initially in 1.31 plugin version it works pretty well. However after loading the 4.0 version I am getting below error.

Code: [Select]
JobHandler_LuaUPnP::HandleActionRequest device: 344 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x6f685520>
08      06/23/18 22:51:56.334   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=344 <0x6f685520>
08      06/23/18 22:51:56.334   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:SwitchPower1 <0x6f685520>
08      06/23/18 22:51:56.335   JobHandler_LuaUPnP::HandleActionRequest argument action=SetTarget <0x6f685520>
08      06/23/18 22:51:56.335   JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=0 <0x6f685520>
08      06/23/18 22:51:56.335   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.15454708635212677 <0x6f685520>
02      06/23/18 22:51:56.335   Device_LuaUPnP::HandleActionRequest 344 none of the 1 implementations handled it <0x6f685520>
02      06/23/18 22:51:56.335   JobHandler_LuaUPnP::RunAction device 344 action urn:upnp-org:serviceId:SwitchPower1/SetTarget failed with 501/No implementation <0x6f6

Can you please help to check the issue. I have checked the D_ and S_ files, especially S_SwitchPower and it is all OK. Can you please to check the main lua file for changes?

Offline Forzaalfa

  • Full Member
  • ***
  • Posts: 187
  • Karma: +5/-0
Re: A plugin update
« Reply #2 on: June 24, 2018, 07:36:00 am »
Awesome that you keep this app active!   :D

Did you include a port number in the settings as well? For TCP connection..

Maybe and old question, but why isn't this app in the store yet?
Vera Plus - RFXtrx433e

Offline halo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Re: A plugin update
« Reply #3 on: June 24, 2018, 09:52:30 am »
Issues with Livolo has been identified. There was a change in I_RFXtrx as below:

Quote
<action>
         <serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
         <name>ToggleState</name>
         <run>if (pluginLib ~= nil) then pluginLib.toggleState(lul_device) end</run>
      </action>

but my S_SwitchPower1.xml does not support "ToggleState" action.

Previosly actions in SwitchPower1 was only "SetTarget".

So I have added to the I_RFXtrx the actions as previous plugin version.

Quote
<action>
        <serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
        <name>SetTarget</name>
        <run>if (pluginLib ~= nil) then pluginLib.switchPower(lul_device, lul_settings.newTargetValue) end</run>
    </action>

Final version in attachment.

@Tinman, please verify attached file, if it is OK with Your awesome job with Sonoff switch.




Offline tinman

  • Full Member
  • ***
  • Posts: 167
  • Karma: +10/-0
Re: A plugin update
« Reply #4 on: June 24, 2018, 10:00:01 am »
Yes - I removed an action that should still be there. I just finished making the same changes you did. I've attached a new zip file. The only two changed file are I_RFXtrx.xml and L_RFXtrx.lua (updated the version number). So these are the only files that need to be uploaded to your Vera.

Offline halo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Re: A plugin update
« Reply #5 on: June 25, 2018, 02:52:16 am »
Thanks for updated version.

I would like to ask You for help with one more issue. I need the store the "raindiff" value, and every 1 minute put it in different place - multistring plugin for my irrigation control.

The problem is that I do not know exactly how to do this with updated plugin version. I was doing this in previous version of plugin without the array, but since You build it (RainByMnute) in new plugin version, it will be good the reuse it.

Scope of realization:

- in case the raindiff (by minute) will be bigger than 0 and time will be between 22:00 and 22:30, run scene no. XX to stop irrigation.

Please help propose the syntax and place in I_RFXtrx to realize such request.

Thanks a lot.

Offline tinman

  • Full Member
  • ***
  • Posts: 167
  • Karma: +10/-0
Re: A plugin update
« Reply #6 on: June 25, 2018, 12:55:20 pm »
I suggest you retrieve the rain gauge variable values in your own code and do whatever you like with the data. As you probably know, the rain data variables are strings containing comma separated values; one for each unit of minute, hour, day of week, month, etc. Here is a function similar to the one in the plugin that can retrieve the date into a table - or initialize an empty table:
Code: [Select]
-- Retrieve the a rain data table from the rain device data
local function getRainTableData(device, serviceID, variableName, size)
    local tableDataString = luup.variable_get(serviceID, variableName, device)
    local rainTable = {}
    if(tableDataString == nil)
        then
        local i = 1
        while(i <= size) do
            rainTable[i] = 0.0
            i = i+1
        end
    else
for v in string.gmatch(tableDataString, "(-?%d+%.?%d*)") do
rainTable[#rainTable + 1] = tonumber(v)
end
    end

    return rainTable
end
The service id will be "urn:upnp-org:serviceId:RainSensor1"
You can see the variable names by looking at your rain gauge device variables
You'll have to determine your rain gauge device ID or URN
The size only matters if you want to be able to create an initialized table of 0.0 values
You could use this code in a scene, triggered at 22:00, to determine whether or not to enable irrigation.

Offline halo

  • Jr. Member
  • **
  • Posts: 56
  • Karma: +0/-0
Re: A plugin update
« Reply #7 on: June 28, 2018, 03:01:34 am »
Thank you for it.

Offline Forzaalfa

  • Full Member
  • ***
  • Posts: 187
  • Karma: +5/-0
Re: A plugin update
« Reply #8 on: July 16, 2018, 02:50:35 am »
How do i best update the app on an OpenLuup/AltUI unit? It's running on a BeagleBoard xM, so i have no UI7 manual upload.. ?
Vera Plus - RFXtrx433e

Offline tinman

  • Full Member
  • ***
  • Posts: 167
  • Karma: +10/-0
Re: A plugin update
« Reply #9 on: July 16, 2018, 07:35:45 am »
I'm not familiar with the OpenLuup/AltUI environment at all. I would probably try to copy the files there using WinSCP or something similar. I assume it's running some flavor of Linux so there are probably several ways of getting the files copied there. Of course you'll have to know where to put them. That should be easy enough to find out if you can see the file system and where other similar files are located.

Offline Forzaalfa

  • Full Member
  • ***
  • Posts: 187
  • Karma: +5/-0
Re: A plugin update
« Reply #10 on: July 16, 2018, 06:31:57 pm »
Ok, i know there the files are on the debian system, but im not sure how to transport them. Was hoping that there was some link like you have in the apt-get system of linux that would do it for me. :)

I'll figure it out, and report here.
Vera Plus - RFXtrx433e

Offline tinman

  • Full Member
  • ***
  • Posts: 167
  • Karma: +10/-0
Re: A plugin update
« Reply #11 on: July 17, 2018, 09:34:42 am »
apt-get only works for the debian package maintenance system. It might have some use for OpenLuup and AltUI if those packages are available via debian but I can't see how it would have anything to do with the RFXtrx plugin. If you have a Windows PC I'd suggest getting WinSCP - it's free and makes viewing the filesystem on a Linux box easy, including uploading and downloading files.