openHAB 2.2 binding

  • Hero Member

    Dear fellow openHAB2 binding users,

    it's time for a new release of the binding. The added functionality is low, but under the hood there were a few changes, so after the refactoring @andreacioni has done at the beginning of this year, I've done some refactoring too, with the objective to fullfil the regulations for an integration into the official openhab2-addons repository.
    I've tried to improve the readability of the configuration and of the code itself.

    This leads to an important point: The current release is not backwards compatible!!
    Whatever is configured (MySensors binding related) will not work anymore with the current release.

    But why?

    • nodeId & childId were Strings in the old bindings and now are Integer
    • skipStartupCheck was renamed to startupCheckEnabled

    If you've configured the things with the *.things file you just have to do two easy steps:

    1. Look for skipStartupCheck and switch it with startupCheckEnabled and reverse the logic (true to false and vice versa)

    2. Look for nodeId="123", childId="456" and remove the quotation marks ", so it will look like: nodeId=123, childId=456

    Copy the new jar file into the addons folder, start OpenHAB2 and you're good to go.

    If you've configured the things in PaperUI the easiest way is to delete all things and rediscover them. Of course in large installations this won't be much fun.

    I hope this won't happen again in further versions! :s

    Fixed in this release:

    • RGB & RGBW corrections
    • Removed bug that prevented autodiscovery of deleted things
    • mysensors.test fragment added / tests moved
    • Static code analysis
    • Move to 2.2.0 Snapshot

    The changes in functionality were small so there is no need to install the new version asap if you are able to forgo the above mentioned functionality.

    OpenHAB MySensors Binding 2.2.0

    OpenHAB MySensors Binding 2.1.0 (old binding version, with old configuration if you still need it)

  • Hello @TimO
    I just update my things file but it doesn't work :

    17:31:22.147 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTING - org.openhab.binding.mysensors
    17:31:22.284 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={,,, service.bundleid=223, service.scope=bundle} - org.openhab.binding.mysensors
    17:31:22.294 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTED - org.openhab.binding.mysensors
    17:31:22.846 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:bridge-eth:ESPgw' has been added.
    17:31:22.890 [DEBUG] [nsors.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    17:31:22.904 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:bridge-eth:ESPgw' changed from UNINITIALIZED to INITIALIZING
    17:31:22.971 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.
    17:31:22.975 [DEBUG] [ensors.factory.MySensorsCacheFactory] - Cache (given_ids) content: [0, 211, 8, 42, 15]
    17:31:23.001 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Enabling connection watchdog
    17:31:23.009 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge []
    17:31:23.017 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:bridge-eth:ESPgw' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
    17:31:23.063 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    17:31:23.019 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'mysensors:bridge-eth:ESPgw': java.lang.NullPointerException

    And after I have :

    17:31:23.199 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;14;Gateway startup complete.
    17:31:23.218 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:temperature:ESPgw:TempWC' has been added.
    17:31:23.223 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:temperature:ESPgw:TempWC' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
    17:31:23.227 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:humidity:ESPgw:HumWC' has been added.
    17:31:23.233 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:humidity:ESPgw:HumWC' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
    17:31:23.240 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:motion:ESPgw:MotionWC' has been added.
    17:31:23.250 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:motion:ESPgw:MotionWC' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
    17:31:23.255 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:waterQuality:ESPgw:OrpPiscine' has been added.
    17:31:23.267 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:waterQuality:ESPgw:OrpPiscine' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
    17:31:23.283 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:cover:ESPgw:VoletBureau' has been added.
    17:31:23.288 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:cover:ESPgw:VoletBureau' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
    17:31:23.334 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;0;0;18;2.1.1
    17:31:23.336 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Presentation Message received
    17:31:23.347 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;2;2.1.1
    17:31:23.352 [DEBUG] [rsAbstractConnection$MySensorsReader] - Good,Gateway is up and running! (Ver:2.1.1)
    17:31:23.372 [INFO ] [al.protocol.ip.MySensorsIpConnection] - Successfully connected to MySensors Bridge.
    17:31:27.427 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 211;0;1;0;52;457.6
    17:31:27.428 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 211 found in gateway
    17:31:27.430 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 0 not present in node 211
    17:31:34.557 [INFO ] [marthome.event.ItemStateChangedEvent] - WhHP changed from 8359822 to 8359834
    17:31:34.563 [INFO ] [marthome.event.ItemStateChangedEvent] - PAPP changed from 2540 to 2550
    17:31:37.425 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 211;0;1;0;52;459.2
    17:31:37.429 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 211 found in gateway
    17:31:37.432 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 0 not present in node 211
    17:31:43.693 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 15;3;1;0;16;0
    17:31:43.695 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 15 found in gateway
    17:31:43.696 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 3 not present in node 15
    17:31:47.422 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 211;0;1;0;52;456.3
    17:31:47.424 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 211 found in gateway
    17:31:47.427 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 0 not present in node 211

    My things file :

    Bridge mysensors:bridge-eth:ESPgw [ ipAddress="", tcpPort=5003, sendDelay=200, networkSanCheckEnabled=true ] {
      temperature     TempWC   [ nodeId=15, childId=1 ]
      humidity        HumWC    [ nodeId=15, childId=2 ]
      motion          MotionWC    [ nodeId=15, childId=3 ]
      waterQuality    OrpPiscine  [ nodeId=211, childId=0 ]
      cover           VoletBureau [ nodeId=42, childId=1 ]

  • It works when I set networkSanCheckEnabled=false
    Why ? before update I have no problem with this.

  • And just another "problem". When I send UP command to my roller shutter node and after a stop, node send me :

    17:44:50.032 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 42;1;1;0;3;81
    17:44:50.034 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 42 found in gateway
    17:44:50.035 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 1 found in node 42
    17:44:50.036 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: dimmer(V_PERCENTAGE) value to: 81
    17:44:50.041 [DEBUG] [ensors.handler.MySensorsThingHandler] - Setting last update for node/child 42/1 to 2017-07-18T17:44:50.000+0200

    but Item VoletBureau is not updated with this value.

  • Hero Member


    Thanks for reporting!

    1. NPE: it is fixed now. I've made a mistake while renaming the parameters.

    2. Did that ever work? I don't recall changing that logic lately. I've added the code now. Could you please test it and give me a feedback?

  • @TimO
    It works fine now for 1 and 2. If I remember you send me a version few month ago wich updating dimmer value.
    Thank you !

  • Hardware Contributor

    @TimO I have a small problem here. I was trying to get into openhab (again) this time using your new 2.2 binding. I removed the old jar and installed the new one. I had also removed all things in the paper ui before. Afterwards I tried to add the gateway via things file again.

    Bundle:list says:

    190 | Installed |  80 |     | MySensors Binding

    but this things file:

    Bridge mysensors:bridge-ser:gateway [ serialPort="/dev/ttyUSB0", sendDelay=200 ] {
        /** define things connected to that bridge here */

    Only results in an error message:

    22:49:56.806 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'mysensors.things'
    22:49:56.847 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'mysensors.things' is either empty or cannot be parsed correctly!
    22:49:56.988 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mysensors.things'

    Any idea what I did wrong? The port is right I can receive messages via cat /dev/ttyUSB0.

    PS also is there already a timeline for when you will be able to add this binding to the official openhab "store"?
    PPS The binding also doesn't show up in the menu where you can scan for new things. Is there something more to do to install this new version? The old one was working.

  • Hero Member

    @LastSamurai Looks like the binding wassn't initialized. There should be a message in the log why the init failed. My guess: is missing. Did you execute this step: feature:install openhab-transport-serial?

    I can't give you a timeline about the integration. There is a PR here:

    It took me quite some time to fulfill all requested changes and I'm now waiting for a review by Kai Kreuzer, the owner of the Repo.

    You are able to install the binding via the IoT Marketplace:

    MySensors Binding:


    A big disadvantage: Requirements are not fulfilled automatically. This will be added in the future. You have to execute the command above (before installing the binding) in the karaf console: feature:install openhab-transport-serial.

  • Hi,
    When I use the 2.2.0-SNAPSHOT version of the binding, the zwave binding can't initialize the serial connection to the zwave dongle. With no mysensors things, it's OK. I made a ticket on git. I revert back to 2.1.0-SNAPSHOT and it's OK.

  • Hardware Contributor

    @TimO Thank you. I installed the transport-serial feature (again... I had it installed for the last version of the binding already) and now its working.

  • Hero Member

    @Feji I've updated the issue on github.

    Fejitatete created this issue in tobof/openhab2-addons

    closed Zwave incompatibility #86

  • Hi,
    thanks for the new Version! I've got a Problem with the Network Sanity Check, it doesn't run.

    I got a ESP8266 Based Ethernet Gateway which is configured with DHCP. Everytime the DHCP Lease got renewed the Connection between the Gateway and openHAB is lost for a short Time. The Binding doesnt' recognize this. The Gateway and all Sensors marked as Online but not a single Message comes from the Gateway. I could also reproduce this if i reboot the Gateway.

    I tried different Settings for the Sanity Check but nothing worked.
    I switched to Debug-logging for the Binding. After the Connection is lost, not a single Log Entry is written.

    If i go into the Settings from the Gateway thing and change something, the binding start to communicate with the Gateway again, but all Sensors marked as offline in openHAB. There are incoming Messages from Sensors but the Binding write to log:

    20:35:10.030 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 5;2;1;0;1;67.9
    20:35:10.036 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 5 found in gateway
    20:35:10.041 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 2 not present in node 5

    if i restart whole openHAB all is functional again until the next time this occurs.

    Thanks for help,
    Greets Phil

    Edit: I also get the same Log entries as above if i change a Setting from the sanity check, without rebooting the Gateway.

  • Hi, tobof. Thx again for the serial fix :).
    However I had this issue with the power counter node :

    09:16:02.900 [WARN ] [rs.internal.gateway.MySensorsGateway] - Variable V_WATT not present
    09:16:03.285 [WARN ] [rs.internal.gateway.MySensorsGateway] - Variable V_KWH not present

    The Gateway and the node are in 2.2.0b, Openhab in 2.2.0 SNAPSHOT.

  • Hero Member

    Hey @Feji !

    When did that message appear. Could you please post the log before and after the warn message ocurres?

  • Hi,

    this is the entire log.

    16:34:26.529 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244336630 TSF:MSG:READ,102-102-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    16:34:26.532 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244336655 TSF:MSG:SEND,0-0-102-102,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:C847F69309390B8321591E8A0177300C610B45574986153FB7
    16:34:26.535 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244336736 TSF:MSG:READ,102-102-0,s=1,c=1,t=18,pt=7,l=5,sg=1:54312.0080
    16:34:26.559 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 102;1;1;0;18;54312.0080
    16:34:26.569 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 102 found in gateway
    16:34:26.577 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 1 found in node 102
    16:34:26.591 [WARN ] [rs.internal.gateway.MySensorsGateway] - Variable V_KWH not present
    16:34:46.457 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244356571 TSF:MSG:READ,102-102-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    16:34:46.484 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244356594 TSF:MSG:SEND,0-0-102-102,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:894CE25CF528B67D1DEE9B37F9CFC352C330BE7EB1E10F5E74
    16:34:46.558 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;244356675 TSF:MSG:READ,102-102-0,s=1,c=1,t=17,pt=5,l=4,sg=1:195
    16:34:46.641 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 102;1;1;0;17;195
    16:34:46.646 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 102 found in gateway
    16:34:46.651 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 1 found in node 102
    16:34:46.655 [WARN ] [rs.internal.gateway.MySensorsGateway] - Variable V_WATT not present

  • @Feji
    I found it, the "Revert State" option was activated for this node. Now it's working as expected.
    The log message might be more "explicit".

  • Admin


    Trying openhab2 out.. Fresh install, with both serial and mysensors binding installed.

    I'm using socat to make a virtual comport to node-red

    In the openhab logs I see a lot of errors like

    15:04:07.252 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:04:07.379 [WARN ] [rsAbstractConnection$MySensorsReader] - Exception on reading from connection Underlying input stream returned zero bytes
    	at sun.nio.cs.StreamDecoder.readBytes([:1.8.0]
    	at sun.nio.cs.StreamDecoder.implRead([:1.8.0]
    	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$[186:org.openhab.binding.mysensors:]
    	at java.util.concurrent.Executors$[:1.8.0]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker([:1.8.0]
    	at java.util.concurrent.ThreadPoolExecutor$[:1.8.0]
    15:04:07.680 [WARN ] [rsAbstractConnection$MySensorsReader] - Exception on reading from connection Underlying input stream returned zero bytes
    	at sun.nio.cs.StreamDecoder.readBytes([:1.8.0]
    	at sun.nio.cs.StreamDecoder.implRead([:1.8.0]
    	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$[186:org.openhab.binding.mysensors:]
    	at java.util.concurrent.Executors$[:1.8.0]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker([:1.8.0]
    	at java.util.concurrent.ThreadPoolExecutor$[:1.8.0]

    I can see that the gateway indeed does answer to the 0;0;3;0;2 request, and the reply is also send on to openhab2.

    I have tried to disable startup checks, but I get ERROR 409: conflict as a toast message in the lower right corner of paperui when I try to save settings.

    Anything I have missed somewhere?

  • @TimO
    I'm new to MySensors and openHAB and this might be vary basic questions.
    As I only have start with a small system with openHAB on an RPi3, a serial gateway and 2 nodes so the update to openHAB 2.2 binding will probably not be a big deal.
    In the explanation of the changes, you write "The current release is not backwards compatible" and "I hope this won't happen again in further versions!". Does this mean that a new version is backward compatible with e.g. V2.1.0 or that I in anyway must do the reconfigurations now but don't have to do it again?
    I have configured my things in Paper UI and have to delete them but do I have to clean the *.items file and *.sitemap file? Further down in the "topic" you have a link to "" with a link to a new version of the binding and I wonder if this is the one I'm going to use?

    Fejitatete created this issue in tobof/openhab2-addons

    closed Zwave incompatibility #86

  • @MagnusF
    This version of the binding is for thus want to use two or more serial connection with openhab.
    Before delete all your things configured in PaperUI, you should consider to dedit the org.eclipse.smarthome.core.thing.Thing.json database in /userdata/jsondb/ and delete the " " around the nodeId and childId. Before editing this file, you must stop your openhab.

  • @Feji
    Thanks for your replay! But unfortunately, that was not an answer to my thoughts.

    1. You say "This version..." Do you mean to use two "MySensors Serial Gateways" connected to one controller with OpenHAB?
      Does this mean that if I connect one more "MySensor Serial Gateway" to my controller that I will have one more "MySensor Serial Gateway" thing but with another bridge definition?
    2. In the file "org.eclipse.smarthome.core.thing.Thing.json" there are no things defined with i.e. nodeid="1" and childid="2" it looks like this
      "mysensors:temperature:709db93f:temperature_2_1" i.e. nodeid 2 childid 1. Do I look in the wrong file?