Things definition vs nodes and childIDs

  • Hi guys,

    I've set up a couple of MySensors nodes in OpenHAB and it's working fine. However, I am a bit surprised by the number of things definitions I need.

    Currently, I have defined one thing per MySensors childID.
    Is this really necessary or have I missed something?

    Wouldn't it be more preferable to define one thing per MySensors node?
    (Things in OpenHAB should are meant to represent the physical layer which seems to align well with the MySensors node level.)

    For example, I have a (node manager) temperature/humidity node with battery status, defined in three OpenHAB things:

    Thing temperature MYS_Node10_Temp  "MYS 10-0 Temperature" [ nodeId=10, childId=1 ]
    Thing humidity    MYS_Node10_Humid "MYS 10-1 Humidity"    [ nodeId=10, childId=2 ]
    Thing multimeter  MYS_Node10_Maint "MYS 10-1 Maintenance" [ nodeId=10, childId=201 ]

    I have a total of five items linked to the things:

    Number MYS_10_Temp    "Temp [%.1f°C]"    <temperature> (gTemp, gMySensors)   ["CurrentTemperature"] { 
        channel="mysensors:temperature:MYS_gw1:MYS_Node10_Temp:temp" }
    Number MYS_10_Humid   "Humid [%.1f%%]"   <humidity>    (gHumid, gMySensors)  ["CurrentHumidity"] { 
        channel="mysensors:humidity:MYS_gw1:MYS_Node10_Humid:hum" } 
    Number MYS_10_BatStatus "Batteristatus [%.1f%%]" <batterylevel>     (gBattery, gMySensors) { 
        channel="mysensors:multimeter:MYS_gw1:MYS_Node10_Maint:battery" }
    Number MYS_10_BatVoltage "Batterispänning [%.1f]" <batterylevel>     (gBattery, gMySensors) { 
        channel="mysensors:multimeter:MYS_gw1:MYS_Node10_Maint:volt" }
    DateTime MYS_10_LastUpdate "Last update [%1$ta %1$tR]" <time>  (gLastUpdate, gMySensors) { 
        channel="mysensors:multimeter:MYS_gw1:MYS_Node10_Maint:lastupdate" }

    Is there a smarter or more efficient way of settings this up?

  • @fredswed As far as I know, there isn't a better way. A thing is indeed a phisycal object, and a node groups several of them. 🤷

    Can I ask you which kind of connection/gateway are you using? I'm strugling with the mqtt gateway and the binding.


  • @guillermo-schimmel Thanks for your response - I would rather consider the node to be the single physical object that provides one or several capabilities (items). Much the same way the Hue, Trådfri or BigAssFan bindings do it.

    I currently use a ESP8266 gateway connected by WiFi. I've tried the MQTT connection but couldn't really see any real benefit. The downside was that it was really hard to troubleshoot in OpenHAB as I needed the old mqtt binding for other stuff. I noted that OH2.4 switched to the new Eclipse MQTT binding so I expect it to be easier to set up MySensors with MQTT in OH2.4 and later.

  • @fredswed Yes I'm testing that now. I think it's working. Auto discovery is nice.