Closed fsaris closed 1 month ago
Hey there @javicalle, mind taking a look at this issue as it has been labeled with an integration (rflink
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
rflink documentation rflink source (message by IssueLinks)
Hi @fsaris Home Assistant is an open source projects, those lives from contributions of the community. Therefore any contribution would be highly appreciated :heart: so if you're are comfortable with this, feel free to create a pull request to adjust this.
As discussed in #128873, adding the device class would not be valid
Rflink devises reports ok/low so devise class can’t be used
Tnx for your effort.
For now I created a helper that turns the low/ok value into a % to work around this
Sorry for the late reply. I can't test myself but maybe you can just configure it as a binary_sensor
like this:
binary_sensor:
- platform: rflink
devices:
oregontemp_0d93_bat:
name: Weather battery
device_class: battery
@javicalle that doesn't seem to work. Somehow it still creates the sensor.digoo_2_battery
instead of updating binary_sensor.digoo_2_battery'
:
yaml
binary_sensor:
- platform: rflink
devices:
tunex_f301_bat:
name: 'DIGOO 2 battery'
device_class: battery
aliases:
- xiron_f301_bat
Debug logs:
2024-11-08 21:45:48.143 DEBUG (MainThread) [rflink.protocol] received data: 20;02;Tunex;ID=F301;TEMP=00b7;HU
2024-11-08 21:45:48.147 DEBUG (MainThread) [rflink.protocol] received data: M=72;BAT=OK;
2024-11-08 21:45:48.147 DEBUG (MainThread) [rflink.protocol] got packet: 20;02;Tunex;ID=F301;TEMP=00b7;HUM=72;BAT=OK;
2024-11-08 21:45:48.147 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'protocol': 'tunex', 'id': 'f301', 'temperature': 18.3, 'temperature_unit': '°C', 'humidity': 72, 'humidity_unit': '%', 'battery': 'ok'}
2024-11-08 21:45:48.148 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'tunex_f301_temp', 'sensor': 'temperature', 'value': 18.3, 'unit': '°C'}
2024-11-08 21:45:48.148 DEBUG (MainThread) [homeassistant.components.rflink] event of type sensor: {'id': 'tunex_f301_temp', 'sensor': 'temperature', 'value': 18.3, 'unit': '°C'}
2024-11-08 21:45:48.148 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['sensor.digoo_2_temp']
2024-11-08 21:45:48.148 DEBUG (MainThread) [homeassistant.components.rflink] passing event to sensor.digoo_2_temp
2024-11-08 21:45:48.148 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'tunex_f301_hum', 'sensor': 'humidity', 'value': 72, 'unit': '%'}
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] event of type sensor: {'id': 'tunex_f301_hum', 'sensor': 'humidity', 'value': 72, 'unit': '%'}
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['sensor.digoo_2_hum']
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] passing event to sensor.digoo_2_hum
2024-11-08 21:45:48.149 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'tunex_f301_bat', 'sensor': 'battery', 'value': 'ok', 'unit': None}
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] event of type sensor: {'id': 'tunex_f301_bat', 'sensor': 'battery', 'value': 'ok', 'unit': None}
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['sensor.digoo_2_battery']
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] passing event to sensor.digoo_2_battery
2024-11-08 21:45:48.149 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'tunex_f301_update_time', 'sensor': 'update_time', 'value': 1731098748, 'unit': 's'}
2024-11-08 21:45:48.150 DEBUG (MainThread) [homeassistant.components.rflink] event of type sensor: {'id': 'tunex_f301_update_time', 'sensor': 'update_time', 'value': 1731098748, 'unit': 's'}
2024-11-08 21:45:48.150 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['sensor.tunex_f301_update_time']
2024-11-08 21:45:48.150 DEBUG (MainThread) [homeassistant.components.rflink] passing event to sensor.tunex_f301_update_time
Ummm, I see the reason now:
binary_sensor
only responds to "command" events and not to "sensor" events like these:
2024-11-08 21:45:48.149 DEBUG (MainThread) [homeassistant.components.rflink] event of type sensor: {'id': 'tunex_f301_bat', 'sensor': 'battery', 'value': 'ok', 'unit': None}
Probably because motion detectors triggers command events and were the first use case for RFLink binary sensors.
Not an easy fix.
Thanks for testing anyway.
Regards
The problem
Sensors defined as battery don't get the device_type battery
What version of Home Assistant Core has the issue?
core-2024.10.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
rflink
Link to integration documentation on our website
No response
Diagnostics information
Sensors defined as battery don't get the device_type battery
homeassistant/components/rflink/sensor.py
Could be updated to the following to resolve this:
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response