I’m trying to define a thing by providing things file, one channel is bound to a MQTT topic which returns true or false. It’s read-only so no command is defined. However I can’t seem to convert the Boolean to switch type, it always return NULL for some reason. Below is the configuration of the channel in question:
Type switch : leak_detect “Leak Detect” [ stateTopic=“xxxxx/reading/leak_detect”, on=“true”, off=“false”]
Any suggestion? Thank you!
The on=“true” and off=“false” is correct. If your item is still NULL, the problem may be elsewhere.
- Make sure your bridge is connected and is online
- Make sure the stateTopic matches exactly (I think it’s case sensitive too)
- Can you see the topic being published on your mqtt broker? Try using mqtt explorer or mosquitto_sub or some other means.
Thank you! Looks like I need to resubscribe the data - restart OH solved the problem