I have a switch item that i would like to be linked with 2 MQTT topics, 1 outgoing and 1 incoming. I would like to do this so i can switch a relay on and off. lets not get into what the relay is connected to and how its communicated, but lets just say, its publishing and reading on the topic “Gateway1-in/4/1/1/0/2” perfectly fine. I can toggle my switch on the web UI and it will toggle my light. Now, i also have a light switch that publishes its state on the topic “Gateway1-out/3/3/1/0/2”. This is also working perfect too. I can toggle my light switch while subscribed to the topic and see it publish a 1 for on and a 0 for off.
The problem lies with; i can’t get the switch item to sync with the state of the switch, I have received much appreciated help from a fellow member around here and he advised me to have my item defined as the following:
Switch CinemaRoom_Light01 "Ceiling Lights" <light> (SF_CinemaRoom) {mqtt=">[mymosquitto:Gateway1-in/4/1/1/0/2:command:ON:1], >[mymosquitto:Gateway1-in/4/1/1/0/2:command:OFF:0], <[mymosquitto:Gateway1-out/3/3/1/0/2:state:MAP(1on2off.map)]", autoupdate="false"}
This works fine for the web UI to toggle the light (when the autoupdate feature is set to true obviously) but it is not syncing its behavior to the switch, i’m toggling the light switch and its updating its MQTT topic, but it is not altering the Item. I have tried changing the state type of the switches topic from mapping to default, no luck still.
Does anyone have any idea where i’m going wrong here?