Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. OpenHAB
  4. openHAB binding

openHAB binding

Scheduled Pinned Locked Moved OpenHAB
89 Posts 30 Posters 55.6k Views 33 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bklB bkl

    @BastienVH

    Hi.

    The "Unknown: MySensors message:" log, should only appear if there is not item configured to the nessage sensor and type.
    I will change this message to some thing more meaningful

    So the problem is that your items is not configured or not configured correctly.

    Try add this to you logback.xml

    <logger name="org.openhab.binding.mysensors" level="DEBUG" />
    

    After editing the items file, you should see something like.

    19:59:48.085 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Humidity_skur (Type=NumberItem, State=Uninitialized)" based on configuration "1;0;V_HUM"
    19:59:48.087 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Temperature_skur (Type=NumberItem, State=Uninitialized)" based on configuration "1;1;V_TEMP"
    19:59:48.088 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Light (Type=ColorItem, State=Uninitialized)" based on configuration "2;0;V_RGB"
    19:59:48.090 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Humidity_3 (Type=NumberItem, State=Uninitialized)" based on configuration "3;0;V_HUM"
    19:59:48.091 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Motion_3 (Type=SwitchItem, State=Uninitialized)" based on configuration "3;2;V_TRIPPED" 
    19:59:48.094 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Light_3 (Type=NumberItem, State=Uninitialized)" based on configuration "3;3;V_LIGHT_LEVEL"
    19:59:48.095 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Watt_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_WATT"
    19:59:48.097 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Kwh_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_KWH"
    19:59:48.098 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "PulseCount_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_VAR1"
    

    This is from my setup where it works.
    Or an error saying

    Unable to parse "..." need to be in the format <number>;<number>;<type>
    
    B Offline
    B Offline
    BastienVH
    wrote on last edited by
    #4

    @bkl
    Thanks for your response.
    After adding the line of code to the logback, my debug output remains the same.
    No message that new items have been added based on the configuration, nor parse-errors.

    It's just the same as before: the messages are received, but not interpreted correctly, just the raw data like below:
    2016-02-13 15:05:55.551 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=0, message-type=set, ack=false, sub-type=V_HUM, payload=48.0

    I will start over again from scratch tomorrow, reinstall openhab and your binding to see if it helped.

    1 Reply Last reply
    0
    • bklB bkl

      Hi

      I have been playing a bit with creating a binding for openHAB.
      And it is now in a state where i think it is ready for some more testing.

      Links
      GitHub (https://github.com/bloft/openhab)
      Download (http://bkl.linux.dk/org.openhab.binding.mysensors-1.8.0-SNAPSHOT.jar)

      Features

      • Serial Gateway supported Only
      • Supported all sensors (1.6)
      • Discovery of devices (sort of)
      • Support requesting values from openhab

      Experimental / Not Tested

      • Ethernet Gateway
      • Error handling of Gateway (restart of connection)
      • I_CONFIG support add mysensors:metric=true to mysensors:metric=false to openhab.cfg

      Not Working

      • Auto assign of Node ID

      Howto Use

      1. Add jar to addons dir
      2. Modify openhab.cfg add "mysensors:port=/dev/ttyUSB0"
      3. Add items

      Configure ethernet gateway
      Modify openhab.cfg set

      mysensors:type=ethernet
      mysensors:host=<host ip>
      mysensors:port=5003
      

      This is still untested so please report if it is working or not.

      Auto discovery
      Every time a Presentation is detected, example of usage is printed to the openhab.log on INFO

      Example of items:

      Number  Humidity              "Hjemmebio [%s %%Rh]"   <water>         (gBio,gHumidity)        {mysensors="3;0;V_HUM"}
      Number  Temperature           "Hjemmebio [%s °C]"     <temperature>   (gBio,gTemperature)     {mysensors="3;1;V_TEMP"}
      Switch  Motion                "Hjemmebio [%s]"        <motion>        (gBio,gMotion)          {mysensors="3;2;V_TRIPPED"}
      Number  Light                 "Hjemmebio [%s]"        <slider>        (gBio,gLightLevel)      {mysensors="3;3;V_LIGHT_LEVEL"}
      
      A Offline
      A Offline
      almj
      wrote on last edited by
      #5

      @bkl Awesome! Thank you for this binding. Helps to minimise rules in OH.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BastienVH
        wrote on last edited by
        #6

        After reinstalling OpenHAB, the binding works fine, thank you!
        Just a question, don't know if you can help.

        I mapped my serial gateway to /dev/MSgw because ttyUSBx tends to change when unplugging / replugging multiple USB devices into the computer (raspberry pi in my case).
        I've also got a 433MHz gateway attached and when debugging have to unplug it sometimes.
        When trying to start OpenHAB with /dev/MSgw as gateway address I get this:

        2016-02-14 10:58:33.418 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
        RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB1
        2016-02-14 10:58:34.048 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/MSgw'
        

        Do you know how/if I can still you my own custom paths to the gateway?
        Now I changed it to ttyUSB1, but that port might change after rebooting.

        bklB 1 Reply Last reply
        0
        • B BastienVH

          After reinstalling OpenHAB, the binding works fine, thank you!
          Just a question, don't know if you can help.

          I mapped my serial gateway to /dev/MSgw because ttyUSBx tends to change when unplugging / replugging multiple USB devices into the computer (raspberry pi in my case).
          I've also got a 433MHz gateway attached and when debugging have to unplug it sometimes.
          When trying to start OpenHAB with /dev/MSgw as gateway address I get this:

          2016-02-14 10:58:33.418 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
          RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB1
          2016-02-14 10:58:34.048 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/MSgw'
          

          Do you know how/if I can still you my own custom paths to the gateway?
          Now I changed it to ttyUSB1, but that port might change after rebooting.

          bklB Offline
          bklB Offline
          bkl
          wrote on last edited by
          #7

          @BastienVH

          https://github.com/openhab/openhab/wiki/Serial-Binding

          Note2: If you are using non standard serial ports you have to adapt start.sh to have the serial port included. the java command line should then include the following parameters:

          -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0
          whereas ttyAMA0 is the path to your serial port. Please be aware to change all scripts you might use for startup (debug, automatic start in linux,...)

          skatunS 1 Reply Last reply
          0
          • andredtsA Offline
            andredtsA Offline
            andredts
            wrote on last edited by
            #8

            @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

            Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
            org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

            Thanks

            andredtsA 1 Reply Last reply
            0
            • andredtsA andredts

              @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

              Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
              org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

              Thanks

              andredtsA Offline
              andredtsA Offline
              andredts
              wrote on last edited by
              #9

              @andredts said:

              @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

              Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
              org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

              Thanks

              Hi, made some more test, and saw that bidding suggests that I use V_STATUS, so I did. Now I can see the change in the relay status and I can even turn it OFF by the OH inteface, but I can´t turn it ON. Maybe I can´t turn it on because I use inverted logic, where High is OFF, does any off that makes sense?

              Thanks

              bklB 1 Reply Last reply
              0
              • T Offline
                T Offline
                ted
                wrote on last edited by
                #10

                Tested on openhab 1.8. works very well. Thanks!

                1 Reply Last reply
                0
                • andredtsA andredts

                  @andredts said:

                  @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

                  Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
                  org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

                  Thanks

                  Hi, made some more test, and saw that bidding suggests that I use V_STATUS, so I did. Now I can see the change in the relay status and I can even turn it OFF by the OH inteface, but I can´t turn it ON. Maybe I can´t turn it on because I use inverted logic, where High is OFF, does any off that makes sense?

                  Thanks

                  bklB Offline
                  bklB Offline
                  bkl
                  wrote on last edited by
                  #11

                  @andredts
                  Can you try and post the sketch you are using? Or are you using the RelayWithButtonActuator Example?

                  I don't thing that the inverted logic should have anything to do with it.

                  andredtsA 1 Reply Last reply
                  0
                  • bklB bkl

                    @andredts
                    Can you try and post the sketch you are using? Or are you using the RelayWithButtonActuator Example?

                    I don't thing that the inverted logic should have anything to do with it.

                    andredtsA Offline
                    andredtsA Offline
                    andredts
                    wrote on last edited by
                    #12

                    @bkl
                    Hi, I´m using the MultiRelayButton 0.9b sketch, that I found here in the forum:

                    0_1456141716367_Bot_es_relays.ino

                    If you like I can try RelayWithButtonActuator Example, but I like the other better because it works when the server is down, no aka from server to make the state change.

                    bklB 1 Reply Last reply
                    0
                    • andredtsA andredts

                      @bkl
                      Hi, I´m using the MultiRelayButton 0.9b sketch, that I found here in the forum:

                      0_1456141716367_Bot_es_relays.ino

                      If you like I can try RelayWithButtonActuator Example, but I like the other better because it works when the server is down, no aka from server to make the state change.

                      bklB Offline
                      bklB Offline
                      bkl
                      wrote on last edited by
                      #13

                      @andredts
                      It was a bug in the code. If you download the new jar then it should be fixed.

                      andredtsA 2 Replies Last reply
                      0
                      • bklB bkl

                        @andredts
                        It was a bug in the code. If you download the new jar then it should be fixed.

                        andredtsA Offline
                        andredtsA Offline
                        andredts
                        wrote on last edited by
                        #14

                        @bkl
                        Thanks, I will give it a try and return to you with feedback.

                        1 Reply Last reply
                        0
                        • bklB bkl

                          @andredts
                          It was a bug in the code. If you download the new jar then it should be fixed.

                          andredtsA Offline
                          andredtsA Offline
                          andredts
                          wrote on last edited by
                          #15

                          @bkl
                          Working beautifully. I have three relay and three switches on the arduino, and no matter how fast I press them I got no miss command. Thanks

                          I got one bug, but I think it is Openhab's, when I changed the item file with Openhab running and the switch in the user interface got inverted ON-OFF and OFF-ON.

                          1 Reply Last reply
                          0
                          • andredtsA Offline
                            andredtsA Offline
                            andredts
                            wrote on last edited by andredts
                            #16

                            Hi,

                            Today I was testing Motion and Door sensors. Motion worked as expected, but the door sensor only works if it's set in OH as a "switch" item(on and off feedback), if you set it as a "contact"(open/closed) item you get the log: " No item configured for "5;1;V_TRIPPED". I have used the example sketch for the sensor

                            N bklB 2 Replies Last reply
                            0
                            • andredtsA andredts

                              Hi,

                              Today I was testing Motion and Door sensors. Motion worked as expected, but the door sensor only works if it's set in OH as a "switch" item(on and off feedback), if you set it as a "contact"(open/closed) item you get the log: " No item configured for "5;1;V_TRIPPED". I have used the example sketch for the sensor

                              N Offline
                              N Offline
                              nikos1671
                              wrote on last edited by
                              #17

                              @andredts I also notice this with the door sensors. Normal the item must be contact and not switch.

                              1 Reply Last reply
                              0
                              • andredtsA andredts

                                Hi,

                                Today I was testing Motion and Door sensors. Motion worked as expected, but the door sensor only works if it's set in OH as a "switch" item(on and off feedback), if you set it as a "contact"(open/closed) item you get the log: " No item configured for "5;1;V_TRIPPED". I have used the example sketch for the sensor

                                bklB Offline
                                bklB Offline
                                bkl
                                wrote on last edited by
                                #18

                                @andredts
                                Thanks for the feedback, this is now fixed.

                                andredtsA 1 Reply Last reply
                                1
                                • bklB bkl

                                  @andredts
                                  Thanks for the feedback, this is now fixed.

                                  andredtsA Offline
                                  andredtsA Offline
                                  andredts
                                  wrote on last edited by
                                  #19

                                  @bkl
                                  Thank you for your great work. Happy to help with what I can.

                                  Already tested and fully abandoned rules for setting up OpenHab with Mysensors.

                                  Next I will try a analogic read, based on the dust sensor.

                                  andredtsA 1 Reply Last reply
                                  0
                                  • andredtsA andredts

                                    @bkl
                                    Thank you for your great work. Happy to help with what I can.

                                    Already tested and fully abandoned rules for setting up OpenHab with Mysensors.

                                    Next I will try a analogic read, based on the dust sensor.

                                    andredtsA Offline
                                    andredtsA Offline
                                    andredts
                                    wrote on last edited by
                                    #20

                                    @andredts
                                    Using this bidding for 15 days, with 3 relay, a Micro Sensebender, Humidity, Motion and Water level (base on dust sensor). And everything is working great.

                                    Thanks again.

                                    1 Reply Last reply
                                    0
                                    • Pavel HrudkaP Offline
                                      Pavel HrudkaP Offline
                                      Pavel Hrudka
                                      wrote on last edited by
                                      #21

                                      Hi.
                                      I just added your binding and I am very happy for it because I have spent quite some time to figure out, how do I integrate mySensors in to Openhab.

                                      My setup
                                      RPI2
                                      did apt-get update && apt-get upgrade
                                      OpenHab (openHAB runtime has been started (v1.8.1))
                                      I have NRF24L01+ connected directly to RPI using SPI.
                                      I am running PiGatewaySerial service and Iam able to see communication when i do

                                      sudo cat /dev/ttyMySensorsGateway
                                      

                                      for example

                                      7;255;3;0;15;0
                                      7;255;0;0;17;1.5.4
                                      7;255;3;0;6;0
                                      7;255;3;0;11;Humidity
                                      7;255;3;0;12;1.0
                                      7;0;0;0;7;
                                      7;1;0;0;6;
                                      
                                      

                                      My problem is that openHab is unable to access /dev/ttyMySensorsGateway
                                      I see error in my logs

                                      2016-03-11 23:30:11.288 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyMySensorsGateway'
                                      
                                      java.lang.NullPointerException: null
                                              at org.openhab.binding.mysensors.internal.gateway.Serial.write(Serial.java:82) ~[na:na]
                                              at org.openhab.binding.mysensors.internal.MySensorsBinding.execute(MySensorsBinding.java:178) ~[na:na]
                                              at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
                                              at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
                                      
                                      
                                      

                                      I found @BastienVH post and modified /etc/init.d/openhab JAVA_ARGS_DEFAULT section and added at the end of defintion

                                       -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway"
                                      

                                      and restarted service

                                      Sadly, there was no change.
                                      Please can you help?

                                      Thank you.

                                      andredtsA 2 Replies Last reply
                                      0
                                      • Pavel HrudkaP Pavel Hrudka

                                        Hi.
                                        I just added your binding and I am very happy for it because I have spent quite some time to figure out, how do I integrate mySensors in to Openhab.

                                        My setup
                                        RPI2
                                        did apt-get update && apt-get upgrade
                                        OpenHab (openHAB runtime has been started (v1.8.1))
                                        I have NRF24L01+ connected directly to RPI using SPI.
                                        I am running PiGatewaySerial service and Iam able to see communication when i do

                                        sudo cat /dev/ttyMySensorsGateway
                                        

                                        for example

                                        7;255;3;0;15;0
                                        7;255;0;0;17;1.5.4
                                        7;255;3;0;6;0
                                        7;255;3;0;11;Humidity
                                        7;255;3;0;12;1.0
                                        7;0;0;0;7;
                                        7;1;0;0;6;
                                        
                                        

                                        My problem is that openHab is unable to access /dev/ttyMySensorsGateway
                                        I see error in my logs

                                        2016-03-11 23:30:11.288 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyMySensorsGateway'
                                        
                                        java.lang.NullPointerException: null
                                                at org.openhab.binding.mysensors.internal.gateway.Serial.write(Serial.java:82) ~[na:na]
                                                at org.openhab.binding.mysensors.internal.MySensorsBinding.execute(MySensorsBinding.java:178) ~[na:na]
                                                at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
                                                at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
                                        
                                        
                                        

                                        I found @BastienVH post and modified /etc/init.d/openhab JAVA_ARGS_DEFAULT section and added at the end of defintion

                                         -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway"
                                        

                                        and restarted service

                                        Sadly, there was no change.
                                        Please can you help?

                                        Thank you.

                                        andredtsA Offline
                                        andredtsA Offline
                                        andredts
                                        wrote on last edited by
                                        #22

                                        @Pavel-Hrudka

                                        I use RP2 with internal serial connected directly to ATmega328 chip. So it is also a unconventional serial. And for that to work I had to put the line " -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway" on my start.sh file, before the line that has ".jar"

                                        Hope it helps

                                        1 Reply Last reply
                                        0
                                        • Pavel HrudkaP Pavel Hrudka

                                          Hi.
                                          I just added your binding and I am very happy for it because I have spent quite some time to figure out, how do I integrate mySensors in to Openhab.

                                          My setup
                                          RPI2
                                          did apt-get update && apt-get upgrade
                                          OpenHab (openHAB runtime has been started (v1.8.1))
                                          I have NRF24L01+ connected directly to RPI using SPI.
                                          I am running PiGatewaySerial service and Iam able to see communication when i do

                                          sudo cat /dev/ttyMySensorsGateway
                                          

                                          for example

                                          7;255;3;0;15;0
                                          7;255;0;0;17;1.5.4
                                          7;255;3;0;6;0
                                          7;255;3;0;11;Humidity
                                          7;255;3;0;12;1.0
                                          7;0;0;0;7;
                                          7;1;0;0;6;
                                          
                                          

                                          My problem is that openHab is unable to access /dev/ttyMySensorsGateway
                                          I see error in my logs

                                          2016-03-11 23:30:11.288 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyMySensorsGateway'
                                          
                                          java.lang.NullPointerException: null
                                                  at org.openhab.binding.mysensors.internal.gateway.Serial.write(Serial.java:82) ~[na:na]
                                                  at org.openhab.binding.mysensors.internal.MySensorsBinding.execute(MySensorsBinding.java:178) ~[na:na]
                                                  at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
                                                  at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
                                          
                                          
                                          

                                          I found @BastienVH post and modified /etc/init.d/openhab JAVA_ARGS_DEFAULT section and added at the end of defintion

                                           -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway"
                                          

                                          and restarted service

                                          Sadly, there was no change.
                                          Please can you help?

                                          Thank you.

                                          andredtsA Offline
                                          andredtsA Offline
                                          andredts
                                          wrote on last edited by
                                          #23

                                          @Pavel-Hrudka

                                          On my last post I miss lid you, copping your own line, but actually to use raspberry internal serial you have to add to Openhab's start.sh "-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0 " before the line with the ".jar" because the serial got to start before you run the biddings.

                                          Hope it helps.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular