Different bindings for ON or OFF state of switch


I have the following:
Switch vent_niveau_3 “Ventilation max” (vent) {ihc=“0x33c311”}

Is it possible to say that the switch when it is ON, it should do {ihc=“0x33c311”} and when OFF, it should do {ihc=“0x33c312”}?



That would depend on the binding. The IHC does seem to support that.

Hi John,

Maybe something like this?

Switch vent_niveau_3	"Ventilation max"	<vent>	{ihc="<0xHHHHHH,>[ON:0x33C311:70],>[OFF:0x33C312:70]"}

0xHHHHHH should be used for the IHC resource providing feedback state.

:70 is the pulse time in milliseconds.

Best regards Ole.

Yes it works. A big thanks !!!

How will this work with openhab 2 and the 2.0 binding? Is it configurable via paper UI? or doe I need to do this by edition the items files itself?

This three year old post was about IHC version 1 binding.
It’s no help at all for version 2 with Things and channels.

v2 binding docs

You’d be interested in the commandToReact property of a switch channel.

The examples show how to use with a dimmer for two different commands - you set up two channels, each one reacting to just one command.
Then link both channels to the one Item.

You should be able to do all that in PaperUI