@Mherwege you are right that there are 2 scenario’s for the advanced action that is created in nhc2 software with a virtual output.
- Use it as a pushbutton: single actions can fire a rule (status should be overridden within OH to always on/off) (this currently doesn’t work, read below)
- Use it as a switch: Turn a non-niko device on/off
Niko uses the basicstate parameter in their “generic” types to distinguish if an item is on/off. Normally for a switcheable item like a light, they use the “Status” parameter.
Turn on a light, basicstate goes off, status goes on
Niko Home Control: received topic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/control/devices/evt, payload {"Method":"devices.status","Params":[{"Devices":[{"Properties":[{"BasicState":"Off"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"Properties":[{"Status":"On"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]}]}
Turn off a light, basicstate goes on, status goes off
Niko Home Control: received topic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/control/devices/evt, payload {"Method":"devices.status","Params":[{"Devices":[{"Properties":[{"BasicState":"On"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"Properties":[{"Status":"Off"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]}]}
But for the generic action type, you will see the following:
Press once:
Niko Home Control: received topic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/control/devices/evt, payload {"Method":"devices.status","Params":[{"Devices":[{"Properties":[{"BasicState":"On"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]}]}
Press again:
Niko Home Control: received topic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/control/devices/evt, payload {"Method":"devices.status","Params":[{"Devices":[{"Properties":[{"BasicState":"Off"}],"Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]}]}
With the current version of the binding, I tried forcing to make a switch from the thing and adding the autoupdate=false but it doesn’t change to always on.
Switch ACTION1 "ACTION1_Button { channel="nikohomecontrol:pushButton:443b0xxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:button", autoupdate="false"}
Press once:
ACTION1 changed from OFF to ON
Press again:
ACTION1 changed from ON to OFF
So, we can circumvent this type of behaviour now, by creating a rule that acts on both statuses. Is it ideal? No. Does it work? Yes
As we know, there are several generic action types present:
+---generic - bose - audiocontrol - 10 UdmParameters
+---generic - coolautomation - hvaczone - 3 UdmParameters
+---generic - nikohomecontrol - windsensor - 5 UdmParameters
+---generic - nikohomecontrol - rainsensor - 4 UdmParameters
+---generic - nikohomecontrol - thermometer - 5 UdmParameters
+---generic - nikohomecontrol - lightsensor - 5 UdmParameters
+---generic - nikohomecontrol - humiditysensor - 5 UdmParameters
+---generic - nikohomecontrol - co2sensor - 5 UdmParameters
+---generic - nikohomecontrol - action - 3 UdmParameters
+---generic - sonos - audiocontrol - 74 UdmParameters
What I’m about to say is just guessing for now, but I think the UdmParameters are in fact the Basicstate options.
When the devices.list gets loaded from the broker, you can see this entry:
{"Properties":[{"BasicState":"Off"}],"Name":"ACTION1","Technology":"nikohomecontrol","Uuid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","Identifier":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","PropertyDefinitions":[{"BasicState":{"Description":"Choice(On,Off,Triggered)","HasStatus":"true","CanControl":"true"}}],"Online":"False","Model":"generic","Traits":[],"Type":"action","Parameters":[{"LocationId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"LocationName":"Home"},{"LocationIcon":"attic"}]}
My guess is that On,Off,Triggered corresponds to the 3 UdmParameters of the generic action. As I said, I’m just guessing for now. We’ll need more logs to see if this relation is correct.
Is this important? Maybe, it depends what other features you would like to see implemented in the future.
Just remember, that is it a virtual output. It doesn’t represent a real item within the Niko world, it’s just an UUID and in fact an “external” switch that we want to use for other purposes.