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. Serial Gateway connection to Openhab

Serial Gateway connection to Openhab

Scheduled Pinned Locked Moved OpenHAB
development ope
86 Posts 16 Posters 81.1k Views 10 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

    For the Arduino Mega you have to change the connections. Check out this thread:

    http://forum.mysensors.org/topic/249/arduino-mega-sensor-shield-2

    When the "node point" starts up fine you should see a lot of messages coming on the serial monitor of the gateway. Then the communication between both nodes is working.

    E Offline
    E Offline
    ewgor
    wrote on last edited by
    #65

    @TimO with your help again i managed to find the right pins on my mega and now with my dht11 connected i get the temp and hum values constantly. On the server side when i start the bat file or sh file i get the values on the node serial monitor but nothing apears on the localhost.
    there are any changes that needs to be done in the items, rules or the sitemap?
    thanks for replay.

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ewgor
      wrote on last edited by ewgor
      #66

      today, trying to make it work i discovered that if i start the Openhab server i get the DHT11 values on the server and i can access the serial monitor of the node point but when i switch the arduino IDE to the serial gateway com4 i get this errors on the arduino IDE and i cannot acces the serial monitor:

      Arduino: 1.5.8 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
      
      processing.app.SerialException: Error opening serial port 'COM4'.
      
      	at processing.app.Serial.<init>(Serial.java:145)
      
      	at processing.app.Serial.<init>(Serial.java:90)
      
      	at processing.app.SerialMonitor.open(SerialMonitor.java:93)
      
      	at processing.app.Editor.handleSerial(Editor.java:2537)
      
      	at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:357)
      
      	at java.awt.Component.processMouseEvent(Unknown Source)
      
      	at javax.swing.JComponent.processMouseEvent(Unknown Source)
      
      	at java.awt.Component.processEvent(Unknown Source)
      
      	at java.awt.Container.processEvent(Unknown Source)
      
      	at java.awt.Component.dispatchEventImpl(Unknown Source)
      
      	at java.awt.Container.dispatchEventImpl(Unknown Source)
      
      	at java.awt.Component.dispatchEvent(Unknown Source)
      
      	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      
      	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      
      	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      
      	at java.awt.Container.dispatchEventImpl(Unknown Source)
      
      	at java.awt.Window.dispatchEventImpl(Unknown Source)
      
      	at java.awt.Component.dispatchEvent(Unknown Source)
      
      	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      
      	at java.awt.EventQueue.access$200(Unknown Source)
      
      	at java.awt.EventQueue$3.run(Unknown Source)
      
      	at java.awt.EventQueue$3.run(Unknown Source)
      
      	at java.security.AccessController.doPrivileged(Native Method)
      
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      
      	at java.awt.EventQueue$4.run(Unknown Source)
      
      	at java.awt.EventQueue$4.run(Unknown Source)
      
      	at java.security.AccessController.doPrivileged(Native Method)
      
      	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
      
      	at java.awt.EventQueue.dispatchEvent(Unknown Source)
      
      	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      
      	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      
      	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      
      	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      
      	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      
      	at java.awt.EventDispatchThread.run(Unknown Source)
      
      Caused by: jssc.SerialPortException: Port name - COM4; Method name - openPort(); Exception type - Port busy.
      
      	at jssc.SerialPort.openPort(SerialPort.java:164)
      
      	at processing.app.Serial.<init>(Serial.java:141)
      
      	... 35 more
      
      Error opening serial port 'COM4'.
      
        This report would have more information with
        "Show verbose output during compilation"
        enabled in File > Preferences.
      
      

      On the serial monitor of the node point i receive this:

      repeater started, id 101
      send: 101-101-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
      send: 101-101-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
      send: 101-101-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay
      send: 101-101-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
      send: 101-101-0-0 s=1,c=0,t=3,pt=0,l=0,st=fail:
      send: 101-101-0-0 s=2,c=0,t=3,pt=0,l=0,st=ok:
      send: 101-101-0-0 s=0,c=0,t=7,pt=0,l=0,st=ok:
      send: 101-101-0-0 s=1,c=0,t=6,pt=0,l=0,st=ok:
      Failed reading humidity from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      Failed reading temperature from DHT
      send: 101-101-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:31.0
      T: 31.00
      send: 101-101-0-0 s=1,c=1,t=0,pt=7,l=5,st=fail:30.0
      T: 30.00
      send: 101-101-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:31.0
      T: 31.00
      
      

      and on the Openhab start.bat i see this:

      2015-07-15 17:48:14.153 [INFO ] [runtime.busevents             ] - Arduino state
       updated to 0;0;3;0;9;read: 101-101-0 s=255,c=3,t=11,pt=0,l=5:Relay
      101;255;3;0;11;Relay
      0;0;3;0;9;read: 101-101-0 s=255,c=3,t=12,pt=0,l=3:1.0
      101;255;3;0;12;1.0
      0;0;3;0;9;read: 101-101-0 s=1,c=0,t=3,pt=0,l=0:
      101;1;0;0;3;
      0;0;3;0;9;read: 101-101-0 s=2,c=0,t=3,pt=0,l=0:
      101;2;0;0;3;
      0;0;3;0;9;read: 101-101-0 s=0,c=0,t=7,pt=0,l=0:
      101;0;0;0;7;
      0;0;3;0;9;read: 101-101-0 s=1,c=0,t=6,pt=0,l=0:
      101;1;0;0;6;
      
      ArduinoUpdate -> 0;0;3;0;9;read: 101-101-0 s=255,c=3,t=11,pt=0,l=5:Relay
      101;255;3;0;11;Relay
      0;0;3;0;9;read: 101-101-0 s=255,c=3,t=12,pt=0,l=3:1.0
      101;255;3;0;12;1.0
      0;0;3;0;9;read: 101-101-0 s=1,c=0,t=3,pt=0,l=0:
      101;1;0;0;3;
      0;0;3;0;9;read: 101-101-0 s=2,c=0,t=3,pt=0,l=0:
      101;2;0;0;3;
      0;0;3;0;9;read: 101-101-0 s=0,c=0,t=7,pt=0,l=0:
      101;0;0;0;7;
      0;0;3;0;9;read: 101-101-0 s=1,c=0,t=6,pt=0,l=0:
      101;1;0;0;6;
      2015-07-15 17:48:15.171 [INFO ] [runtime.busevents             ] - Arduino state
       updated to 0;0;3;0;9;read: 101-101-0 s=1,c=1,t=0,pt=7,l=5:31.0
      101;1;1;0;0;31.0
      
      ArduinoUpdate -> 0;0;3;0;9;read: 101-101-0 s=1,c=1,t=0,pt=7,l=5:31.0
      101;1;1;0;0;31.0
      2015-07-15 17:48:44.203 [INFO ] [runtime.busevents             ] - Arduino state
       updated to 0;0;3;0;9;read: 101-101-0 s=0,c=1,t=1,pt=7,l=5:35.0
      101;0;1;0;1;35.0
      
      ArduinoUpdate -> 0;0;3;0;9;read: 101-101-0 s=0,c=1,t=1,pt=7,l=5:35.0
      101;0;1;0;1;35.0
      
      

      help :)

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

        The access to the serial port is exclusive, stop OpenHAB to access the serial port of The gateway with the arduino IDE.

        E 1 Reply Last reply
        0
        • T TimO

          The access to the serial port is exclusive, stop OpenHAB to access the serial port of The gateway with the arduino IDE.

          E Offline
          E Offline
          ewgor
          wrote on last edited by
          #68

          @TimO i saw that I can access the gateway and see what node point transmit but as you say without having the server start.
          How do I see temp and hum on the local host? And what do I need to do to switch the two LEDs from local host?
          As always, thanks for sharing a little part of your experience :)

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

            Use something like this in the rules file:

            For a button (always sends on when activated):

            rule "Licht Flur EG"
                    when
                            Item corridorLight01 received update
                    then
                            sendCommand(Arduino, "102;1;1;0;2;1\n")
            

            For a switch use something like

            rule "Küche"
                    when
                            Item kitchenLight01 received command
                    then
                            if(receivedCommand==ON) {
                                    sendCommand(Arduino, "102;1;1;0;2;1\n")
                            }
                            if(receivedCommand==OFF) {
                                    sendCommand(Arduino, "102;1;1;0;2;0\n")
                            }
            
            end
            
            1 Reply Last reply
            0
            • E Offline
              E Offline
              ewgor
              wrote on last edited by
              #70

              So TimO you say your example above (arduinos sketches for the serial gateway and the 2nd one for temp, hum and two switches + openhab items, rules and sitemap) is not working? i just followed and nothing happen ... still strugling. Now you give me this example which has nothing to do with your example. If i want to use it i need to modify all files and i dont know how!
              Can anyone help me??

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

                Well, I thought your base is my tutorial: http://forum.mysensors.org/topic/1194/tutorial-openhab-with-serial-gateway

                The advantage of OpenHAB is, you're very free and are able to do things you like to do. The disadvantage is, you currently have to "program" your rules.

                It would help to know your OpenHAB configurations, sketches and so on, because I'm using my own OpenHAB (and MySensors) configuration/installation, that certainly is not the best configuration für everyone.
                (But it works the way I want it to work ;-))

                You only asked for (and got) pieces of the puzzle, you have to put it together by yourself or ask for the complete solution, as you did in another thread. :D

                E 1 Reply Last reply
                0
                • T TimO

                  Well, I thought your base is my tutorial: http://forum.mysensors.org/topic/1194/tutorial-openhab-with-serial-gateway

                  The advantage of OpenHAB is, you're very free and are able to do things you like to do. The disadvantage is, you currently have to "program" your rules.

                  It would help to know your OpenHAB configurations, sketches and so on, because I'm using my own OpenHAB (and MySensors) configuration/installation, that certainly is not the best configuration für everyone.
                  (But it works the way I want it to work ;-))

                  You only asked for (and got) pieces of the puzzle, you have to put it together by yourself or ask for the complete solution, as you did in another thread. :D

                  E Offline
                  E Offline
                  ewgor
                  wrote on last edited by
                  #72

                  @TimO
                  I see, so if are not a programmer and you don't know how to make your own sketches (arduino, rules) you don't have any chance to make your own project .... i thought, being open source and asking for help in a community where you can find a lot of guys who have idea about the subject, maybe you can make it easier without spending hours and hours just to come back to the same place you started , moreover without a solution.
                  Anyhow, thanks a lot, with the help you gave i am almost there but i think i still need to wait maybe a half year till i'll see my project on :(

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    ewgor
                    wrote on last edited by
                    #73

                    Hi,
                    Can anyone help? I'm trying to move my server from my laptop to my raspberry pi 2 and I'm having problems.
                    I changed the port in the items file with

                    "String Arduino "Arduino" { serial="/dev/ttyUSB0@115200" }"
                    

                    And now the server receive the commands from my laptop or from my phone but it not sends the info to the node point and it not receive info from the node point too.
                    If I start the server from my laptop with start.bat it works but when I start the server from my pi with
                    Sudo /opt/openhab/start.sh it acts as I said above!
                    Can anyone please help me understand what I'm missing?

                    Thanks!

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

                      Try to connect with a terminal software like miniterm to /dev/ttyUSB0 and check if data from the serial gateway is received.

                      miniterm.py -b 115200 -p /dev/ttyUSB0
                      

                      You may have to install miniterm first.

                      E 1 Reply Last reply
                      0
                      • T TimO

                        Try to connect with a terminal software like miniterm to /dev/ttyUSB0 and check if data from the serial gateway is received.

                        miniterm.py -b 115200 -p /dev/ttyUSB0
                        

                        You may have to install miniterm first.

                        E Offline
                        E Offline
                        ewgor
                        wrote on last edited by
                        #75

                        @TimO i solved following your tutorial here with dmesg and checking for what usb name rpi have for the gateway. Still not did those steps for a permanent usb but its on going.
                        Thanks!

                        1 Reply Last reply
                        0
                        • T TimO

                          @CARSTEN I've compiled a modified version of the OpenHab Serial binding with a baud rate of 115200 as this is standard in mysensors.

                          Download: org.openhab.binding.serial_1.6.0.201411271703.jar

                          As @tboha suggested you currently have to manage all commands by yourself.

                          I've attached my modified serial binding here. Please be aware, that all other configurations that depend on serial binding won't work with the modified version, because of the changed baud rate.

                          I'm currently testing with this Serial Gateway:

                          Serial Gateway

                          Here is my OpenHab configuration for simple testing:

                          demo.items: demo.items
                          demo.rules: demo.rules
                          demo.sitemap: demo.sitemap

                          F Offline
                          F Offline
                          Fay Candiliari
                          wrote on last edited by Fay Candiliari
                          #76

                          @TimO Hi TimO! This is Fay from codebender.cc Thank you for using codebender! I just wanted to let you know that one of the sketches you are using in this comment has been deleted and so it is not available for users to view it. Let me know if you have any question. :)

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

                            @Fay-Candiliari : Thank you very much for the hint!

                            F 1 Reply Last reply
                            0
                            • F Fay Candiliari

                              @TimO Hi TimO! This is Fay from codebender.cc Thank you for using codebender! I just wanted to let you know that one of the sketches you are using in this comment has been deleted and so it is not available for users to view it. Let me know if you have any question. :)

                              hekH Offline
                              hekH Offline
                              hek
                              Admin
                              wrote on last edited by hek
                              #78

                              @Fay-Candiliari

                              Hi @Fay-Candiliari , Nice to see you here!

                              F 1 Reply Last reply
                              0
                              • T TimO

                                @Fay-Candiliari : Thank you very much for the hint!

                                F Offline
                                F Offline
                                Fay Candiliari
                                wrote on last edited by
                                #79

                                @TimO You are welcome :)

                                1 Reply Last reply
                                0
                                • hekH hek

                                  @Fay-Candiliari

                                  Hi @Fay-Candiliari , Nice to see you here!

                                  F Offline
                                  F Offline
                                  Fay Candiliari
                                  wrote on last edited by
                                  #80

                                  Hi @hek Likewise! :)

                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    knoid
                                    wrote on last edited by
                                    #81

                                    I'm having trouble with test.rules when two switches change its values really quickly one after the other. I can do that in a couple of tries via the web UI or the android UI. This is the output that looks odd:

                                    2016-01-05 19:39:54.405 [INFO ] [runtime.busevents             ] - relay01 received command ON
                                    2016-01-05 19:39:54.469 [INFO ] [runtime.busevents             ] - relay02 received command ON
                                    Function: switchOperation >> 1;1;1;1;2;1
                                    Function: switchOperation >> 1;2;1;1;2;1
                                    2016-01-05 19:39:54.772 [INFO ] [runtime.busevents             ] - Arduino received command 1;1;1;0;2;1
                                    
                                    2016-01-05 19:39:54.797 [INFO ] [runtime.busevents             ] - Arduino received command 1;2;1;0;2;1
                                    
                                    2016-01-05 19:39:55.033 [INFO ] [runtime.busevents             ] - relay01 received command ON
                                    2016-01-05 19:39:55.338 [INFO ] [runtime.busevents             ] - relay02 state updated to ON
                                    2016-01-05 19:39:55.398 [INFO ] [runtime.busevents             ] - relay02 state updated to ON
                                    Light Item: relay02 Light: ON
                                    Light Item: relay02 Light: ON
                                    

                                    As you can see, it starts fine but at the end it is talking about the same relay twice and I end up with just one relay on. It actually looks like an openhab issue but I'm not sure.

                                    Any help is appreciated.

                                    1 Reply Last reply
                                    0
                                    • aaron832A Offline
                                      aaron832A Offline
                                      aaron832
                                      wrote on last edited by
                                      #82

                                      I am having the same issue. When I start my sensor, it sends a lot of information seemingly at once. The rule gets confused and runs the rule multiple times on one serial command (rather than each individually).

                                      Notice below the "Arduino" item is getting updates frequently. Below that is my output in the rule to handle the update. Notice it prints multiple 105;0;0;0;7; in place of the other inputs (105;255;3;0;15; for example)

                                      
                                      2016-01-26 16:15:36.414 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;255;3;0;15;
                                      2016-01-26 16:15:36.418 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;255;0;0;17;2.0.0-beta
                                      2016-01-26 16:15:36.425 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;255;3;0;6;0
                                      2016-01-26 16:15:36.429 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;255;3;0;11;Garage Sensor
                                      2016-01-26 16:15:36.433 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;255;3;0;12;1.0
                                      2016-01-26 16:15:36.438 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;0;0;0;7;
                                      2016-01-26 16:15:36.557 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;1;1;0;0;68.0
                                      2016-01-26 16:15:37.058 [INFO ] [runtime.busevents             ] - Arduino state updated to 105;0;1;0;1;36.0
                                      
                                      105;0;0;0;7;
                                      105;0;0;0;7;
                                      105;0;0;0;7;
                                      105;0;0;0;7;
                                      105;1;1;0;0;68.0
                                      105;0;1;0;1;36.0
                                      105;0;0;0;7;
                                      105;0;0;0;7;
                                      
                                      1 Reply Last reply
                                      0
                                      • aaron832A Offline
                                        aaron832A Offline
                                        aaron832
                                        wrote on last edited by aaron832
                                        #83

                                        @knoid
                                        Found out that you can use locks in the rules to prevent uncertainty with the "Arduino" variable caused from multiple instances of the rule running simultaneously.
                                        Example:

                                        import java.util.concurrent.locks.ReentrantLock
                                        
                                        var java.util.concurrent.locks.ReentrantLock lock  = new java.util.concurrent.locks.ReentrantLock()
                                        
                                            rule "Arduino sends to Openhab"
                                            when
                                                Item Arduino received update
                                            then
                                                lock.lock()
                                                try {
                                                    // do stuff (e.g. create and start a timer ...)
                                                } finally{
                                                   lock.unlock()
                                                }
                                            end
                                        
                                        1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          TimO
                                          Hero Member
                                          wrote on last edited by
                                          #84

                                          Cool! Thanks for sharing!

                                          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