Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. aaron832
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by aaron832

    • Sensor continue without connection

      Is there a way to allow the normal loop routine to run with or without the sensor connected to a gateway?

      I have an idea for a "sensor" that really just makes a request from the gateway periodically to see if it should activate or not. I would also want this device to activate with the push of a button even if it is currently not connected via radio.

      posted in General Discussion
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      Try typing

      "uname -m"
      

      into your console (that hosts the gateway). If it does not say
      "armv6l" or "armv7l" (edit: correction)
      then the Makefile will not include -lrf24-bcm in the LDFLAGS (libraries include). If this is the problem then what hardware are you making the gateway on?

      posted in General Discussion
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      @Artur-Maj You also have the option of going towards a prototype 2.0 branch that is being worked on. Doing this, you will be able to get support and updates in the future.

      My branch is here: https://github.com/aaron832/Arduino/tree/feature/MQTTSupport
      Perform "make mqtt" under Arduino/libraries/MySensors
      You can change any mqtt settings by uncommenting lines in Arduino/libraries/MySensors/examples_RPi/PiGateway.cpp
      The format MQTT messages are as follows:
      From MySensors to Openhab: mygateway1-out/node/sensor/command/ack/dataType
      From OpenHab to MySensors: mygateway1-in/node/sensor/command/ack/dataType

      There is still more work to be done, but it works at least as well as the previous version.

      posted in General Discussion
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      Thanks a bunch @marceloaqno for you update to 2.0. Some initial testing shows its working fine. I went ahead and just re-implemented my MQTT addition on top of this branch. Its significantly cleaner and just sits alongside your ethernet implementation. This way you can still connect with a controller via ethernet while getting the benefit of MQTT as well if desired.

      For the initial changes I created a pull request:
      https://github.com/marceloaqno/Arduino/pull/2
      for my branch
      https://github.com/aaron832/Arduino/tree/feature/MQTTSupport

      posted in Development
      aaron832
      aaron832
    • RE: Serial Gateway connection to Openhab

      @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
      
      posted in OpenHAB
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      @marceloaqno This is good news because I was about to give up trying to do the port. 😅 Hopefully some of my stuff was of some use.

      posted in Development
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      @hoegaarden_bier I have the same setup (raspberry pi running openhab with a radio). Two of the different methods for getting Raspberry Pi Gateway sensor serial data to Openhab have failed me. One being the perl script mentioned here. Still haven't figured out why it won't work (fully) under a raspberry pi environment. The other option is having openhab read from serial rather than MQTT as mentioned here: http://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/32 However, I have noticed that openhab will run the "Item Arduino received update" rule in parrallel when receiving serial messages in short succession. This causes the parrallel rule to overwrite the currently running rules' variable and it becomes a problem. Its also pretty messy and would require you to update your openhab rules on any mysensor updates.

      Not to mention, the Serial Gateway you are likely running on your raspberry pi is for opensensor 1.4 (i think) and it going to be completely left in the dust as soon as 2.0 comes around I think.

      If you dare, you can follow my project here: https://github.com/aaron832/Arduino/tree/raspberry-gateway-MQTT (Edit: See Newer Version Below)
      Basically I took an updated Raspberry PI serial gateway and updated it to include MQTT.
      Just run 'make' under libraries/MySensors and run libraries/MySensors/examples_RPi/PiGatewayMQTT

      I am currently looking at getting this stuff onto the develop branch so that it will be around with 2.0

      posted in General Discussion
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      FYI I had to ditch mongoose. It just wan't working properly. libmosquitto from http://mosquitto.org/ seems to work a lot better. Any idea about getting @marceloaqno 's branch merged into develop or vise versa? Would be nice to be working on 2.0

      posted in Development
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      Just as an update, I have the MQTT version with mongoose mostly working. Thanks for that recommendation @marceloaqno. Still very much a work in progress. If anyone is interested in following, here is the link: https://github.com/aaron832/Arduino/tree/raspberry-gateway-MQTT/libraries/MySensors/examples_RPi

      posted in Development
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      @marceloaqno Ha, Cool. Happy to hear you are looking at MQTT. I will keep a watch on your repository and will try experimenting with using mongoose as well.

      posted in Development
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      I figure it has something to do with this line from http://cpansearch.perl.org/src/COOK/Device-SerialPort-1.04/SerialPort.pm

      # a handle object for ioctls: read-only ok
      $self->{HANDLE} = new_from_fd IO::Handle ($self->{FD}, "r");
      
      posted in General Discussion
      aaron832
      aaron832
    • RE: MySensors Raspberry port suggestions

      @marceloaqno I have been looking into your work to get the RaspberryPi up to date with the latest MySensors code. You have examples for Regular Gateway, Serial and Ethernet. Are you considering creating another for MQTT? I might start looking into this, just wanted to see if you had anything planned. I think it would be best to have a Raspberry PI acting as a gateway as well as an OpenHab/MQTT server.

      posted in Development
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      @Yveaux I see. Well I added the request() call to my sensor and the perl script is picking it up. However, it is not able to write to the serial device I guess?

      20160201-12:14:57 RX: [105;4;2;0;2; ] fr=105 ci=004 c=C_REQ st=V_LIGHT noack -> Subscribe to '/mySensors/105/4/V_LIGHT'
      20160201-12:14:57 [Subscribe '/mySensors/105/4/V_LIGHT']
      20160201-12:14:57 TX: [105;4;1;0;2;0 ] fr=105 ci=004 c=C_SET st=V_LIGHT noack '0' -> Publish to gateway '/mySensors/105/4/V_LIGHT':'0'
      EV: error in callback (ignoring): Filehandle GEN0 opened only for input at /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2/AnyEvent/Handle.pm line 966.
      20160201-12:14:58 [105;255;3;0;15;]

      pi@raspi-hab:~ $ ls -la /dev/ttyMySensorsGateway
      lrwxrwxrwx 1 root root 10 Feb 1 12:14 /dev/ttyMySensorsGateway -> /dev/pts/2
      pi@raspi-hab:~ $ ls -la /dev/pts/2
      crw-rw---- 1 root tty 136, 2 Feb 1 12:14 /dev/pts/2
      pi@raspi-hab:~ $ ps -ealf | grep mq
      4 S root 17624 7825 0 80 0 - 1650 poll_s 12:14 pts/0 00:00:00 sudo ./mqttGateway2.pl --serial /dev/ttyMySensorsGateway
      4 S root 17631 17624 0 80 0 - 3815 SyS_ep 12:14 pts/0 00:00:01 /usr/bin/perl -w? ./mqttGateway2.pl --serial /dev/ttyMySensorsGateway
      0 S pi 17941 13671 0 80 0 - 1065 pipe_w 12:20 pts/4 00:00:00 grep --color=auto mq

      posted in General Discussion
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      Done. I am a little confused about getting subscriptions working with your script. If a node should be receiving a message from the gateway... should it perform a one time request() or should the subscription be manually added to the /var/run/mqttMySensors/.... subscription file? I guess the confusion being a node that although it might receive a message from a gateway... it may not necessarily ask for it specifically.

      posted in General Discussion
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      Thanks it works great! On my forked version I just updated the script to contain the latest protocol definitions.

      posted in General Discussion
      aaron832
      aaron832
    • RE: Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      Awesome. Thanks Yveaux. Ill test it out today. I think your script is the best solution for a Raspberry PI acting as an OpenSensor gateway and OpenHab server at the moment, which is why I am really glad you made it. A straight serial interface to OpenHab just doesn't work.

      posted in General Discussion
      aaron832
      aaron832
    • Using mqttGateway2.pl for Serial to MQTT on RaspberryPI

      Re: Raspberry PI + MQTT (Mosquitto) + Serial Gateway

      Was wondering if anyone else had luck with the mqttGateway2.pl script Yveaux created. I believe I have everything setup correctly. It appears to be initializing correctly. The code is getting all the way down into registration of the on_error and on_read. I know I am definitely getting activity over the serial because I can see it just tailing it. Anyone have any suggestions? Maybe a common pitfall?

      ```# -- Switch to choose between Ethernet gateway or serial gateway
      my $useSerial = 1;
      
      # -- Settings when using Serial gateway
      my $serialPort   = "/dev/ttyMySensorsGateway";
      my $serialBaud   = 115200;
      my $serialBits   = 8;
      my $serialParity = "none";
      my $serialStop   = 1;
      
      pi@raspi-hab:~ $ sudo tail -f /dev/ttyMySensorsGateway
      
      
      
      105;255;3;0;15;
      105;255;0;0;17;2.0.0-beta
      105;255;3;0;6;0
      105;255;3;0;11;Garage Sensor
      105;255;3;0;12;1.0
      105;0;0;0;7;
      105;1;0;0;6;
      105;0;1;0;1;36.0
      
      posted in General Discussion
      aaron832
      aaron832
    • RE: Serial Gateway connection to Openhab

      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;
      
      posted in OpenHAB
      aaron832
      aaron832