openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

[Zwave] Sensor Channels should use Contact instead of Switch #5683

Open rkoshak opened 5 years ago

rkoshak commented 5 years ago

Expected Behavior

Many devices report a binary sensor value. It makes no sense to sendCommand to a sensor and one could argue attempting to do so should generate an error. The Contact Item type works in this way and is intended to be used to represent binary sensor values (e.g. motion sensors, door/window sensors, etc).

Current Behavior

Many (all?) binary sensor values for Zwave devices use the Switch Item type. This has caused some confusion for some new users and it causes extra work for users to present these sensor readings on their sitemap. The following devices I personally use that I know have binary sensors that require Switch instead of Contact.

Possible Solution

To avoid too much disruption, add another Channel that supports linking to Contacts, or modify the Channel so it supports both (possible?). Ideally only Contact should be supported but it has been a long time like this and the breaking changes could cause a lot of disruption.

Steps to Reproduce (for bugs)

Not Applicable

Context

ersonally, it requires extra work to display and use these sensors values as read only on sitemap and HABPanel.

I've also had to spend time on the forums to deal with people who do not understand why noting happens when they sendCommand to an online Channel linked Item. Sending a command to this Channel should be an error (which would be the case if we used Contact).

It also makes it difficult to combine sensors from multiple bindings into a single Group as some binding authors use Switch and others use Contact. Thus if I have other bindings that report online status that require Contacts I can't use Group:Contact:OR(OFF, ON) to see if one is offline and instead have to write a Rule.

Your Environment