Using OH 2.4 on Synology.
For my garden I deleveloped an irrigation control system with 16 valves some years ago. Now I want to extend it in the way that I can control all valves additionally with OH. I use homematic 8-channel output devices which channels are wired-OR with the existing system. To check the current valve states I use homematic 8-channel input devices which control Contact items. The logic behind is: If a valve is not switched on by OH switch item but the state of the Contact item is CLOSED anyway then the external irrigation control has switched on that valve. To update the states I have a rule which triggers when any change in the Contact items occurs. So far it works fine.
Now I want to show and control the states in my sitemap (Basic UI). I use the visibility option to display either a switch when the valve is not activated by the external system or just a message when the valve is externally activated. Here is a code example with following items:
Ventil_A1 - switch item for switching on and off via OH
vc-A1 - Contact item showing the state of the line; is updated by the rule
ext_A1 - Auxiliary contact item which is CLOSED when the valve is switched on by the external system, used to control the visibility state.
inside the rule:
if((Ventil_A1.state==OFF) && (vc_A1.state==CLOSED)) ext_A1.postUpdate("CLOSED") else ext_A1.postUpdate("OPEN")
In the sitemap:
Default item=Ventil_A1 label="A1: lawn" icon="switch" visibility=[ext_A1 == OPEN]
Default item=ext_A1 label="A1: lawn - extern" labelcolor=["green"] icon="garden" visibility=[ext_A1 == CLOSED]
The problem: Switching the display works, but when the valve is switched on and then off externally the switch icon becomes green, although the switch Ventil_A1 is definitely OFF and displayed correctly in the switch symbol on the right. Obviously, icon state doesn’t follow the switch state. Any idea or workaround?