rtl_433-hass-addons
rtl_433-hass-addons copied to clipboard
rtl433 battery status is not properly handled
Batteries shows as 100% without icon Wheareas other integrations shows battery icon
Looks like it should be an integer to be properly handled
Thanks for the report. Are you thinking the problem is with the value_template
line at https://github.com/merbanan/rtl_433/blob/master/examples/rtl_433_mqtt_hass.py#L162-L173 ?
I have no idea... But converting the level to an integer seems logical if it's a 0-100 range.
Another difference, the same sensor with rfxcom (top) and rtl_433 (below) with low battery. It didn't rename the rtl_433 entities for now, so it's the default name. rtl_433 log says "Battery : 0" for low battery instead of "Battery : 1"
For the 100,0% issue, maybe the text is simply too wide, because the icon shows for low battery, would explain the "…"
EnCh - Entity Checker for AppDaemon doesn't seem to recognize the low battery level with rtl_433, works with rfxtrx, dunno why, no trace in logs. Maybe the float value again.
Changing value template to this worked for me: "value_template": "{% set temp_val = float(value) * 100 | float(default=0) %}{{ temp_val | float(default=0) | round(0) }}"
I think it would be good if we could confirm if Home Assistant is expecting ints or floats for battery percentages. I haven't found docs or code yet confirming one way or another.
This is what I use and it works great. "value_template": "{% if is_number(value) %}{% set temp_val = float(value) * 100 | float(default=0) %}{{ temp_val | float(default=0) | round(0) }}{% endif %}"
Since this is from the upstream code, and I don't have any devices that expose this battery info to test, I'm closing this out. Please feel free to open a new issue if a PR is filed upstream we should patch in to improve this. Thanks!