I am trying to implement a dimmer that updates its state updates onto mqtt event bus. I think have correctly configured the event bus command & state subscribers and publishers. The switch (switch on the dimmer ) updates(OnOffType) are being published on the event bus as expected. Other switch are also publishing on the event bus. When i change the dimmer values ( PercentType ), HTTP Post request and the delegation are happening, but this percent change state update is not being published onto mqtt event bus.
This is the same case with the ColorPicker, MQTT event bus support only switch type?
Please help me understand this.
What I found from the JSON that was returned by the rest is, the slider value is indeed maintained as state.
If it is maintained as state, I think it should trigger a publish on the MQTT event bus, isnt it?
You need to post your Items and and relevant rules.
I dont have any items or rules.
I am actually developing a binding. In this binding i have a channel, that is of Dimmer type. I have defined this in the thing-types.xml.
<description>some description </description>
I construct a thing/item that is linked to this channel and update the thing in the inbox using thingDiscovered dynamically.
I have already bound all the state & command updates of openhab to MQTT event bus using MQTT binding like below.
I am receiving openHAB state changes of Switch and Number items successfully on the MQTT.As soon as I change Switch from ON to OFF, the state change is published on MQTT event bus and everyone subscribed to the topic is receiving that msg.
But for Dimmer, when i change the percent, it is not publishing on MQTT event bus. Same is the case with Color picker.
I’ve retagged this posting with binding and openhab2 as you might get better and more appropriate response. The original tags and content made it sound like an Items configuration problem.
I’ve not developed a binding and have no experience with OH2 so can’t really help.
But I have to ask, what you seem to be describing is something that shouldn’t need a separate binding, or at least the posting/reading from MQTT should be done through the existing MQTT binding, not a separate custom binding. But perhaps I’m not clear on what you are trying to accomplish or your problem as I don’t know anything about OH2 channels and things.
Thanks Rich for tagging larger groups. Yes, If i have a simple dimmer and then try to get its state updated over MQTT, i can do it without binding. But, I have many sensors and this dimmer represents one of those.
Anyways thanks again for putting this in a larger group. Being my first post, you helped me get a direction.
Today I checked in the browser console if the item state is being updated if when dimmer is changed. It is indeed being updated.
So if the item state is being updated, why is not being published on MQTT event bus. All other events are working fine. Only Dimmer and Color picker are not able to publish state updates on MQTT event bus.
Does the MQTT binding read these differently? Does it work only for OnOffType and Number?