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.
  • 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
          • edsteveE Offline
            edsteveE Offline
            edsteve
            wrote on last edited by edsteve
            #85

            I know... it's an old thread. And i know openHAB2 is there. But it's still Alpha and i am beginner. Maybe not a good idea ;)

            Somehow my sensors will not bind. I downloaded and installed all fresh.
            When i start openHAB with sudo it loads normal but nodes never connected to openHAB :(

            EDIT:
            I just made a new install combined the infos from these instructions and that worked for me:
            https://github.com/openhab/openhab/wiki/Linux-and-OS-X#apt-get
            http://www.makeuseof.com/tag/getting-started-openhab-home-automation-raspberry-pi/

            Thx for your answer Tim0 and sorry for posting in wrong thread

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

              Hey @edsteve !

              This thread mainly covers the serial connection via the serial binding and by using rules.

              You are using the binding for OH1, so I suggest to start a new thread or trigger @bkl. :-)

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


              14

              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