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. Home Assistant
  4. V_LEVEL light sensor not working

V_LEVEL light sensor not working

Scheduled Pinned Locked Moved Home Assistant
2 Posts 1 Posters 543 Views 1 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.
  • KorYiK Offline
    KorYiK Offline
    KorYi
    wrote on last edited by
    #1

    I tried making a motion/light/door sensor and everything seems to work fine, except the light sensor doesn't show up in home assistant. The problem seems to be me using V_LEVEL to pass exact lux amount. As I understand it, this should work fine? I can seen in gw log that lux value and "custom_lux" prefix get transferred as expected. Any help would be appreciated as I seem to be lost at this point....

    2019-03-07 19:29:57 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 1 child 3
    2019-03-07 19:29:57 DEBUG (MainThread) [homeassistant.components.mysensors.helpers] Invalid values: {37: '1'}: sensor platform: node 1 child 3: S_LIGHT_LEVEL requires value_type V_LIGHT_LEVEL @ data[23]
    

    Relevant code:

    #define MY_RADIO_RF24
    #include <MySensors.h>
    
    #include <SPI.h>
    
    #include <Bounce2.h>
    #include <Wire.h>
    #include <BH1750.h>
    
    #define CHILD_ID_LIGHT 3    //ID of light sensor
    
    uint16_t lastlux=0;         //light sensor
    
    BH1750 LightSensor;       //declaration of light sensor
    
    MyMessage msg_light(CHILD_ID_LIGHT, V_LEVEL);   //light sensor message
    MyMessage msgPrefix(CHILD_ID_LIGHT, V_UNIT_PREFIX);  //custom unit for light sensor
    
    void setup()
    {
      LightSensor.begin();
    
      send(msgPrefix.set("custom_lux"));        //light sensor setup for hassio
      send(msg_light.set(lastlux));
    
      request(CHILD_ID_LIGHT, V_LEVEL);
      wait(2000, C_SET, V_LEVEL);
    }
    
    void presentation()
    {
      sendSketchInfo("Motion/Door/Lux sensor", "1.0");    //info about the sensor
    
      present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()
    {
        uint16_t lux = LightSensor.readLightLevel();                //only send light info if the motion sensor was triggered
        if (lux != lastlux) {
          send(msg_light.set(lux));
          lastlux = lux;
        }
    }
    
    KorYiK 1 Reply Last reply
    0
    • KorYiK KorYi

      I tried making a motion/light/door sensor and everything seems to work fine, except the light sensor doesn't show up in home assistant. The problem seems to be me using V_LEVEL to pass exact lux amount. As I understand it, this should work fine? I can seen in gw log that lux value and "custom_lux" prefix get transferred as expected. Any help would be appreciated as I seem to be lost at this point....

      2019-03-07 19:29:57 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 1 child 3
      2019-03-07 19:29:57 DEBUG (MainThread) [homeassistant.components.mysensors.helpers] Invalid values: {37: '1'}: sensor platform: node 1 child 3: S_LIGHT_LEVEL requires value_type V_LIGHT_LEVEL @ data[23]
      

      Relevant code:

      #define MY_RADIO_RF24
      #include <MySensors.h>
      
      #include <SPI.h>
      
      #include <Bounce2.h>
      #include <Wire.h>
      #include <BH1750.h>
      
      #define CHILD_ID_LIGHT 3    //ID of light sensor
      
      uint16_t lastlux=0;         //light sensor
      
      BH1750 LightSensor;       //declaration of light sensor
      
      MyMessage msg_light(CHILD_ID_LIGHT, V_LEVEL);   //light sensor message
      MyMessage msgPrefix(CHILD_ID_LIGHT, V_UNIT_PREFIX);  //custom unit for light sensor
      
      void setup()
      {
        LightSensor.begin();
      
        send(msgPrefix.set("custom_lux"));        //light sensor setup for hassio
        send(msg_light.set(lastlux));
      
        request(CHILD_ID_LIGHT, V_LEVEL);
        wait(2000, C_SET, V_LEVEL);
      }
      
      void presentation()
      {
        sendSketchInfo("Motion/Door/Lux sensor", "1.0");    //info about the sensor
      
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      }
      
      void loop()
      {
          uint16_t lux = LightSensor.readLightLevel();                //only send light info if the motion sensor was triggered
          if (lux != lastlux) {
            send(msg_light.set(lux));
            lastlux = lux;
          }
      }
      
      KorYiK Offline
      KorYiK Offline
      KorYi
      wrote on last edited by
      #2

      I was so occupied checking everything related to MySensors that I completely forgot to check the home-assistant part.

      I didn't specify the MySensors version in configuration.yaml, which defaults to 1.4 which doesn't support V_LEVEL...

      Oh well, problem solved ^^

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


      22

      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