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. [Tutorial] openHAB with serial gateway

[Tutorial] openHAB with serial gateway

Scheduled Pinned Locked Moved OpenHAB
78 Posts 25 Posters 76.3k Views 16 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.
  • T TimO

    @HenryWhite The node is requesting for an id and not sending any status. You'll need to define a static id in the sketch of your node:

    http://www.mysensors.org/download/sensor_api_15#the-full-api

    Look for "Starting up the library" and the "begin()" function.

    HenryWhiteH Offline
    HenryWhiteH Offline
    HenryWhite
    wrote on last edited by
    #67

    @TimO thank you so much! it works now. Any idea why i had to assign a static id? i thought the gateway should tell the node a dynamic id automatically..

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TimO
      Hero Member
      wrote on last edited by
      #68

      @HenryWhite You're welcome. The id is assigned by the controller, in your case OpenHAB. There is a post in the forum about how to add a rule for id assignment, but I don't use it myself.

      1 Reply Last reply
      1
      • L Offline
        L Offline
        lundebc
        wrote on last edited by
        #69

        I have a real noob question, and I am way better with the electronics that I am the software. I can see my motion detector show up in my gateway, and in the events.log, so I know that I am getting to the Raspberry Pi I deployed opneHAB on.

        Here's some detail:
        So I have build the MySensors.org motion detector (and a separate temp/humidity sensor), loaded up the NRF24l01+ and PIR.
        I created a gateway out of a nano with NRF24l01+.
        I followed the tutorial on how to do the serial bindings.
        I see in the terminal window runtime.busevents that the motion detector is detecting movement, and later changing back to 0, along with the other sensor I have, which is the DHT11 for temp and humidity.

        2016-01-10 18:48:12 - Arduino state updated to 0;0;3;0;9;read: 4-4-0 s=1,c=1,t=0,pt=7,l=5:21.0
        4;1;1;0;0;21.0
        2016-01-10 18:48:12 - livingTemp01 state updated to 21.0
        2016-01-10 18:49:32 - Arduino state updated to 0;0;3;0;9;read: 10-10-0 s=1,c=1,t=16,pt=0,l=1:1
        10;1;1;0;16;1
        2016-01-10 18:49:35 - Arduino state updated to 0;0;3;0;9;read: 10-10-0 s=1,c=1,t=16,pt=0,l=1:0
        10;1;1;0;16;0

        My confusion is how this software all works to get just the information from the gateway to the screen.
        I know you have to declare an item in the demo.items file, and that item needs to be in the sitemap to display. but I do not understand how you get the status from the gateway? Can someone point me to some simple examples that include the mysensor.org PIR sensor? How does the item declaration get the knowledge of the change that the gateway is receiving from the sensor? I have read through several documents and tutorials, but I am missing this bit of information.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lundebc
          wrote on last edited by
          #70

          Ah, I finally see it, it was staring me in the face in the rules section. You identify via the msgType then assign in the rule. Doh!

          1 Reply Last reply
          0
          • P poeml

            @poeml more precisely, the Nano's FTDI chip connects to the booting Raspberry, but instead of registering a single device there are 4 (!) log lines claiming registering 4 devices (very funny), and none of the devices are bound.

            May 23 23:16:21 bramble kernel: [    3.738087] usb 1-1.5: new full-speed USB device number 5 using dwc_otg
            May 23 23:16:21 bramble kernel: [    4.283520] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
            May 23 23:16:21 bramble kernel: [    4.768136] usb 1-1.5: new full-speed USB device number 7 using dwc_otg
            May 23 23:16:21 bramble kernel: [    5.268161] usb 1-1.5: new full-speed USB device number 8 using dwc_otg
            
            

            I don't find a way to trigger re-registering the device, or power-cycle the USB port, via software. I can only power-cycle the whole USB bridge, which means that the LED goes out (the Ethernet chip is switched off as well...) and LED goes on again, but with the same faulty registering as when booting.

             # cat reset-usb
            #!/bin/bash
            echo 0 > /sys/bus/usb/devices/1-1/authorized
            sleep 1
            echo 1 > /sys/bus/usb/devices/1-1/authorized
            

            Unplugging and replugging always works.

            For the record: Raspberry Pi version 2 with the 4 USB ports, just updated to Debian 8.0 (Jessie). I didn't check with Debian Wheezy if it worked then. The Nano was linked from MySensors store I believe and works great otherwise. I have two of them and both have the same problem (or the Raspi's USB stack has the problem, who knows).

            P Offline
            P Offline
            poeml
            wrote on last edited by
            #71

            @poeml following up myself, using an external, powered USB hub indeed fixed the problem. The USB adapter is now correctly usable after system bootup. (I use the official Raspberry Foundation hub, which promises to avoid issues with backpowering.)

            1 Reply Last reply
            0
            • HenryWhiteH Offline
              HenryWhiteH Offline
              HenryWhite
              wrote on last edited by HenryWhite
              #72

              It just took me 2 hours to realize that you should not use

              import java.util.*
              

              when you want to use timer operations like

              if (timer=! null) {
              ...
              }
              

              Without importing java.util.* , everything works as expected. Someone has an idea why this is the case? Can you reproduce my problem?

              1 Reply Last reply
              0
              • mark_vennM Offline
                mark_vennM Offline
                mark_venn
                wrote on last edited by
                #73

                Thanks for this great post. Just what I need to get a handle on using openHAB with MySensors!

                1 Reply Last reply
                0
                • NickBuilderN Offline
                  NickBuilderN Offline
                  NickBuilder
                  wrote on last edited by NickBuilder
                  #74

                  Can someone please assist me regarding this serial connection setup.
                  I can see in my event log that I receive updates of the Arduino state as below:

                  Arduino state updated to 99;1;1;0;0;23.7
                  99;0;1;0;1;37.2
                  
                  

                  And also in the openhab.log file I get the following types of messages:

                  [DEBUG] [b.serial.internal.SerialDevice:225  ] - Received message '99;0;1;0;1;37.6
                  ' on serial port /dev/ttyUSB99
                  

                  But the rule is for some reason not initiated I guess as the println and logInfo i I've added to the top of the rule is absent from the logs. I can see from the tutorial and your posts that you get log information like below but these I cant find in any log.

                  [INFO ] [runtime.busevents             ]
                  

                  Possibly I'm missing something in my logback.xml settings or perhaps there is some other reason to this which also might explain why my rule is not started. Perhaps its because I'm using a newer binding for the serial connection? (org.openhab.binding.serial-1.8.3.jar)

                  Any help would be much appreciated!

                  Update 1: Perhaps I'll try the mysensors binding and if I'm more successful with that approach I'll skip this serial binding altogether.

                  Update 2: Ok, I will be using the mysensors binding for the serial connection. I tried it last night and it just worked! And this serial binding approach also demands some quite extensive rule handling of the incoming messages which is not the case with mysensors binding. I think I read somewhere that the mysensors binding will also be available for Openhab 2.0 so hopefully I can continue using it also in the future.

                  My recommendation for new users of the serial gateway (who also uses openhap as a controller) is to go for the mysensors binding!

                  1 Reply Last reply
                  0
                  • NickBuilderN Offline
                    NickBuilderN Offline
                    NickBuilder
                    wrote on last edited by
                    #75
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • HenryWhiteH Offline
                      HenryWhiteH Offline
                      HenryWhite
                      wrote on last edited by
                      #76

                      @TimO is it possible to send commands to actuators with this method? I have a LED Dimmer Actuator and don't know what I have to do in OpenHAB to send commands to this actuator over the serial gateway..

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        TimO
                        Hero Member
                        wrote on last edited by
                        #77

                        @HenryWhite: Yes it is possible.
                        Look at this example: https://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/70

                        HenryWhiteH 1 Reply Last reply
                        1
                        • T TimO

                          @HenryWhite: Yes it is possible.
                          Look at this example: https://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/70

                          HenryWhiteH Offline
                          HenryWhiteH Offline
                          HenryWhite
                          wrote on last edited by
                          #78

                          @TimO

                          Great! Thank you!

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


                          18

                          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