I’m controlling various devices and services I’ve built myself using MQTT. I was wondering if it would be possible if those devices could be auto discovered and I found the Home Assistant discovery in OpenHab. Sadly this discovery does not support the percentage control I use for those devices.
Is there a better way to implement an auto discovery in OpenHab for my devices? Is there maybe an OpenHab standard for MQTT discovery planed?
@rossko57 I tried adding a “brightness only light”, but OpenHab still adds a color channel. I also did take a look at the source code of the OpenHab addon and I found no dimmer item in the Home Assistant addon.
@denominator Thanks for the link. I already did take a look at the specification and did some tests. The Homie implementation looks very good and seems to work better with OpenHab. The only thing that is missing is the rollershutter type, but I guess I can just add a string channel and then link this to a rollershutter item in OpenHab.
But only if you keep the devices on homie/+ - if you move it off there, the binding will not find your devices as it’s hard coded in the binding…I did look at making a change as I think the homeassistant one might allow changing the base.
@denominator I have my first problem with the Homie Discovery. I configured a boolean trigger topic (simply a boolean topic without $retained = false) for a smoke alert. The item does appear as a trigger channel in OpenHab, but my rule seems to be triggered 4 times for each message that is sent to the topic. Here is my rule:
rule "SmokeDetector01"
when
Channel "mqtt:homie300:4ce1d806:smokedetector01:smoke#alert" triggered "true"
then
logError("Test", "Triggered")
end
The log appears 4 times for each message I send. Any idea what I’m doing wrong?
@hafniumzinc@rossko57@denominator Thanks for the hints. It seems that a simple restart of OpenHab fixed the problem. I hope that solves the problem, or could it be that a reconnect to the mosquitto broker registers the topics multiple times?
Interested as to why it’s not retained ? In transition false to true it will only ‘event’ once and presumably when cleared it will become false. A new MQTT client connecting would presumably want to know if it was still active… Not retaining state topics is unusual.
If the trigger action, rather than the sensor, is the thing that ‘clears’ the event then it can do that directly on MQTT
There are occasions when we’d like to treat some “binary” information as a bit more than binary.
Example, a smoke alarm state could be represented as “Okay” , “Alarm!”, and “Don’t know yet”. The sensor might not have communicated yet, and some faisafe scheme might want to avoid giving false “OK” signals if it doesn’t actually have positive data.
In the specific case of MQTT … retained data in that context is data supplied by the broker, “last I heard it was like this”, and could be regarded as false indication. I’ve no idea if that is what is going on, just pointing out there can be reasons.