I am looking for easy way how to map inverted light for google assistant.
I have Niko Home Control (NHC) bindings in OH 3.2 working quite well with my Lights.
NHC push buttons mounted at walls with led indicators works in inverted way:
when “light is on” it means “LED on pushbutton is on and the light bulb is actually off”
when “light si off” it means “LED on pushbutton is off and the light bulb is actually on”
When assigning GA tags, you can do inverted mappings for switches, but not for lights.
I created virtual switch and 2 rules to simulate inverted behavior, unfortunately it will not reflect actual state of the bulb when someone push the button at the wall manually (it will unsync state of the bulb and state of the virtual light)
Anybody with the better approach please? It would be great to map inverted behaviour from thing to item directly somehow.
Another issue is a little bit different:
I have 2 things for main gate control:
Those are just “push” action to send command to the gate motor, and are always ON when idle.
To activate any action, you need to change state to OFF, wait some delay and change it back to ON
for every inverted light a created a new rule (2 rules, one for every possible final state) to update virtual button state when state of the original item has changed
for two actions (independent) things for controling main Gate I created 2 rules:
a) when virtual swich (Gate) changed to OFF, I triggered 3 actions: A) send command OFF to thing_1_open_gate, B) use ECMA sript for delay 500 ms : java.lang.Thread.sleep(500); c) send command ON to thing_1_open_gate (because final idle state for pushbutton is ON again)
b) when virtual switch (Gate) changed to ON, I triggered 3 actions: A) send command OFF to thing_2_close_gate, B) use ECMA sript for delay 500 ms : java.lang.Thread.sleep(500); c) send command ON to thing_2_close_gate (because final idle state for pushbutton is ON again)
I find that most of my solutions for “need Google Assistant to do something” involve a virtual switch and a rule.
I’m confused as to why you’re doing the exact same thing regardless of whether the virtual switch changes to ON or OFF. I’m guessing that there were supposed to be more edits to the second statement after copying it.