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. Development
  3. implementing multiple sensors

implementing multiple sensors

Scheduled Pinned Locked Moved Development
83 Posts 28 Posters 86.9k Views 15 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.
  • pgoP Offline
    pgoP Offline
    pgo
    wrote on last edited by pgo
    #57

    Hi guys,

    this is a one node with publishing DS temperatures and listening for relay commands I finished and tested yesterday>
    https://github.com/pgo-sk/mysensors/blob/master/arduino/DS_and_Relay.ino
    feel free to comment/use/publish...

    I combined the Dalas and Relay examples together - you have to deactivate the sleep for the relays to listen 100% of time.
    MQTT identification on openHAB:
    MyMQTT/20/0/V_TEMP - DS sensor(s)
    MyMQTT/20/1/V_LIGHT - relay 1
    MyMQTT/20/2/V_LIGHT - relay 2

    If somebody is interested I can post the maps/items files for openHAB

    Regards,
    Pego
    PS I am working on an home automation system with solar hot air panels control/solar hot water panels and all the common stuff like lights/temperatures/weather etc.. More here: https://github.com/pgo-sk/mysensors/wiki/Home-automation-using-mysensors-and-openHAB

    1 Reply Last reply
    1
    • I Offline
      I Offline
      integlikewhoa
      wrote on last edited by
      #58

      I'm also following along interested in the Temp, Humidity, and motion sensor.

      T 1 Reply Last reply
      0
      • I integlikewhoa

        I'm also following along interested in the Temp, Humidity, and motion sensor.

        T Offline
        T Offline
        Tibus
        wrote on last edited by
        #59

        @integlikewhoa check this :

        http://forum.mysensors.org/topic/404/3-in-1-humidity-temp-and-motion

        1 Reply Last reply
        0
        • pgoP Offline
          pgoP Offline
          pgo
          wrote on last edited by pgo
          #60

          https://github.com/pgo-sk/mysensors/blob/master/arduino/DS_Light_Relay

          • DS18B20 (up to 16 like in original temp sketch)
          • TEMT6000 reporting LUX light values
          • 2x Relays
            running and tested
            Sensor <-> MQTT gateway <-> openHAB/PC

          When interested can post the openHAB items/sitemap(s) settings

          Screenshots - over teamviewer, sorry for the quality.

          Here the TEMT6000 output - in a quite dark room and changing weather today>
          upload-42ac73c1-61cf-4b90-9ec5-14a994a3b50a
          Here the temperature and relays:
          upload-86825c33-2cc2-4018-9e08-2020007af3a9
          Menu:
          upload-adf5c382-2803-49b9-a461-eb25beb572c0

          aquaproA 1 Reply Last reply
          0
          • D Offline
            D Offline
            Dany
            wrote on last edited by
            #61

            Has anyone made ​​RGB LED strip node? I am looking for a working example program ...

            N 1 Reply Last reply
            0
            • blaceyB Offline
              blaceyB Offline
              blacey
              Admin
              wrote on last edited by
              #62

              @Dany - yes. Checkout http://www.mysensors.org/build/dimmer

              D 1 Reply Last reply
              0
              • korttomaK Offline
                korttomaK Offline
                korttoma
                Hero Member
                wrote on last edited by
                #63

                Or here is an example I'm using:

                https://codebender.cc/sketch:44740

                • Tomas
                1 Reply Last reply
                1
                • pgoP pgo

                  https://github.com/pgo-sk/mysensors/blob/master/arduino/DS_Light_Relay

                  • DS18B20 (up to 16 like in original temp sketch)
                  • TEMT6000 reporting LUX light values
                  • 2x Relays
                    running and tested
                    Sensor <-> MQTT gateway <-> openHAB/PC

                  When interested can post the openHAB items/sitemap(s) settings

                  Screenshots - over teamviewer, sorry for the quality.

                  Here the TEMT6000 output - in a quite dark room and changing weather today>
                  upload-42ac73c1-61cf-4b90-9ec5-14a994a3b50a
                  Here the temperature and relays:
                  upload-86825c33-2cc2-4018-9e08-2020007af3a9
                  Menu:
                  upload-adf5c382-2803-49b9-a461-eb25beb572c0

                  aquaproA Offline
                  aquaproA Offline
                  aquapro
                  wrote on last edited by aquapro
                  #64

                  @pgo said:

                  When interested can post the openHAB items/sitemap(s) settings

                  Hi, I'm interested. :-)
                  Or is this the latest version ?

                  pgoP 1 Reply Last reply
                  0
                  • aquaproA aquapro

                    @pgo said:

                    When interested can post the openHAB items/sitemap(s) settings

                    Hi, I'm interested. :-)
                    Or is this the latest version ?

                    pgoP Offline
                    pgoP Offline
                    pgo
                    wrote on last edited by pgo
                    #65

                    @aquapro said:

                    Hi, I'm interested. :-)
                    Or is this the latest version ?

                    Yes :), for the sketches mentioned earlier.
                    <Comment to myself: Have to switch to some versioning as now I am already deeper in the project including cameras, weather forcasts etc.>

                    1 Reply Last reply
                    0
                    • aquaproA Offline
                      aquaproA Offline
                      aquapro
                      wrote on last edited by
                      #66

                      I could not decide yet on a platform. OpenHAB should be my next test.

                      pgoP 1 Reply Last reply
                      0
                      • pgoP Offline
                        pgoP Offline
                        pgo
                        wrote on last edited by pgo
                        #67

                        test1.items
                        test1.sitemap
                        test1.rules
                        webcam.png
                        webcam.png -icon for webcam - put in openhab/webapps/images

                        My Current openHAB items/sitemap. 1 multisensor with Temp/Lux/Humidity sensor, 1 ethernet/MQTT gateway.

                        Also weather forcast from yr.no and Samsung TV remote controls (Mute working, rest not so much)

                        • openHAB v 1.5.1
                        • Addons :
                          \openhab\addons>
                          org.openhab.binding.http-1.5.1.jar
                          org.openhab.binding.mqtt-1.6.0-SNAPSHOT.jar
                          org.openhab.binding.ntp-1.5.1.jar
                          org.openhab.binding.samsungtv-1.6.0-SNAPSHOT.jar
                          org.openhab.binding.zwave-1.6.0-SNAPSHOT.jar
                          org.openhab.io.habmin-1.6.0-SNAPSHOT.jar
                          org.openhab.persistence.exec-1.5.1.jar
                          org.openhab.persistence.logging-1.5.1.jar
                          org.openhab.persistence.mqtt-1.6.0-SNAPSHOT.jar
                          org.openhab.persistence.rrd4j-1.5.1.jar

                        HABmin conf with graphs:
                        charts.xml -put in openhab/etc/habmin

                        In habmin.cfg specify the IP of your MQTT arduino and port>
                        '#'mqtt:<broker>.clientId=<clientId>
                        mqtt:mysensor.url=tcp://192.168.1.234:1883
                        mqtt:mysensor.clientId=MQTT
                        mqtt:mysensor.qos=0
                        mqtt:mysensor.retain=true
                        mqtt:mysensor.async=true

                        Here some screenshots:
                        Menu.PNG
                        Light.PNG
                        Temp-Hum.PNG
                        Temp-chart.PNG
                        TV.PNG
                        These (Direct channel/Channel/Volume) does not work yet... Mute is OK and Volume displays only the current TV volume.

                        1 Reply Last reply
                        0
                        • aquaproA aquapro

                          I could not decide yet on a platform. OpenHAB should be my next test.

                          pgoP Offline
                          pgoP Offline
                          pgo
                          wrote on last edited by
                          #68

                          @aquapro said:

                          I could not decide yet on a platform. OpenHAB should be my next test.

                          It runs quit stable on my old WinXP64Pro Quadcore w/many virtual machines on it.
                          Have still some problems with the syntax of the openHAB settings, but else nice controller ;)

                          1 Reply Last reply
                          0
                          • blaceyB blacey

                            @Dany - yes. Checkout http://www.mysensors.org/build/dimmer

                            D Offline
                            D Offline
                            Dany
                            wrote on last edited by Dany
                            #69

                            @blacey I tried this already. This is a simple dimmer node, not RGB. It's work fine.
                            But I would like to use a RGB colorpicker in openhab.

                            pgoP 1 Reply Last reply
                            0
                            • D Dany

                              @blacey I tried this already. This is a simple dimmer node, not RGB. It's work fine.
                              But I would like to use a RGB colorpicker in openhab.

                              pgoP Offline
                              pgoP Offline
                              pgo
                              wrote on last edited by pgo
                              #70

                              @Dany said:

                              I would like to use with a RGB colorpicker in openhab.

                              I would do that soon too. Would you like to have a node only as rgbw dimmer or maybe with a lux sensor as I like to do to also adjust for constant light/lux in the room?

                              In my menu you can see the setpoint for lux under the light sensor.

                              D 1 Reply Last reply
                              0
                              • pgoP pgo

                                @Dany said:

                                I would like to use with a RGB colorpicker in openhab.

                                I would do that soon too. Would you like to have a node only as rgbw dimmer or maybe with a lux sensor as I like to do to also adjust for constant light/lux in the room?

                                In my menu you can see the setpoint for lux under the light sensor.

                                D Offline
                                D Offline
                                Dany
                                wrote on last edited by
                                #71

                                @pgo The RGB Colorpicker works already in openhab.
                                I have some problem in arduino side...i tried update the sample DimmerActuator code, but didn't work. I tried korttoma's code, but it didn't works for me, too.

                                (e.g. message.header.childId -didn't work)

                                pgoP 1 Reply Last reply
                                0
                                • D Dany

                                  @pgo The RGB Colorpicker works already in openhab.
                                  I have some problem in arduino side...i tried update the sample DimmerActuator code, but didn't work. I tried korttoma's code, but it didn't works for me, too.

                                  (e.g. message.header.childId -didn't work)

                                  pgoP Offline
                                  pgoP Offline
                                  pgo
                                  wrote on last edited by
                                  #72

                                  @Dany said:

                                  @pgo The RGB Colorpicker works already in openhab.
                                  I have some problem in arduino side...i tried update the sample DimmerActuator code, but didn't work. I tried korttoma's code, but it didn't works for me, too.

                                  (e.g. message.header.childId -didn't work)

                                  Can you post the HW connections you use on arduino and the items/sitemap of the dimmer in openHAB? I can then check on my install.

                                  1 Reply Last reply
                                  0
                                  • D Dany

                                    Has anyone made ​​RGB LED strip node? I am looking for a working example program ...

                                    N Offline
                                    N Offline
                                    niccodemi
                                    wrote on last edited by
                                    #73

                                    I combined Humidity and Lux code. Serial monitor works ok (see below) but for some reason when I try to add node to Vera I get only node, temp and lux (no humidity). I guess something is wrong in combined sketch?

                                    serial monitor

                                    sensor started, id 1
                                    send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
                                    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
                                    read: 0-0-1 s=255,c=3,t=6,pt=0,l=1:M
                                    send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,st=ok:Humidity/Lux
                                    send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
                                    send: 1-1-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1
                                    send: 1-1-0-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1
                                    send: 1-1-0-0 s=2,c=0,t=16,pt=0,l=5,st=ok:1.4.1
                                    send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:28.6
                                    T: 28.60
                                    send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,st=ok:61.8
                                    H: 61.80
                                    2
                                    send: 1-1-0-0 s=2,c=1,t=23,pt=3,l=2,st=ok:2
                                    2
                                    

                                    sketch

                                    #include <SPI.h>
                                    #include <MySensor.h>  
                                    #include <DHT.h> 
                                    #include <BH1750.h>
                                    #include <Wire.h> 
                                    
                                    #define CHILD_ID_HUM 0
                                    #define CHILD_ID_TEMP 1
                                    #define CHILD_ID_LIGHT 2
                                    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
                                    #define LIGHT_SENSOR_ANALOG_PIN 0
                                    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                    
                                    BH1750 lightSensor;
                                    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);
                                    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
                                    uint16_t lastlux;
                                    
                                    
                                    void setup()  
                                    { 
                                      gw.begin();
                                      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
                                    
                                      // Send the Sketch Version Information to the Gateway
                                      gw.sendSketchInfo("Humidity/Lux", "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);
                                      gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                                      
                                      metric = gw.getConfig().isMetric;
                                      lightSensor.begin();
                                    }
                                    
                                    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);
                                      }     
                                      uint16_t lux = lightSensor.readLightLevel();// Get Lux value
                                      Serial.println(lux);
                                      if (lux != lastlux) {
                                          gw.send(msg.set(lux));
                                          lastlux = lux;
                                      }
                                      
                                    
                                      gw.sleep(SLEEP_TIME); //sleep a bit
                                    }
                                    
                                    pgoP 1 Reply Last reply
                                    0
                                    • N niccodemi

                                      I combined Humidity and Lux code. Serial monitor works ok (see below) but for some reason when I try to add node to Vera I get only node, temp and lux (no humidity). I guess something is wrong in combined sketch?

                                      serial monitor

                                      sensor started, id 1
                                      send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
                                      send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
                                      read: 0-0-1 s=255,c=3,t=6,pt=0,l=1:M
                                      send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,st=ok:Humidity/Lux
                                      send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
                                      send: 1-1-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1
                                      send: 1-1-0-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1
                                      send: 1-1-0-0 s=2,c=0,t=16,pt=0,l=5,st=ok:1.4.1
                                      send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:28.6
                                      T: 28.60
                                      send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,st=ok:61.8
                                      H: 61.80
                                      2
                                      send: 1-1-0-0 s=2,c=1,t=23,pt=3,l=2,st=ok:2
                                      2
                                      

                                      sketch

                                      #include <SPI.h>
                                      #include <MySensor.h>  
                                      #include <DHT.h> 
                                      #include <BH1750.h>
                                      #include <Wire.h> 
                                      
                                      #define CHILD_ID_HUM 0
                                      #define CHILD_ID_TEMP 1
                                      #define CHILD_ID_LIGHT 2
                                      #define HUMIDITY_SENSOR_DIGITAL_PIN 3
                                      #define LIGHT_SENSOR_ANALOG_PIN 0
                                      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                      
                                      BH1750 lightSensor;
                                      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);
                                      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
                                      uint16_t lastlux;
                                      
                                      
                                      void setup()  
                                      { 
                                        gw.begin();
                                        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
                                      
                                        // Send the Sketch Version Information to the Gateway
                                        gw.sendSketchInfo("Humidity/Lux", "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);
                                        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                                        
                                        metric = gw.getConfig().isMetric;
                                        lightSensor.begin();
                                      }
                                      
                                      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);
                                        }     
                                        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
                                        Serial.println(lux);
                                        if (lux != lastlux) {
                                            gw.send(msg.set(lux));
                                            lastlux = lux;
                                        }
                                        
                                      
                                        gw.sleep(SLEEP_TIME); //sleep a bit
                                      }
                                      
                                      pgoP Offline
                                      pgoP Offline
                                      pgo
                                      wrote on last edited by
                                      #74

                                      @niccodemi Check:
                                      gw.send(msgTemp.set(temperature, 1));
                                      gw.send(msgHum.set(humidity, 1));
                                      gw.send(msg.set(lux)); I miss here ",1"

                                      N 1 Reply Last reply
                                      0
                                      • pgoP pgo

                                        @niccodemi Check:
                                        gw.send(msgTemp.set(temperature, 1));
                                        gw.send(msgHum.set(humidity, 1));
                                        gw.send(msg.set(lux)); I miss here ",1"

                                        N Offline
                                        N Offline
                                        niccodemi
                                        wrote on last edited by
                                        #75

                                        @pgo thanks, all sensors show up now.

                                        1 Reply Last reply
                                        0
                                        • N Offline
                                          N Offline
                                          niccodemi
                                          wrote on last edited by
                                          #76

                                          One more combined sketch - UV / Light Lux. Everything seems to work ok except only 2 items show up in vera: node and lux sensor. UV sensor is missing.

                                          serial output

                                          sensor started, id 6
                                          send: 6-6-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
                                          send: 6-6-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
                                          read: 0-0-6 s=255,c=3,t=6,pt=0,l=1:M
                                          send: 6-6-0-0 s=255,c=3,t=11,pt=0,l=13,st=ok:UV/Lux Sensor
                                          send: 6-6-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
                                          send: 6-6-0-0 s=0,c=0,t=16,pt=0,l=5,st=ok:1.4.1
                                          send: 6-6-0-0 s=0,c=0,t=11,pt=0,l=5,st=ok:1.4.1
                                          Lux reading: 48
                                          send: 6-6-0-0 s=0,c=1,t=23,pt=7,l=5,st=ok:48.0
                                          Uv reading: 583
                                          Uv index: 5
                                          send: 6-6-0-0 s=0,c=1,t=11,pt=7,l=5,st=ok:5.0
                                          

                                          sketch code

                                          /*
                                            Vera Arduino BH1750FVI Light sensor
                                            communicate using I2C Protocol
                                            this library enable 2 slave device addresses
                                            Main address  0x23
                                            secondary address 0x5C
                                            connect the sensor as follows :
                                            Light sensor
                                            VCC  >>> 5V
                                            Gnd  >>> Gnd
                                            ADDR >>> NC or GND  
                                            SCL  >>> A5
                                            SDA  >>> A4
                                            
                                            UV sensor
                                            VCC  >>> 5V
                                            Gnd  >>> Gnd
                                            OUT  >>> A3
                                            Contribution: idefix
                                           
                                          */
                                          
                                          #include <SPI.h>
                                          #include <MySensor.h>  
                                          #include <BH1750.h>
                                          #include <Wire.h> 
                                          
                                          #define CHILD_ID_LIGHT 0
                                          #define CHILD_ID_UV 0
                                          #define LIGHT_SENSOR_ANALOG_PIN 0
                                          #define UV_SENSOR_ANALOG_PIN 3
                                          unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                          
                                          BH1750 lightSensor;
                                          MySensor gw;
                                          MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
                                          MyMessage uvMsg(CHILD_ID_UV, V_UV);
                                          uint16_t lastlux;
                                          int lastUV = -1;
                                          int uvIndexValue [13] = { 50, 227, 318, 408, 503, 606, 696, 795, 881, 976, 1079, 1170, 3000};
                                          int uvIndex;
                                          
                                          void setup()  
                                          { 
                                            gw.begin();
                                            // Send the sketch version information to the gateway and Controller
                                            gw.sendSketchInfo("UV/Lux Sensor", "1.0");
                                            // Register all sensors to gateway (they will be created as child devices)
                                            gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                                            gw.present(CHILD_ID_UV, S_UV);
                                            
                                            lightSensor.begin();
                                          }
                                          
                                          void loop()      
                                          {     
                                            uint16_t lux = lightSensor.readLightLevel();// Get Lux value
                                            Serial.print("Lux reading: ");
                                            Serial.println(lux);
                                            if (lux != lastlux) {
                                                gw.send(msg.set(lux, 1));
                                                lastlux = lux;
                                            }
                                            uint16_t uv = analogRead(0);// Get UV value
                                            Serial.print("Uv reading: ");
                                            Serial.println(uv);
                                            for (int i = 0; i < 13; i++)
                                            {
                                              if (uv <= uvIndexValue[i]) 
                                              {
                                                uvIndex = i;
                                                break;
                                              }
                                            }
                                            Serial.print("Uv index: ");
                                            Serial.println(uvIndex);
                                          
                                            if (uvIndex != lastUV) {
                                                gw.send(uvMsg.set(uvIndex, 1));
                                                lastUV = uvIndex;
                                            }
                                            gw.sleep(SLEEP_TIME);
                                          }
                                          
                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 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