Closed ghost closed 4 years ago
Yup an example makes sense. Enums for events are actually a good match IMO.
Example of a button is in the homie4 python package. This implementation uses a boolean that is changed to true for a button push and then immediately false.
https://github.com/mjcumming/homie4/blob/master/test_button.py
That is good to know but answering the question here in the ticket will not have much impact on others. We would need to link it somewhere in the documents. Imho related to #51
@ThomDietrich agree. First, I really think we need to start defining some basic device types such that a controller would be able to control and interact with a device without any user intervention. For that to happen we need to start defining basic properties and expected function. ie. a switch, dimmer, contact, etc. I have a little over a 100 homie devices in use with OpenHAB but had to manually configure each of them with .items definitions to map topics to appropriate item types. We really need a working group to get that started.
Doorbell is mentioned more then once as an example of a non retained property. It would be useful to have a small example of that specific case, just as a guideline.
Mainly I'm not sure what the most sensible way to add thatone would be :) I'm thinking something like homie/doorbell/button/pushed > 'true' for each press. But it feels slightly wrong to have a boolean that only is true :) I guess it doesn't even need a payload really to convey events which carry no information other then that they happend.
Another option would be an enum type, something like: homie/doorbell/button/events > 'pushed', don't think I like that more
Ofcourse you might decide it's something outside the scope of the convention, but a single example for non retained might be reasonable :)