Any interest in energy for INA219? #10354
Replies: 5 comments 13 replies
-
Hi @Frogmore42 Is this breaking anything for people already using INA219 ? Today INA219 is reported through the SENSOR message as My 2c. |
Beta Was this translation helpful? Give feedback.
-
It is currently just a POC, so nothing is set in stone. Since it just a matter of programming, it can be anything. I was thinking I would follow the model of the other power measuring sensors. I have seen some issues about the INA219, so I suppose there are people who are using it. My intention for the JSON is to add fields for energy. That makes it a non-breaking change if people use best practices for reading the JSON. But, it could break poor implementations. Adding a compile time option is possible. I always compile my own, so that is fine with me. Add support to allow dynamic changes is also possible, but probably uses more RAM and code space and adds to the complexity. There have been many breaking changes with the JSON (and settings) over the years. I suppose having access to just bolts, amps, watts is helpful, but I found that was not really enough for what I need. The cost of the extra measurements, seems small (I am seeing the same percentage utilization reported, but have not looked closer. There is a comment in the code that it takes a few ms for each sensor, so doing it every 50ms is a significant increase over every second.). Doing energy for multiple sensors is easy. The code is in a loop for each sensor. It will just be done automatically for each sensor. |
Beta Was this translation helpful? Give feedback.
-
@Frogmore42 Looks like we don't understand each other If you modify the INA219 sensor message to add new field this is fine and will not break anything. Just adding up. I was commenting about ENERGY which are a special class of sensors. They do not report in a message by their name. My original understanding was that you wanted to change the INA219 driver to match those ENERGY sensors. WIth regards to your pump monitoring use case, I will answer on the other discussion. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
By the way 2: The "normal" |
Beta Was this translation helpful? Give feedback.
-
I want to use Tasmota to reply the timer on a hay feeder. To make it more interesting, I am adding an INA219 to measure the current that the motor uses and also want to know how long the motor runs (to understand the general health of the system and to make sure it really did work). Since the motor only runs for less than 10s, measuring the duration is challenging. Looking at the energy used gives part of the picture and using a rule to publish the sensor value multiple times while the motor is running, will probably provide the rest.
Anyway, I have a proof of concept of using the INA219 to measure energy. Now there are some decisions to make.
I think this is probably generally useful. Using 50ms for the integration time will give an indication of average power, but will have some inaccuracy for loads that change rapidly.
Any thoughts?
I would like this to be part of the official release, even if it is off by default. I will submit a PR for it, so not asking for help with the code, but might have some questions.
Beta Was this translation helpful? Give feedback.
All reactions