openhab / openhab1-addons

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

[Network] online Channel should use Contact, not Switch, or at least support Contact #5682

Open rkoshak opened 5 years ago

rkoshak commented 5 years ago

Expected Behavior

The online Channel is a sensor value. It makes no sense to sendCommand ON to an Item linked to this Channel. The Contact channel was created to represent binary sensors like this. I expect online Channel would allow linking to Contact type Items, if not only support Contact Items. Switch Items should be reserved for actuators.

Current Behavior

The online channel only supports linking to Switch type Items.

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 two years like this and the breaking changes could cause a lot of disruption.

Steps to Reproduce (for bugs)

Not Applicable

Context

Personally, 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