OH3 - MySensors Binding

  • Hello,

    has anyone of you guys already a bibdign version for OH3?

  • Hi,
    I don't use MySensors binding so I have not tested it in OH3. But I know, that there are not binding special for OH3. All binding 2x should work with OH3. Difference is with binding 1x - these are not working with OH3.

  • The 2.5 binding does not work out of the box in OpenHAB 3 for me.

    2020-12-22 22:53:34.555 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.mysensors-2.5.0-SNAPSHOT.jar
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [272]
      Unresolved requirement: Import-Package: org.eclipse.smarthome.config.core
            at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
            at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

    I guess it has somehing to do with this?


    Namespace change of openHAB core classes
    With the migration of Eclipse Smart Home to openHAB the namespace of all classes in openHAB core needed to be changed. This means all imports done by bindings that refer to org.eclipse.smarthome have been changed to org.openhab.core. With your binding code you can simply do a file level replace of this text string in the java source files to migrate the binding. On linux you can use the following commands in you src/main/java directory:

    find . -name *.java -exec sed -i "s/org.eclipse.smarthome.core/org.openhab.core/g" {} ;
    find . -name *.java -exec sed -i "s/org.eclipse.smarthome/org.openhab.core/g" {} ;

  • Well it seems that there isn't and ther won't be a mysensors binding anymore. It was abandoned by the developer.

    So as of december 2020, with OpenHAB 3, the way to go is plain MQTT.

    I can't say I disagree really. MQTT is simple and works.

    I'm going to start from scratch and try to document my experience here.

  • Sad to hear that. I really liked the binding. I used MQTT before the binding and it worked but the binding was easier to use with auto ID and so on. Looking forward on following your progress. I guess I have to do the same, when I find the time.

  • I'm thinking about running a separate instance of OpenHAB 2 under docker, just to get the mysensors binding functionality. Or can I get all the functionality of the binding, via MQTT? Like auto ID and that the sensor (like a watermeter) can request its previous value from the controller.

  • Running OpenHAB 3 as my main system and OpenHAB 2 with the MySensors binding, under docker, works great. I use the remote binding in OpenHAB 3 to connect to OpenHAB 2. Just make sure to run them on different ports if they run on the same server.

  • @Klabbe great to know. Thanks

  • Hello,
    Is smartsleep option of mysensors is implemented in de mqtt gateway? I have some battery powered units to control blinds which I put a lot in (smart)sleep to preserve batteries. This functions well with OH2 and mysensors binding....I'd rather not keep and OH2 instance running next to my OH3 instance if not necessary.

  • I think so. I have a lot of battery powered nodes heavily using smartsleep and they work just fine with MQTT.

  • Thanks Guillermo, are you using qos 1 for this, or are messages kept on the gateway automatically to deliver to a sensor which is asleep. Think I have to rebuild my gateway to mqtt then....


  • Hero Member

    I'll look into the changes needed to migrate the binding to OH3 and let you know.
    Maybe it's no big deal and I'll provide a version 3 binding.

  • @TimO That would be very appreciated! I really like your binding and it would be great to continue to use it without an extra instance of OpenHAB 2. I tried to compile it and got like 10 errors. Since I have zero java skills, I was unable to fix them.

  • @TimO, a binding for openhab 3.0 would be very much appreciated!

    I have tried the MQTT gateway, and with standard setup, messages are lost wich are sent to the node when asleep. Does anyone know how to solve this. I didnt find anything in de mqtt-gateway config. I see mqtt messages which could be read by the controller (openhab), when the node goes to sleep and wakes up, but at this moment I don't see how to implement this in openhab MQTT generic things.


  • Hero Member

    For those of you willing to help testing the OH3 integration here is a link:

    Jar Download

    Please don't forget to fulfill the requirements for mqtt und serial. Installation of bindings will do.

    What's working after a quick test:

    • binding loads in OH3
    • serial gateway receives messages (ethernet gateway should work too)
    • discovery is working

    What's not working:

    • MQTT gateway: it's broken some time and needs some tinkering

    Please let me know if you found some time to test the binding.

  • @haasje30
    smartsleep is easy with MQTT

    Initially a few years ago i tried the binding and it gave me nothing but trouble.
    While it was configured I'd watch MQTT to see what it would do.

    2020-12-31 22:58:22 unoout/202/255/3/0/33 180000 (THIS IS THE SLEEP DURATION)
    2020-12-31 22:58:22 unoout/202/255/3/0/32 500 (AT THIS MOMENT YOU HAVE 500MS to GET A COMMAND SENT)

    So define a thing to the channel ending in 32.
    Bind an item to that channel with an expire timer for like 10 seconds state = 0

    then for your rule you'd have

    rule "whatever"
    Item whateverSleepItem changed from 0 to 500

  • Thanks TimO and waspie. At this moment I have one mysensors hardware gateway, which is connected to my openhab2 instance. I have an OH3 test instance, and no hardware controller for this (yet). I did an short test with my current controller, but this is not the best way for me. So I orderded an wemos D1 mini to create a new mysensors gateway. As soon as this is in I will be testing. Thanks again...

  • This post is deleted!

  • @haasje30 if it's mqtt both can subscribe at the same time

  • @TimO Thank you! It works for me with my Ethernet Gateway. I don't have that many nodes but the ones that I have, works as good as they did with OpenHAB2. I have a watermeter, an actuator and a door sensor. Great work!

  • Hero Member

    @Klabbe thank you for your feedback!

  • @Klabbe great! perhaps I'll go back to ethernet gateway. Do you think is better option over mqtt gateway?

  • Hello,

    I did some testing with 2 openhab versions to one ethernet gateway. At first it did not discover any devices, thats because they were allready discovered in the old (2.5) version of openhab, I Think, because when I created a new mysensor device,it was immediattely discovered by the new openhab. I noticed a minor problem, there is an ability to scan (and because auto discovery did not seem to work I tried this), but after a scan the ethernet gateways failes. When you try to add a device(manually), it goes back to the first page when you select the gateway. I had to restart de openhab service to get it running again.

    I tested with a new blinds sensor (with smartsleep), and smartsleep seem to work OK. So I prefer this binding over de generic mqtt binding, because stuf like request() and smartsleep() work 'out of the box'. These are my fisrt tests, I will be doing more (other sensor types) later on when I have an additional gateway available.


  • This post is deleted!

  • @TimO ,

    many thanks for the updated binding. I just wait to update my OpenHAB to version 3.0.0 till your binding is ready. I use a OpenHAB manual install since many years on a ArchLinuxARM system. My Mysensors gateway is a serial one, which works like a charm till OpenHAB 2.5.11 and your bindings.

    Today I updated to OpenHAB 3.0.0 and tried also OpenHAB 3.1.0-Snapshot. In both cases I got the Mysensors binding not working. It shows just "Initializing" in the Things overview. mqtt and serial transport features are installed. I don't change the manual config (things / items) files from 2.5.11 to 3.0.0.

    If I use the openhab console, the bundle:diag and bundle:status shows "Active" and no errors.

    If I take a look into the openhab.log, I found entries like:

    [WARN ] [core.karaf.internal.FeatureInstaller] - The binding add-on 'mysensors' does not exist - ignoring it.


    [WARN ] [org.apache.felix.fileinstall        ] - A bundle with the same symbolic name (org.openhab.binding.mysensors) and version ( is already installed.  Updating this bundle 
    [WARN ] [org.apache.felix.fileinstall        ] - Failed to uninstall bundle: /opt/openhab/addons/org.openhab.binding.mysensors-3.1.0.jar.1 with id: 87. The bundle has already been uninstalled

    Maybe you can share some ideas how to solve this issue? Any help is appreciated...

  • Hero Member

    @kerberos Interesting find. Haven't seen something like this till now. I suggest to delete the jar file, delete the cache and start over again.

    I haven't tested textual configuration, but this should work just fine and your problem occurred before the textual configuration is initialized.

  • hmm maybe I go back to the binding as well. Just spent several hours migrating all to the mqtt binding. It's working now but much slower.... So when I press a button the mqtt is slower to react as with the mysensor binding is. Why so?

  • @TimO

    many thanks for quick answer. I already remove the jar file and delete the cache, tmp and mysensors folder in the userdata folder several times. The textual configuration is used for many years, with some small updates. I don't try the gui configuration.

    If you need more data's for debugging, I will provide.

  • Great work TimO your thing is working for me. Didn't do that much with it yet, so will keep testing.

  • @TimO What a fantastic build, thank you so much!
    My build:
    OH2 -> 3.0.0 upgraded via raspberry pi update (in OH3 instructions)
    Battery Nodes, Color Lights, Buttons, Moisture sensors
    My Sensors Eth Gateway Serial bridge

    Side note for any newbies like me out there. Follow the instructions for OH2 installation for my sensors. Follow the directions for manually adding in the addon. And using TimO's jar instead.

    I've been monitoring all my logs and no issues reported, everything seems to work just like in OH2.

Log in to reply

Suggested Topics

  • 22
  • 10
  • 3
  • 6
  • 2
  • 132
  • 16
  • 1