V_LEVEL light sensor not working
-
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; } }
-
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 ^^
Suggested Topics
-
Hi,
Home Assistant • • diltech