Do sensors report battery level?
-
Hi, haven't seen this info anywhere yet..... Can sensors report their battery level back to the Vera like other z-wave sensors do?
-
Yes, it is possible. You'll find the API here:
http://www.mysensors.org/build/sensor_api#the-full-apivoid sendBatteryLevel(int batteryLevel);
If you want a battery-powered sensor to report its battery level use this method. The value is a percentage (0-100).
Here is info on how to measure battery level:
http://www.mysensors.org/build/battery#measuring-and-reporting-battery-level
-
Testing v1.4 beta.
I'm already getting a very precise Tension value for Lipo batteries where stopping draining it at 3.2V (at max) could be crucial.
The problem is, tension wise and under load:
3.5V = 3.125 %
3.4V = 1.25%
3.3V = 0.2%
3.2V = 0%I'm already interpolating for any value of tension (for middle values).
As we can see, it drops and drops fast at the very ending, but for a low discharge scenario as we get with 328p, 1% for a 2000mAh still means many many days of use (maybe months).
As tension calculation occurs before percentage on the node i could and should cut off at the node side based on tension.
But for controller this means many days of use at 0% starting near below 3.38V because actually a percentage like 0.98% is truncated and sent like 0% because we are sending an uint8_t value.
I'm trying to change that in MySensor::sendBatteryLevel changing 8bit integer to something like double/float, but i get compile errors.
Is double/float supported for internal messages?
-
For normal messages float/double will be converted to strings as found no c-standard standard way of sending then serialized OTA. If you want decimals I would suggest sending them *10 or *100 and divide result on receiving side. Floats in the AVR platform is very memory consuming anyway so try to avoid it.
-
@hek Thank you very much Henrik! I will try it!