Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.2k stars 3.03k forks source link

Add INA226 usermod for reading current and power over i2c #3986

Closed LordMike closed 1 month ago

LordMike commented 1 month ago

This pull request introduces a new usermod for integrating the INA226 voltage, current and power sensors into WLED. It uses the wollewald/INA226_WE library to handle the wire stuff, and implements settings like (more options in readme):

It also implements MQTT publishing and HA discovery documents.

Images:

LordMike commented 1 month ago

As this is likely to be used to measure currents and powers of the lights WLED controls, would it make sense to react to changes in the effects, on/off, brightness and then trigger a measurement, regardless of what interval is set?

F.ex. if I set the brightness to something new, then ~2 seconds later I get a measurement - even if I just got one on an interval of 60 seconds. Effects will always have the possibility of being dynamic, so it's not going to become more "true" because of this, but maybe more responsive.

If so, how would I hook into relevant events?

LordMike commented 1 month ago

No notes? Wild. :)