mjcumming / Homie4

Python package for Homie v4 specification
MIT License
25 stars 22 forks source link

Logic of Property_Contact inversed? #16

Closed clmcavaney closed 3 years ago

clmcavaney commented 4 years ago

G'day,

I think the logic of the get_payload_from_value() method in the Property_Contact class is inversed

https://github.com/mjcumming/homie4/blob/8a2d23a1487c8cd378f0e3f594cf2680c34001f0/homie/node/property/property_contact.py#L43

I'm presuming the intent of the contact property is for a contact switch (like a door sensor) - which is what I am using it for. So wouldn't you want the value to be false when open (i.e. not contacted) and true when closed (i.e. when in contact)?

At the moment, the logic of that method is inversed.

Thoughts?

Regards, Christopher

mjcumming commented 4 years ago

Agree, this is confusion. I don't like the true/false. For me, a motion contact is True with open and False when closed. Please weigh in on this thread

https://github.com/homieiot/convention/issues/205

mjcumming commented 4 years ago

Also, worth checking out how the Alexa developers handle this

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-contactsensor.html