tobof / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
39 stars 30 forks source link

Present sketchinfo and childinfo in detected things #109

Open epmsmid opened 6 years ago

epmsmid commented 6 years ago

First of all thanks for the great work for the MySensors OpenHAB binding. I use binding version 2.3.0 with OpenHAB2.

When I start a MySensors device it sends the sketchinfo end presents the child. The sketchinfo contains a description and a version. The presented childs also have a description. For example: // Send the sketch version information to the gateway and Controller and ask for ACK sendSketchInfo("Doorbell", "2.2", true);

// Register all sensors to gateway (they will be created as child devices) present(CHILD_ID_DOORBELL, S_BINARY, "Doorbell"); present(CHILD_ID_SWITCH, S_BINARY, "Doorbell sound");

Is it possible the descriptions and version are shown for the detected device? Currently the description of the detected thing is something like "MySensors Device (4,0)" and "MySensors Device (4,1)" and every child is a thing.

It would be nice if a Node ID is a thing and a child is a sub-item of a thing (like a zwave thing). E.g. something like:

MySensors Node 4: Doorbell; version 2.2 Child 0, type: light: Doorbell Child 1, type: light: Doorbell sound

tobof commented 6 years ago

Internally the OpenHAB2 binding works this way too. The binding does know which childs belong to which node. I'm not aware of a way to represent this in OpenHAB2, there's only a "thing".

Showing the description and version received from the node in the Inbox should be possible and is a good idea. It's just not easy to implement, because the binding reacts on every single message. At the moment it only reacts on the presentation message and generates a thing for the Inbox. The sketch info needs to be added. In fact the sketchInfo is send most of the time before a presentation is send.

epmsmid commented 6 years ago

Hi Tim, Thanks for your reply. In the openhabw documentation I read the following (https://docs.openhab.org/concepts/things.html): Channels Things provide “channels”, which represent the different functions the thing provides. Where the thing is the physical entity or source of information, the channel is a concrete function from this thing. A physical light bulb might have a dimmer channel and a color channel, both providing functionality of the one light bulb thing to the system. For sources of information the thing might be the local weather with information from a web service with different channels like temperature, pressure and humidity.

Isn't it possible that the MySensors binding exposes a node to OpenHAB as a thing and provide a channel for each child presented? This is the way a z-wave device is presented. The Mysensors implementation in Domoticz also works this way. I don't know if sketch info should be supplied before the presentation or it is required to send the sketchinfo. I always send the sketch info first. Maybe you can assume the sketch info should be sent first, and otherwise use a dummy name e.g. Node followed by the number of the node.

tobof commented 6 years ago

It's already implemented this way. :-)

As an example from: https://www.mysensors.org/download/serial_api_20#presentation

` S_DOOR 0 Door and window sensors V_TRIPPED, V_ARMED

`

In the binding S_DOOR is the thing and V_TRIPPED and V_ARMED are the channels.

epmsmid commented 6 years ago

I think you didn't understand me. I have a device that has different sensors. What I meant is that each sensor is a channel of the device. E.g. I have a multisensor: sendSketchInfo("Multi Sensor", "1.1", true); present(CHILD_ID_LUX, S_LIGHT_LEVEL, "Luminance"); present(CHILD_ID_TEMP, S_TEMP, "Temperature"); present(CHILD_ID_HUM, S_HUM, "Humidity"); present(CHILD_ID_BARO, S_BARO, "Pressure"); present(CHILD_ID_PIR, S_MOTION, "Motion");

The presentation I meant is like this:

MySensors Node 1: Multi Sensor; version 1.1 (Derived from sketch name and version) Child 0, type: light_level: Luminance Child 1, type: temp: Temperature Child 2, type: hum: Humidity Child 3, type: baro: Pressure Child 4, type: motion: Motion

Example of the presentation of a Fibaro Z-wave multisensor in PaperUI

image

image