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.
  • skatunS Offline
    skatunS Offline
    skatun
    wrote on last edited by
    #53

    I am amazed by your work @bkl !
    I have a few question for you:
    Can I use your binding somehow to integrate RGB light in openhab with the color wheel? I have some programmable rgb ledstrip that I was thinking about integrating into openhab, but I am unsure how to do this. I was thinking about using the color widget in the sitemap together with a DMX syntax:

    if my led strip has 56 diodes

    Color rgb_strip_living_room "RGB Ledstrip Living Room" {dmx="CHANNEL[0-56]"}.
    

    But then i could also use the same ledstrip in 2 by setting two different color like

    Color rgb_strip_living_room2 "RGB Ledstrip Living Room" {dmx="CHANNEL0-23]"}
    Color rgb_strip_living_room3 "RGB Ledstrip Living Room" {dmx="CHANNEL24-56]"}
    

    Then I would also like to send IR commands from OH to mysensor, have any of you done that?

    Keep up the great work, and let me know if I somehow can help with expanding/documenting the binding.

    bklB 1 Reply Last reply
    0
    • skatunS skatun

      I am amazed by your work @bkl !
      I have a few question for you:
      Can I use your binding somehow to integrate RGB light in openhab with the color wheel? I have some programmable rgb ledstrip that I was thinking about integrating into openhab, but I am unsure how to do this. I was thinking about using the color widget in the sitemap together with a DMX syntax:

      if my led strip has 56 diodes

      Color rgb_strip_living_room "RGB Ledstrip Living Room" {dmx="CHANNEL[0-56]"}.
      

      But then i could also use the same ledstrip in 2 by setting two different color like

      Color rgb_strip_living_room2 "RGB Ledstrip Living Room" {dmx="CHANNEL0-23]"}
      Color rgb_strip_living_room3 "RGB Ledstrip Living Room" {dmx="CHANNEL24-56]"}
      

      Then I would also like to send IR commands from OH to mysensor, have any of you done that?

      Keep up the great work, and let me know if I somehow can help with expanding/documenting the binding.

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

      Hi @skatun

      I have some RGB lights, using mysensors and openhab

      Item configuration

      Color	Light_6_0		"Light Left"						(gBio,gLights)		{mysensors="6;0;V_RGB"}
      

      Sketch

      #include <MySensor.h>
      #include <ChainableLED.h>
      #include <SPI.h>
      
      #define NODE_ID 6
      
      #define NUM_LEDS 1
      
      int counter[NUM_LEDS];
      
      int current[NUM_LEDS][3];
      int step[NUM_LEDS][3];
      
      unsigned long SLEEP_TIME = 10;
      
      MySensor gw;
      //ChainableLED leds(7, 8, 1);
      ChainableLED leds(5, 6, NUM_LEDS);  // CLK, DATA, LEDS
      
      void setup() {   
        leds.init();
        for(byte childId = 0; childId < NUM_LEDS; childId++) {
          counter[childId] = 0;
          current[childId][0] = 0;
          current[childId][1] = 0;
          current[childId][2] = 0;
          step[childId][0] = 0;
          step[childId][1] = 0;
          step[childId][2] = 0;
          leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]); // Turn of on startup
        }
        
        // Initialize library and add callback for incoming messages
        gw.begin(incomingMessage, NODE_ID, true);
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("RGB Led", "1.2");
        for(byte childId = 0; childId < NUM_LEDS; childId++) {
         gw.present(childId, S_RGB_LIGHT);
        }
      }
      
      
      void loop()  {
        // Alway process incoming messages whenever possible
        gw.process();
      
        for(byte childId = 0; childId < NUM_LEDS; childId++) {
          if(counter[childId] >= 0) {
            counter[childId]--;
            int i = 1020 - counter[childId];
            current[childId][0] = calculateVal(step[childId][0], current[childId][0], i);
            current[childId][1] = calculateVal(step[childId][1], current[childId][1], i);
            current[childId][2] = calculateVal(step[childId][2], current[childId][2], i);
            
            leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]);
          }
        }
        
        gw.wait(SLEEP_TIME);
      }
      
      void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_RGB) {
          String hexstring = message.getString();
          long number = (long) strtol( &hexstring[0], NULL, 16);
          int colorR = number >> 16;
          int colorG = number >> 8 & 0xFF;
          int colorB = number & 0xFF;
          
           // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", Red: ");
           Serial.print(colorR);
           Serial.print(", Green: ");
           Serial.print(colorG);
           Serial.print(", Blue: ");
           Serial.print(colorB);
           Serial.print(", New status: ");
           Serial.println(message.getString());
      
            setColor(message.sensor, colorR, colorG, colorB);
           //leds.setColorRGB(message.sensor, colorR, colorG, colorB);
         } 
      }
      
      void setColor(byte led, int R, int G, int B) {
        step[led][0] = calculateStep(current[led][0], R);
        step[led][1] = calculateStep(current[led][1], G);
        step[led][2] = calculateStep(current[led][2], B);
      
        counter[led] = 255;
      }
      
      int calculateStep(int prevValue, int endValue) {
        int step = endValue - prevValue; // What's the overall gap?
        if (step) {                      // If its non-zero, 
          step = 255/step;              //   divide by 1020
        } 
        return step;
      }
      
      int calculateVal(int step, int val, int i) {
      
        if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
          if (step > 0) {              //   increment the value if step is positive...
            val += 1;           
          } 
          else if (step < 0) {         //   ...or decrement it if step is negative
            val -= 1;
          } 
        }
        // Defensive driving: make sure val stays in the range 0-255
        if (val > 255) {
          val = 255;
        } 
        else if (val < 0) {
          val = 0;
        }
        return val;
      }
      

      The sketch may be a bit over complicated, but the important part is the incomingMessage, all the rest is because I like to fade between the colors.

      Hope it help you.

      skatunS 1 Reply Last reply
      0
      • bklB bkl

        Hi @skatun

        I have some RGB lights, using mysensors and openhab

        Item configuration

        Color	Light_6_0		"Light Left"						(gBio,gLights)		{mysensors="6;0;V_RGB"}
        

        Sketch

        #include <MySensor.h>
        #include <ChainableLED.h>
        #include <SPI.h>
        
        #define NODE_ID 6
        
        #define NUM_LEDS 1
        
        int counter[NUM_LEDS];
        
        int current[NUM_LEDS][3];
        int step[NUM_LEDS][3];
        
        unsigned long SLEEP_TIME = 10;
        
        MySensor gw;
        //ChainableLED leds(7, 8, 1);
        ChainableLED leds(5, 6, NUM_LEDS);  // CLK, DATA, LEDS
        
        void setup() {   
          leds.init();
          for(byte childId = 0; childId < NUM_LEDS; childId++) {
            counter[childId] = 0;
            current[childId][0] = 0;
            current[childId][1] = 0;
            current[childId][2] = 0;
            step[childId][0] = 0;
            step[childId][1] = 0;
            step[childId][2] = 0;
            leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]); // Turn of on startup
          }
          
          // Initialize library and add callback for incoming messages
          gw.begin(incomingMessage, NODE_ID, true);
          // Send the sketch version information to the gateway and Controller
          gw.sendSketchInfo("RGB Led", "1.2");
          for(byte childId = 0; childId < NUM_LEDS; childId++) {
           gw.present(childId, S_RGB_LIGHT);
          }
        }
        
        
        void loop()  {
          // Alway process incoming messages whenever possible
          gw.process();
        
          for(byte childId = 0; childId < NUM_LEDS; childId++) {
            if(counter[childId] >= 0) {
              counter[childId]--;
              int i = 1020 - counter[childId];
              current[childId][0] = calculateVal(step[childId][0], current[childId][0], i);
              current[childId][1] = calculateVal(step[childId][1], current[childId][1], i);
              current[childId][2] = calculateVal(step[childId][2], current[childId][2], i);
              
              leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]);
            }
          }
          
          gw.wait(SLEEP_TIME);
        }
        
        void incomingMessage(const MyMessage &message) {
          // We only expect one type of message from controller. But we better check anyway.
          if (message.type==V_RGB) {
            String hexstring = message.getString();
            long number = (long) strtol( &hexstring[0], NULL, 16);
            int colorR = number >> 16;
            int colorG = number >> 8 & 0xFF;
            int colorB = number & 0xFF;
            
             // Write some debug info
             Serial.print("Incoming change for sensor:");
             Serial.print(message.sensor);
             Serial.print(", Red: ");
             Serial.print(colorR);
             Serial.print(", Green: ");
             Serial.print(colorG);
             Serial.print(", Blue: ");
             Serial.print(colorB);
             Serial.print(", New status: ");
             Serial.println(message.getString());
        
              setColor(message.sensor, colorR, colorG, colorB);
             //leds.setColorRGB(message.sensor, colorR, colorG, colorB);
           } 
        }
        
        void setColor(byte led, int R, int G, int B) {
          step[led][0] = calculateStep(current[led][0], R);
          step[led][1] = calculateStep(current[led][1], G);
          step[led][2] = calculateStep(current[led][2], B);
        
          counter[led] = 255;
        }
        
        int calculateStep(int prevValue, int endValue) {
          int step = endValue - prevValue; // What's the overall gap?
          if (step) {                      // If its non-zero, 
            step = 255/step;              //   divide by 1020
          } 
          return step;
        }
        
        int calculateVal(int step, int val, int i) {
        
          if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
            if (step > 0) {              //   increment the value if step is positive...
              val += 1;           
            } 
            else if (step < 0) {         //   ...or decrement it if step is negative
              val -= 1;
            } 
          }
          // Defensive driving: make sure val stays in the range 0-255
          if (val > 255) {
            val = 255;
          } 
          else if (val < 0) {
            val = 0;
          }
          return val;
        }
        

        The sketch may be a bit over complicated, but the important part is the incomingMessage, all the rest is because I like to fade between the colors.

        Hope it help you.

        skatunS Offline
        skatunS Offline
        skatun
        wrote on last edited by
        #55

        @bkl Thanks for your code, just to be sure, you only have 1 LED in your LED strip? NUM_LEDS = 1 or does that define child ID? In mine I have 38, 52,43,78,23,67 leds in my ledstrips. How can I modify your code to be used as locally attached sensor on the gateway? Also I have 6 ledstrip connected to my gateway.

        Copyright 2015 Sensnology | Forum Guidelines | Privacy Policy | Terms of Service

        bklB 1 Reply Last reply
        0
        • skatunS skatun

          @bkl Thanks for your code, just to be sure, you only have 1 LED in your LED strip? NUM_LEDS = 1 or does that define child ID? In mine I have 38, 52,43,78,23,67 leds in my ledstrips. How can I modify your code to be used as locally attached sensor on the gateway? Also I have 6 ledstrip connected to my gateway.

          Copyright 2015 Sensnology | Forum Guidelines | Privacy Policy | Terms of Service

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

          @skatun

          My code was just to show how the integration between openhab and mysensors is working.
          And correct my led strip is controlled by a single P9813 chip,

          You could try and change NUM_LEDS but this will also increase the number of Sensors in openhab/mysensors
          Or you could group them togetter in the sketch.

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

            Is it possible to change de default baud rate for the 1.8.0 binding? As I'm using a 8 MHz mini for my serial gateway I would like to set the baudrate to 38.4 kbps.

            I read that this would be possible for the Openhab 2.0 binding but I'm reluctant to move to Openhab 2.0 as its only a beta at the moment.

            Is it possible otherwise to compile a new jar with this lower baud rate? I guess two versions would be enough, 38.4 and 115.2.

            Thanks!

            bklB 1 Reply Last reply
            0
            • jerseyguy1996J Offline
              jerseyguy1996J Offline
              jerseyguy1996
              wrote on last edited by jerseyguy1996
              #58

              I've been trying to get a mysensors node which is using an nRF24L01+ to transmit to a directly connected nRF24L01+ on a Raspberry Pi 3 running PiGatewaySerial. When I start the gateway I get

              Starting PiGatewaySerial...
              Protocol version - 1.4
              Created PTY '/dev/pts/0'
              Gateway tty: /dev/ttyMySensorsGateway
              

              Following some other instruction I created a link to /dev/ttyUSB20 so that openhab could recognize it. I have Openhab with your serial binding in the addons folder. I am having difficulty with the binding. I feel like I have made a tiny bit of headway but it doesn't seem to be able to bind with it. In the openhab debug log I get:

              2016-07-16 14:39:15.537 [ERROR] [.service.AbstractActiveService] - Error while executing background thread MySensors Refresh Service
              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]
              

              What other information would you need to know to help me trouble shoot this?

              EDIT: This has been solved. See here:
              https://forum.mysensors.org/topic/4315/attempt-to-bind-ttymygatewayserial-to-openhab-failing-miserably

              1 Reply Last reply
              0
              • NickBuilderN NickBuilder

                Is it possible to change de default baud rate for the 1.8.0 binding? As I'm using a 8 MHz mini for my serial gateway I would like to set the baudrate to 38.4 kbps.

                I read that this would be possible for the Openhab 2.0 binding but I'm reluctant to move to Openhab 2.0 as its only a beta at the moment.

                Is it possible otherwise to compile a new jar with this lower baud rate? I guess two versions would be enough, 38.4 and 115.2.

                Thanks!

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

                @NickBuilder

                Hi

                No need for a new version, baudrate is configurable

                just set.
                mysensors:baudrate=38400

                NickBuilderN 2 Replies Last reply
                1
                • bklB bkl

                  @NickBuilder

                  Hi

                  No need for a new version, baudrate is configurable

                  just set.
                  mysensors:baudrate=38400

                  NickBuilderN Offline
                  NickBuilderN Offline
                  NickBuilder
                  wrote on last edited by
                  #60

                  @bkl

                  Thank you @bkl! That is the best answer I could have wished for. :)

                  I've actually tried some similar prefixes to the port definition, such as "...:38400" and "...@38400" etc. I haven't found any documentation describing the available binding settings more than the port definition that you mention here at the top. I guess the documentation will be more complete for the Openhab 2.0 binding description.

                  Thank you for your great work here!

                  1 Reply Last reply
                  1
                  • Peter ŠuľajP Offline
                    Peter ŠuľajP Offline
                    Peter Šuľaj
                    wrote on last edited by
                    #61

                    Hello I have a trouble with binding.
                    My gateway 1.5.4 still only show
                    [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
                    2016-07-20 15:30:58.044 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                    2016-07-20 15:31:00.060 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                    2016-07-20 15:31:02.067 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                    2016-07-20 15:31:04.074 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                    but nothing else .
                    I tested lot of sensor but still same error.
                    Have you any idea ?
                    Thanks

                    jerseyguy1996J 1 Reply Last reply
                    0
                    • Peter ŠuľajP Peter Šuľaj

                      Hello I have a trouble with binding.
                      My gateway 1.5.4 still only show
                      [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
                      2016-07-20 15:30:58.044 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                      2016-07-20 15:31:00.060 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                      2016-07-20 15:31:02.067 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                      2016-07-20 15:31:04.074 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                      but nothing else .
                      I tested lot of sensor but still same error.
                      Have you any idea ?
                      Thanks

                      jerseyguy1996J Offline
                      jerseyguy1996J Offline
                      jerseyguy1996
                      wrote on last edited by
                      #62

                      @Peter-Šuľaj I'm fairly new to this stuff, but curious if you are trying to auto-assign node ID? I don't believe the MySensorsBinding supports auto-assign so you have to define it as static and use:

                      #define NODEID  3 //or whatever
                      
                      //and then call this in your setup instead of Sensor.begin();
                      Sensor.begin(NULL, NODEID);
                      

                      in your script. Again, not sure if this is your problem but I figured I would chime in.

                      1 Reply Last reply
                      0
                      • bklB bkl

                        @NickBuilder

                        Hi

                        No need for a new version, baudrate is configurable

                        just set.
                        mysensors:baudrate=38400

                        NickBuilderN Offline
                        NickBuilderN Offline
                        NickBuilder
                        wrote on last edited by
                        #63

                        @bkl
                        Hello again!

                        Is there also support for sending the ack bit from the gw in some way? I saw that this is actually possible in the 2.0 binding. If it's possible how is a "not ack" handled? This would be very useful for e.g. a relay sensor.

                        I also noticed that you're not the author of the 2.0 binding, I'm sorry for making that assumption.

                        Thanks!

                        1 Reply Last reply
                        0
                        • jerseyguy1996J Offline
                          jerseyguy1996J Offline
                          jerseyguy1996
                          wrote on last edited by
                          #64

                          This binding works perfectly! Thanks for putting it together!

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

                            Thanks for the Binding! It would be very nice if you could implement SmartSleep, so that the node sends a heartbeat message to the Controller when waking up.

                            1 Reply Last reply
                            0
                            • Alex SchickA Offline
                              Alex SchickA Offline
                              Alex Schick
                              wrote on last edited by
                              #66

                              Hi,
                              I had a working serial Gateway and one temp sensor setup.
                              I now updated to 2.0 version for both but I can't see the gateway working with openhap while the sensor can send it's data fine it looks.
                              Any idea what could be the problem?

                              Sensor Serial log:

                              Starting sensor (RNNNA-, 2.0.0)
                              TSM:INIT
                              TSM:RADIO:OK
                              TSP:ASSIGNID:OK (ID=1)
                              TSM:FPAR
                              TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                              TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
                              TSP:MSG:FPAR RES (ID=0, dist=0)
                              TSP:MSG:PAR OK (ID=0, dist=1)
                              TSM:FPAR:OK
                              TSM:ID
                              TSM:CHKID:OK (ID=1)
                              TSM:UPL
                              TSP:PING:SEND (dest=0)
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
                              TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
                              TSP:MSG:PONG RECV (hops=1)
                              TSP:CHKUPL:OK
                              TSM:UPL:OK
                              TSM:READY
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
                              !TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=ok:Temperature Sensor
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1
                              TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
                              Request registration...
                              TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
                              TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
                              Node registration=1
                              Init complete, id=1, parent=0, distance=1, registration=1
                              TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:24.7
                              

                              Openhab:

                              2016-08-22 10:23:43.295 [DEBUG] [ySensorsGenericBindingProvider] - New Item "tempWhz1 (Type=NumberItem, State=Uninitialized)" based on configuration "1;0;V_TEMP"
                              2016-08-22 10:23:43.331 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
                              2016-08-22 10:23:43.342 [DEBUG] [.o.b.m.internal.gateway.Serial] - Serial port '/dev/ttyAMA0' has been found.
                              2016-08-22 10:23:43.353 [INFO ] [.service.AbstractActiveService] - MySensors Refresh Service has been started
                              

                              And nothing else more on the openhab.log even I restart the sensor node.

                              Alex SchickA 1 Reply Last reply
                              0
                              • Alex SchickA Alex Schick

                                Hi,
                                I had a working serial Gateway and one temp sensor setup.
                                I now updated to 2.0 version for both but I can't see the gateway working with openhap while the sensor can send it's data fine it looks.
                                Any idea what could be the problem?

                                Sensor Serial log:

                                Starting sensor (RNNNA-, 2.0.0)
                                TSM:INIT
                                TSM:RADIO:OK
                                TSP:ASSIGNID:OK (ID=1)
                                TSM:FPAR
                                TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
                                TSP:MSG:FPAR RES (ID=0, dist=0)
                                TSP:MSG:PAR OK (ID=0, dist=1)
                                TSM:FPAR:OK
                                TSM:ID
                                TSM:CHKID:OK (ID=1)
                                TSM:UPL
                                TSP:PING:SEND (dest=0)
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
                                TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
                                TSP:MSG:PONG RECV (hops=1)
                                TSP:CHKUPL:OK
                                TSM:UPL:OK
                                TSM:READY
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
                                !TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=ok:Temperature Sensor
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1
                                TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
                                Request registration...
                                TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
                                TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
                                Node registration=1
                                Init complete, id=1, parent=0, distance=1, registration=1
                                TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:24.7
                                

                                Openhab:

                                2016-08-22 10:23:43.295 [DEBUG] [ySensorsGenericBindingProvider] - New Item "tempWhz1 (Type=NumberItem, State=Uninitialized)" based on configuration "1;0;V_TEMP"
                                2016-08-22 10:23:43.331 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
                                2016-08-22 10:23:43.342 [DEBUG] [.o.b.m.internal.gateway.Serial] - Serial port '/dev/ttyAMA0' has been found.
                                2016-08-22 10:23:43.353 [INFO ] [.service.AbstractActiveService] - MySensors Refresh Service has been started
                                

                                And nothing else more on the openhab.log even I restart the sensor node.

                                Alex SchickA Offline
                                Alex SchickA Offline
                                Alex Schick
                                wrote on last edited by Alex Schick
                                #67

                                @Alex-Schick
                                I recognized that baudrate switched for gateway to 74880 instead of 115200 as before.
                                That is related to https://forum.mysensors.org/topic/1483/trouble-with-115200-baud-on-3-3v-8mhz-arduino-like-serial-gateway-solution-change-baudrate/9

                                Changed by adding setting in open hab mysensors:baudrate=74880
                                But opening serial on the raspberry I only see rubish (fine when connected to PC). So connection seems to be not ok....

                                EDIT: Got it sorted. Flashed for 16mhz and it worked fine with baud rate 38400.

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  momanz11
                                  wrote on last edited by momanz11
                                  #68

                                  Greetings All,

                                  I would very much like to download this binding, but the download link appears to be broken. Any possibility we could fix the link or repost the binding jar file.

                                  Looks like the server is back up!

                                  Thanks!

                                  Momanz

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    sensorchecker
                                    wrote on last edited by sensorchecker
                                    #69

                                    Hello all,

                                    i use a ATMEGA328P with internal clock (MysBootloader) and have a 4-channel relay board connected at the Arduino outputs D3-D6 (current MySensors Example Sketch).

                                    As central unit i use a RaspberryPi with openhab 1.8 and a serial gateway (Arduino Nano) and the MySensors- OpenHAB serial binding of @bkl

                                    The OpenHab item looks like this:

                                    Switch Lights_Downlights_Front "Downlights Front" <selfLight> (Outdoor, Lights_Outdoor) {mysensors="54;1;V_STATUS"}

                                    Unfortunately I can not switch the relays ON or OFF.
                                    Many other sensors (Temp, Hum, Rain) works fine with this environment.

                                    Any help is appreciated!

                                    Greets & Thanks

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

                                      Hi @bkl and all other user of this great binding!

                                      I would like to know if its possible to send a message using this binding. I will try to explain my problem.

                                      I've built the "EnergyMeterPulseSensor.ino" sensor and I have it up and running. The sketch request a starting number for the count loop and if the item in Openhab has been initialized this value is sent back per request.
                                      This request function is only active before the actual count begins.

                                      I would now like to be able to reset the counter each midnight but as the sensor only requests the start count value at each startup I would have to manually restart the sensor at the same time as I have "reinitialized" the count item with a "0".

                                      I now see two ways of doing this if this binding allows it:

                                      • 1: Send a "I_REBOOT" in some way through the binding directly after manually updating the count item with a "0".

                                      • 2: Sending a new count value via the V_VAR1 parameter. This would be preferable I guess.

                                      In this thread @stoffej is after the same thing. I've tried the same approach using a myPulsecountItem.sendCommand(0) but other than adding a "0" to the persistence service nothing happens. The count continues where it left off. So my guess is that there is no actual message sent to the sensor. Sadly I don't get any useful information from the debug-xml. I don't know where @stoffej got the debug message I_LOG_MESSAGE:..., my serial debugging interface towards the gateway is occupied.

                                      My count item is defined as:

                                      Number  myElecVar "Elmätare pulser [%d]" {mysensors="50;1;V_VAR1"}
                                      

                                      I guess if I could utilize a switch item in some way I could send a message in the same way as in the relay implementation. For a switch I know that a message is being sent as I've built one of those myself but the switch can only send "on" or "off".

                                      Here's the receive function from the sketch:

                                      void receive(const MyMessage &message) {
                                        if (message.type==V_VAR1) {  
                                          pulseCount = oldPulseCount = message.getLong();
                                          Serial.print("Received last pulse count from gw:");
                                          Serial.println(pulseCount);
                                          pcReceived = true;
                                        }
                                      }
                                      

                                      Assistance is much appreciated!

                                      bklB 1 Reply Last reply
                                      0
                                      • S sensorchecker

                                        Hello all,

                                        i use a ATMEGA328P with internal clock (MysBootloader) and have a 4-channel relay board connected at the Arduino outputs D3-D6 (current MySensors Example Sketch).

                                        As central unit i use a RaspberryPi with openhab 1.8 and a serial gateway (Arduino Nano) and the MySensors- OpenHAB serial binding of @bkl

                                        The OpenHab item looks like this:

                                        Switch Lights_Downlights_Front "Downlights Front" <selfLight> (Outdoor, Lights_Outdoor) {mysensors="54;1;V_STATUS"}

                                        Unfortunately I can not switch the relays ON or OFF.
                                        Many other sensors (Temp, Hum, Rain) works fine with this environment.

                                        Any help is appreciated!

                                        Greets & Thanks

                                        NickBuilderN Offline
                                        NickBuilderN Offline
                                        NickBuilder
                                        wrote on last edited by
                                        #71

                                        @sensorchecker Hi!
                                        Its not easy helping you using only the posted information. Any debug logs available from Openhab or the serial interface terminal?

                                        My item defintion looks the same:

                                        Switch Lampa <light> {mysensors="40;1;V_STATUS"}
                                        
                                        1 Reply Last reply
                                        0
                                        • Kodiak80K Offline
                                          Kodiak80K Offline
                                          Kodiak80
                                          wrote on last edited by
                                          #72

                                          I'm trying to get a single Dallas Temp sensor displayed in OpenHAB using the Serial Gateway. I'm running the MySensors v2 Dallas Temp sketch, and I'm seeing my sensor in the logs. However, I'm getting the following:

                                          2016-09-28 07:34:21.805 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'mysensors' of item ?Temperature? could not be parsed correctly.
                                          java.lang.NullPointerException: null
                                          	at java.util.regex.Matcher.getTextLength(Matcher.java:1234) ~[na:1.7.0_101]
                                          	at java.util.regex.Matcher.reset(Matcher.java:308) ~[na:1.7.0_101]
                                          	at java.util.regex.Matcher.<init>(Matcher.java:228) ~[na:1.7.0_101]
                                          	at java.util.regex.Pattern.matcher(Pattern.java:1088) ~[na:1.7.0_101]
                                          	at org.openhab.binding.mysensors.internal.MySensorsGenericBindingProvider.validateItemType(MySensorsGenericBindingProvider.java:57) ~[na:na]
                                          	at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:347) [org.openhab.model.item_1.8.3.jar:na]
                                          	at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:324) [org.openhab.model.item_1.8.3.jar:na]
                                          	at org.openhab.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:171) [org.openhab.model.item_1.8.3.jar:na]
                                          	at org.openhab.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:390) [org.openhab.model.item_1.8.3.jar:na]
                                          	at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:159) [org.openhab.model.core_1.8.3.jar:na]
                                          	at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:100) [org.openhab.model.core_1.8.3.jar:na]
                                          	at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) [org.openhab.model.core_1.8.3.jar:na]
                                          	at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) [org.openhab.model.core_1.8.3.jar:na]
                                          
                                          

                                          My item definition looks like the following:

                                          Number  Temperature           "Temp [%s °C]"     <temperature>   (gBio,gTemperature)     {mysensors=105;1;V_TEMP}
                                          

                                          As a follow-on, I've been trying to understand the {mysensors=105;1;V_TEMP} binding and what the semicolon separated values represent. So far I've been following example code, and haven't found the right documentation. Can someone point me to the right place? I appreciate any help.

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


                                          9

                                          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