New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding SI1145 as Custom Sensor fails reading values #342
Comments
From a quick look the code looks ok. Can you try publishing a fixed value like |
Thanks a lot Otto for your quick reply. Ok loading variables with fixed values in the update block works. I find the values published in HA so the rest of the code is fine indeed. Wiring issue is not likely as I can upload the equivalenty Arduino code and it works (same calls to the same library). I have a very dumb question. The library I am calling "Adafruit_SI1145.h", do I need to put it myself inside some directory (and which one) or does the compiler downloads it directly from some repository ? It could be this stupid from me... |
Ok Otto I got it working... I modified slightly the custom sensor code to match the one in my Arduino sketch. I changed the alias fonction declaration to match the one in my IDE code known to work. From "Adafruit_SI1145 uv;" changed to "Adafruit_SI1145 uv = Adafruit_SI1145();" Declared my variables before using them Make a reset() call before begin() in the setup block
|
Operating environment/Installation (Hass.io/Docker/pip/etc.):
ESPHOME Plugin in Home Assistant
ESP (ESP32/ESP8266, Board/Sonoff):
ESP8266 Wemos D1 Mini R2
Affected component:
https://esphome.io/components/sensor/custom.html
Description of problem:
Adding custom sensor not reading values from the sensor
Problem-relevant YAML-configuration entries:
Additional information and things you've tried:
Hi there! I've been struggling a bit trying to add a SI1145 UV sensor to Esphome.
I have a D1 Mini (ESP8266) board with a BME280 sensor working fine. I try to add a SI1145 but as the sensor is not supported out of the box I have followed the described procedure in order to add it as a custom sensor.
Compiling the code runs fine with no errors, and the specified library (Adafruit SI1145) seems to be properly downloaded and used.
Upon reboot of the ESP8266 everything seems good, I get my entities appearing in Home Assistant but the values of the sensor stay at 0. I am almost certain this is due to my dubness probably forgetting something very obvious somewhere in the process (naming convention, conf missing...).
I must add that this exact same setup (wiring, board etc) runs fine with an Arduino code.
My custom sensor file is named /config/esphome/SI1145.h
I have tried the single and multiple sensor modes, without any change in the behaviour ("0" value returned) :
My device code is meteo.yaml :
Upon reboot I have this log which seems to indicate that both sensors are recognised (Si1145 is at 0x60 address) :
The custom sensor block never seem to be called upon reboot. In Home assistant I can see my three sensor entries but with 0 value displayed. I have tried many different combinations but none seem to get values from the sensor. I must be doing something completly wrong or may have missed something obvious. Any help would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: