Navigation

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

    Aloha

    @Aloha

    0
    Reputation
    22
    Posts
    922
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Aloha Follow

    Best posts made by Aloha

    This user hasn't posted anything yet.

    Latest posts made by Aloha

    • RE: Is V_RGB Supported in OpenHAB?

      Thank you @hard-shovel! It works. It doesn't store the value between reboots but I guess that's a different topic which I will look into.

      Cheers

      posted in OpenHAB
      Aloha
      Aloha
    • Is V_RGB Supported in OpenHAB?

      Hi,

      Is it possible to send a hex value (ff0000) with type 40 (V_RGB) from OpenHAB? Or is it possible to create a custom item with type 40?

      I want the message sent to look like this: 8;1;1;0;40;ffc550

      Cheers

      posted in OpenHAB
      Aloha
      Aloha
    • RE: Yes, the project is still alive and kicking

      Glad to hear you are back John!

      Maybe I should start a new thread but I'm having issues with the mysensors driver for version 1.4/1.5. It just stops listening on the port after a while and I have to reload the driver in order to make it processing messages again.

      In the management/drivers page there's nothing coming in under "last known messages" but if I do "cat /dev/ttyUSB0" I can see lots of messages. That makes me think the problem is with the driver. Does it sound familiar?

      I'm on the latest build released a few days ago and using a serial gateway.

      posted in PiDome
      Aloha
      Aloha
    • RE: Sensor flooding gateway

      @mfalkvidd said:

      Uncomment
      Serial.println(tripped);
      and you'll probably see what is wrong. The print statements are there to help you debug 🙂

      Hehe, yes you are right. The problem is the size of my sketch. It's really on the limit, if I just uncomment 1 print statement the sketch is too big. 😓 So I have to comment out or remove something else in order to uncomment something. ☺

      @BartE said:

      @Aloha with this statement on line 120: lastMillis = millis();

      You try to put an "unsigned long" (16 bits) in to an integer (8bits)
      this will change also the next variable in your case "bool lastTripped"

      Try to change line 71:

      int lastMillis;
      

      into

      unsigned long lastMillis;
      

      Wow, I'm impressed you saw that!
      It's actually working now. 👌

      With one less thing to worry about I might get some good sleep tonight. Thanks! 😄

      posted in Troubleshooting
      Aloha
      Aloha
    • Sensor flooding gateway

      Hi,

      I just can't see what's wrong with this sensor. It should only be sending from S0 once every minute but it floods the gateway with messages as fast as it can.

      I'm using 1.6.5 for this sensor.

      Here's my code:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik Ekblad
       * 
       * DESCRIPTION
       * Example sketch showing how to create a node thay repeates messages
       * from nodes far from gateway back to gateway. 
       * It is important that nodes that has enabled repeater mode calls  
       * gw.process() frequently. Repeaters should never sleep. 
       */
       
      #include <FastSPI_LED.h>
      #include <DigitalIO.h>
      #include <MySensor.h>
      #include <SPI.h>
      #include <MyTransportNRF24.h>
      #include <EEPROM.h>
      
      // Radio Variables
      #define RADIO_CE_PIN        5  // radio chip enable
      #define RADIO_SPI_SS_PIN    6  // radio SPI serial select
      
      // LED Variables
      #define CHILD_ID 1
      #define NUM_LEDS 150
      
      
      // Motion sensor Variables
      #define DIGITAL_INPUT_SENSOR 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
      #define CHILD_ID_MOTION 2   // Id of the sensor child
      
      // Light sensor Variables
      #define CHILD_ID_LIGHT 0
      #define LIGHT_SENSOR_ANALOG_PIN 3
      unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
      
      // Sometimes chipsets wire in a backwards sort of way
      struct CRGB { unsigned char b; unsigned char r; unsigned char g; };
      // struct CRGB { unsigned char r; unsigned char g; unsigned char b; };
      struct CRGB *leds;
      
      MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
      
      MyHwATMega328 hw;
      
      MySensor gw(transport, hw /*, signer*/);
      MyMessage msg(CHILD_ID,V_DIMMER);
      MyMessage motionMsg(CHILD_ID_MOTION, V_TRIPPED); // Motion sensor message
      MyMessage lightMsg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); // Light sensor message
      int lastLightLevel;
      int lastMillis;
      boolean lastTripped;
      long RGB_v[3] = {0,0,0};
      
      void setup()  
      {  
          // Setup FastSPI
          FastSPI_LED.setLeds(NUM_LEDS);
          FastSPI_LED.setChipset(CFastSPI_LED::SPI_LPD6803);
          FastSPI_LED.init();
          FastSPI_LED.start();
          leds = (struct CRGB*)FastSPI_LED.getRGBData(); 
          
        // The third argument enables repeater mode.
        gw.begin(incomingMessage, 8, false);
        //Send the sensor node sketch version information to the gateway
        gw.sendSketchInfo("RGB", "1");
      
        // Motion sensor
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
        
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID, S_DIMMER); 
        gw.present(CHILD_ID_MOTION, S_MOTION);
        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        
      
        prog3(120);
      }
      
      void loop() 
      {
        // Motion sensor stuff
          // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
      
        if (tripped != lastTripped) {
      //    Serial.println(tripped);
          gw.send(motionMsg.set(tripped?"1":"0"));  // Send tripped value to gw 
          lastTripped = tripped;
        }
      
        // Light sensor stuff
        int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
      
        if((lastMillis+SLEEP_TIME) < millis()) {
      //    Serial.println(lightLevel);
            gw.send(lightMsg.set(lightLevel));
            //lastLightLevel = lightLevel;
            lastMillis = millis();
        }    
        // By calling process() you route messages in the background
        gw.process();
        //gw.wait(SLEEP_TIME);
      }
      
      void incomingMessage(const MyMessage &message) {
        if (message.type == V_DIMMER) {
          //Serial.println( "V_DIMMER command received..." );
          //Serial.println( message.data );
          int prog= atoi( message.data );
          switch(prog) { 
            case 1: prog1(); break;
            //case 2: prog2(); break;
            case 3: prog3(120); break;
            case 4: prog4(); break;
          }
        }
        else if (message.type == V_RGB) {
      //    Serial.println( "V_RGB cmd received... " );
          //Serial.println( message.data );
          int addr_r = 10;
          int addr_g = 11;
          int addr_b = 12;
          String hexstring = message.getString();
      
          // Get rid of '#' and convert it to integer
          long number = (long) strtol( &hexstring[0], NULL, 16);
          
          // Split them up into r, g, b values
          RGB_v[0] = number >> 16;
          RGB_v[1] = number >> 8 & 0xFF;
          RGB_v[2] = number & 0xFF;
          EEPROM.update(addr_r, RGB_v[0]);
          EEPROM.update(addr_g, RGB_v[1]);
          EEPROM.update(addr_b, RGB_v[2]);
          prog3(120);
        }
        else {
          //Serial.println( "OTHER cmd received..." );
        }
      }
          
      // Program 1 - Turn on the light
      void prog1() {
        // one at a time
          memset(leds, 0, NUM_LEDS * 3);
          for(int i = 0 ; i < NUM_LEDS; i++ ) {
              leds[i].r = 255; 
              leds[i].g = 255; 
              leds[i].b = 255; 
            FastSPI_LED.show();
            delay(30);
          }
      }
      // Program 3 - Static decoration light
      void prog3(int p3level) {
      //    Serial.println( "Starting prog3" );
        // Fade in/fade out
          int r_value = 255;
          int g_value = 255;
          int b_value = 255;
          int address_r = 10;
          int address_g = 11;
          int address_b = 12;
          r_value = EEPROM.read(address_r);
          g_value = EEPROM.read(address_g);
          b_value = EEPROM.read(address_b);
      //    Serial.println( "Setting color to: ");
          memset(leds, 0, NUM_LEDS * 3);
          for(int k = 0; k < 256; k++) { 
            for(int i = 0; i < ((NUM_LEDS/3)*2); i++ ) {
                if(k < b_value) {
                  leds[i].b = k;
                }
                if(k < g_value) {
                  leds[i].g = k;
                }
                if(k < r_value) {
                  leds[i].r = k;
                }
            }
            FastSPI_LED.show();
            delay(3);
          }
          delay(300); 
          for(int k = 0; k <= p3level; k++) {
            for(int i = 0; i < (NUM_LEDS/3); i++ ) {
                if(b_value > 0) {
                  leds[i].b = b_value;
                }
                if(g_value > 0) {
                  leds[i].g = g_value;
                }
                //if(k > (r_value+30)) {
                if(r_value > 0) {
                  leds[i].r = r_value;
                }
                //}
            }
            if(k=p3level) {
              for(int i = (NUM_LEDS/3)*2; i < (NUM_LEDS); i++ ) {
                leds[i].b = 0;
                leds[i].g = 0;
                leds[i].r = 0;
              }
                //}
            }
            b_value--;
            g_value--;
            r_value--;
            FastSPI_LED.show();
            delay(3);
          }
      }
      // Program 4 - Turn off the light
      void prog4() {
        // one at a time
          memset(leds, 0, NUM_LEDS * 3);
          for(int i = 0 ; i < NUM_LEDS; i++ ) {
              leds[i].r = 0; 
              leds[i].g = 0; 
              leds[i].b = 0; 
            FastSPI_LED.show();
            delay(3);
          }
      }
      

      This is what it's sending:

      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      send: 8-8-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,st=ok:100
      

      😞

      posted in Troubleshooting
      Aloha
      Aloha
    • RE: Strange data sent from sensors

      Well, in that case it's probably just me going crazy. 😊

      It is the correct sketch. But it's not sleeping, it's just waiting?
      gw.wait(SLEEP_TIME); //sleep a bit

      I guess the comment might be a bit missleading and that I should update it, but gw.wait should work with repeaters. Right?

      posted in Troubleshooting
      Aloha
      Aloha
    • RE: Strange data sent from sensors

      Hmm strange.. I must have pasted the wrong sketch, sorry about that. It's not sleeping, it looks like this.

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      unsigned long SLEEP_TIME = 15000; // Sleep time between reads (in milliseconds)
      
      MySensor gw;
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      
      void setup()  
      { 
        gw.begin(NULL, 106, true);
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      {  
        delay(dht.getMinimumSamplingPeriod());
      
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
        gw.process();
        gw.wait(SLEEP_TIME); //sleep a bit
      }
      

      hek, I'm using the DHTII module. I have a second mysensor network (on a different channel and other controller) which also have the same type of sensor and it's working fine. Are these known to be causing issues?

      Also, why would the data from other nodes gets affected by the DHT sensor on the 106 node? 105 for instance is using a dallas temperature sensor.

      posted in Troubleshooting
      Aloha
      Aloha
    • RE: Strange data sent from sensors

      Here it is:

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
      unsigned long SLEEP_TIME = 15000; // Sleep time between reads (in milliseconds)
      
      MySensor gw;
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      
      void setup()  
      { 
        gw.begin(NULL, 106, true);
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      {  
        delay(dht.getMinimumSamplingPeriod());
      
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
        gw.process();
        gw.wait(SLEEP_TIME); //sleep a bit
      }
      
      posted in Troubleshooting
      Aloha
      Aloha
    • Strange data sent from sensors

      Hi,

      Occasionally I receive strange data from my sensors. This can sometimes happen several times a week and sometimes longer time can pass before it happens again. On average once a week for each sensor I would say. This is messing up my graphs and also don't feel very reliable.

      I've noticed that they all go through my repeater node (106). The repeater node itself has a temperature and humidity sensor.

      Some examples from my controller:

      2015-12-12T14:58:45.8881610+01:00       DEBUG   MySensors                               Read: 106-106-0 s=0,c=1,t=1,pt=5,l=5:1108344832
      2015-12-12T14:58:45.8886540+01:00       INFO    MySensors       N106S0  Sensor.Humidity 1108344832  
      
      2015-12-12T14:49:07.3811900+01:00       DEBUG   MySensors                               Read: 106-106-0 s=1,c=1,t=0,pt=5,l=5:1103626240
      2015-12-12T14:49:07.3816670+01:00       INFO    MySensors       N106S1  Sensor.Temperature      1103626240      -
      
      2015-12-13T18:25:08.2651820+01:00       DEBUG   MySensors                               Read: 105-106-0 s=0,c=1,t=0,pt=5,l=5:2941013193
      2015-12-13T18:25:08.2686200+01:00       INFO    MySensors       N105S0  Sensor.Temperature      2941013193      -
      
      2015-12-12T15:15:21.8491830+01:00       DEBUG   MySensors                               Read: 12-106-0 s=2,c=1,t=0,pt=5,l=5:897581056
      2015-12-12T15:15:21.8496750+01:00       INFO    MySensors       N12S2   Sensor.Temperature      897581056       -
      

      I also don't understand why all sensors seem to go through my repeater node. 1 of the sensors (12) is in the same room as the controller but still go through the repeater node which is in a different room past the controller.

      The repeater node has a 4.7 capacitor on the radio, I have also tried to replace the radio which made no difference.
      Any ideas?

      posted in Troubleshooting
      Aloha
      Aloha
    • Interrupt with gw.wait?

      Hi,

      Is it possible to interrupt the wait period when receiving an interrupt?

      I basically want to do this, but it's only available with gw.sleep.
      gw.wait(INTERRUPT,CHANGE, SLEEP_TIME);

      posted in Development
      Aloha
      Aloha