Closed ualex73 closed 3 years ago
The problem here is that different devices report battery status in different ways - if they report it at all. Most commonly, there is a 'low battery' flag. If this is set, the battery status is given by the RFXtrx433 firmware as 0, otherwise it is 9. Some devices return an actual numeric battery level. Again this interpreted by the firmware, as a number in the range 0 to 9, with 0 being 'empty' and 9 being 'full'. This doesn't mean that all the intervening numbers can actually appear - the device may only report 3 or 5 different values. Nor is there any specified mapping from a numeric value to a battery percentage, simply 'more is better'.
I thought it best to pass on the firmware's numeric values where they are available, rather than trying to interpret them. There are some new devices appearing which actually report a battery voltage, but they are not yet supported. I will probably add a new batteryVoltage
property to the status
for these.
The status.batteryVoltage
property is now present in messages received from Edisio devices
From your previous message I looks like you will most likely add "batteryVoltage", but this then won't work for my Oregon devices?
The Edisio devices are new, and support for them has only recently been added to the RFXTRX: they return battery voltage instead of battery status (but I don't know what voltages correspond to 'empty' or 'full'). As far as I know, all the Oregon devices still only return a battery status number, not a voltage.
In principle, you could power an Oregon sensors of some sort from an adjustable power supply, and vary its output to find out what status values the sensor produces for a given voltage. Assuming the same circuit is used in all Oregon devices (a big assume!) that would give you a rough calibration. Unfortunately I don't have any Oregon devices here
At this moment the battery level is given in a numeric value, but this isn't 0-100% or any other useable form. Is it possible to report it is as e.g. "LOW" or "OK"? From other code I saw it only reports battery=0 is low, and any higher value reports as "OK".
25 Dec 10:04:17 - [info] [debug:4f67ea54.0c4ddc] { topic: 'TH4/0x7F01', status: { rssi: 7, battery: 9 }, payload: { temperature: { value: 16.8, unit: 'degC' }, humidity: { value: 65, unit: '%', status: 'NORMAL' } }, _msgid: 'bbc6aadd.618658' }