Hi,
Obviously it’s very possible to set device variables with PLEG, but how about Vera device variables for the box itself ? In particular to turn on/off Polling system wide.
I can’t seem to find any search results that say this is possible so wondering am I barking up the wrong tree ?
Regards
David
Any ideas why this doesn’t work as a PLEG action ??
{‘c_on’:[{‘delay’:0,‘actions’:[{‘device’:‘1’,‘service’:‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘action’:‘SetPolling’,‘arguments’:[{‘name’:‘PollingEnabled’,‘value’:‘1’}]}]}],‘c_off’:[{‘delay’:0,‘actions’:[{‘device’:‘1’,‘service’:‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘action’:‘SetPolling’,‘arguments’:[{‘name’:‘PollingEnabled’,‘value’:‘0’}]}]}]}
No errors in the log, just nothing no expected action.
Can someone please help with this, I’m getting quite experienced with Vera now but not tried my hand at LuuP so need a leg up.
Is any of the above likely to work ^^^^^^^^, or do I have to use the Luup ZWaveNetwork1’,'SendData…command and if so how ?
Thanks in advance,
D
I have no idea about your “Action” above (as it appears to be in JSON). Perhaps if you gave a full PLEG status report (in PDF format) it would help. There is more to an action besides just what it contains. People might be able to see why your action doesn’t run in your conditions and triggers.
Hi, right now I just want to get the action right, the condition and properties are very basic and are evaluating to be true anyway, the issue is with the syntax I believe what is in the action, as opposed to the action itself not working.
This is a copy/paste from the PLEG advanced properties field for the action, essentially when c_on is true (which it is) the action fires to set the zWave device iteself to enable system wide polling (value:1), or disable it (c_off - value:0)
{‘c_on’:[
{‘delay’:0,‘actions’:[{‘device’:‘1’,‘service’:‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘action’:‘SetPolling’,‘arguments’:[{‘name’:‘PollingEnabled’,‘value’:‘1’}]}]}],
‘c_off’:[
{‘delay’:0,‘actions’:[{‘device’:‘1’,‘service’:‘urn:micasaverde-com:serviceId:ZWaveNetwork1’,‘action’:‘SetPolling’,‘arguments’:[{‘name’:‘PollingEnabled’,‘value’:‘0’}]}]}]}
Can system wide settings be set in PLEG ? maybe that’s the issue as they do not appear in the advanced editor of PLEG (only devices with an ID of > 1 do).
Perhaps it needs to be written in Luup and incorporated into PLEG ? In which case can someone please help me with the correct Luup syntax.
Thanks in advance,
It may be better to try putting the calls into the Action’s Lua tab. I have never tried these particular actions but the Lua would be:
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="0"},1)
...
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="1"},1)
I would think you should have some logic to make sure that, in the event of a crash, your system doesn’t get left with polling disabled. I notice that there is another argument for this action that could be useful. The IsTemporary flag stops your actions persisting through the next restart:
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="0",IsTemporary="1"},1)
...
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="1",IsTemporary="1"},1)
Cheers Rex - I’ve applauded you.
I’ve added this in but beginning to think that turning polling on/off is not programmatically possible system wide as I’m getting the same non-error position without the expected result. Here’s a snipit from the log file…you see no errors but the polling is still enabled in the UI.
08 11/26/14 10:05:49.902 JobHandler_LuaUPnP::HandleActionRequest device: 236 service: urn:rts-services-com:serviceId:ProgramLogicC action: RunAction <0x30914680>
08 11/26/14 10:05:49.902 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=236 <0x30914680>
08 11/26/14 10:05:49.903 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:rts-services-com:serviceId:ProgramLogicC <0x30914680>
08 11/26/14 10:05:49.903 JobHandler_LuaUPnP::HandleActionRequest argument action=RunAction <0x30914680>
08 11/26/14 10:05:49.903 JobHandler_LuaUPnP::HandleActionRequest argument conditionName=c2 <0x30914680>
08 11/26/14 10:05:49.903 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.8782741027652847 <0x30914680>
08 11/26/14 10:05:49.905 JobHandler_LuaUPnP::HandleActionRequest device: 1 service: urn:micasaverde-com:serviceId:ZWaveNetwork1 action: SetPolling <0x2ab9f000>
08 11/26/14 10:05:49.906 JobHandler_LuaUPnP::HandleActionRequest argument PollingEnabled=0 <0x2ab9f000>
06 11/26/14 10:05:49.907 Device_Variable::m_szValue_set device: 236 service: urn:rts-services-com:serviceId:ProgramLogicC variable: ActionsMap was: {} now: {} #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ab9f000>
04 11/26/14 10:05:49.908 <0x2ab9f000>
polling is still enabled in the UI.
But does it continue to poll? You may need to wait until the end of the current polling cycle for the action to take effect.
Hi - yes, done all that before posting. It’s still Polls away like a politician on polling day. It’s like the LUA luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="0"},1) does not do anything, nor produce any errors.
Here’s a snipit of the config file which remains the same immediately after the above LUA call, 10 minutes later and after a restart. It’s just not sticking.
<state id="11" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="ComPort" value="/dev/ttyS0"/>
<state id="12" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollingEnabled" value="1"/>
<state id="13" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollDelayInitial" value="20"/>
<state id="14" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollDelayDeadTime" value="10"/>
It may not be possible to do what you are trying to do. Just because an action exists for a device does not mean it actually works.
What do you see in the log if you turn off polling from the UI?
<state id="169" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollingEnabled" value="0"/>
<state id="170" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollDelayInitial" value="20"/>
<state id="171" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollDelayDeadTime" value="10"/>
<state id="172" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollMinDelay" value="30"/>
<state id="173" service="urn:micasaverde-com:serviceId:ZWaveNetwork1" variable="PollFrequency" value="60"/>
It changes via the UI - Beginning to think this is locked down by Vera for some stupid reason.
Thanks for your help, if you have any other ideas why this isn’t sticking please do let me know.
It changes via the UI - Beginning to think this is locked down by Vera for some stupid reason.
Thanks for your help, if you have any other ideas why this isn’t sticking please do let me know.
The log shows that the action included arguments for polling parameters even though it was disabling polling. That could suggest that it requires those parameters for the action to succeed. Its worth a try. See http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#HomeAutomationGateway1 for details of the parameters.
Hi Rex,
I’ve now managed to get the polling turning on/off using a direct URL call:
http://192.168.0.8:3480/data_request?id=variableset&DeviceNum=1&serviceId=urn:micasaverde-com:serviceId:ZWaveNetwork1&Variable=PollingEnabled&Value=0
This works and does NOT specify the “SetPolling” Action defined in the [url=http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#HomeAutomationGateway1]http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#HomeAutomationGateway1[/url]
This proves that we can directly turn polling off/on directly and without the UI and therefore leads me to think that I need to remove the SetPolling from the following code you’ve suggested to make it work. I’ve tried doing this and it still don’t work which has got me flumoxed.
Original
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","SetPolling",{PollingEnabled="0"},1)
I’ve tried
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1","",{PollingEnabled="0"},1)
and
luup.call_action("urn:micasaverde-com:serviceId:ZWaveNetwork1",PollingEnabled="0","",1)
But neither work…any more ideas about the correct syntax to NOT use the SetPolling Action ?
FIXED… 8)
and this is why…
needed to use variable_set instead of call_action
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveNetwork1", "PollingEnabled", "0", 1)