mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Rftrx force update (#37944)
* Make sure sensor and binary_sensor force update This make sure it's possible to react to events on all updates. * Correct addition of binary sensors
This commit is contained in:
parent
cecdce07cc
commit
d0040e60cc
@ -56,7 +56,7 @@ async def async_setup_entry(
|
|||||||
_LOGGER.error("Invalid device: %s", packet_id)
|
_LOGGER.error("Invalid device: %s", packet_id)
|
||||||
continue
|
continue
|
||||||
if not supported(event):
|
if not supported(event):
|
||||||
return
|
continue
|
||||||
|
|
||||||
device_id = get_device_id(event.device, data_bits=entity.get(CONF_DATA_BITS))
|
device_id = get_device_id(event.device, data_bits=entity.get(CONF_DATA_BITS))
|
||||||
if device_id in device_ids:
|
if device_id in device_ids:
|
||||||
@ -188,6 +188,11 @@ class RfxtrxBinarySensor(BinarySensorEntity, RestoreEntity):
|
|||||||
"""No polling needed."""
|
"""No polling needed."""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def force_update(self) -> bool:
|
||||||
|
"""We should force updates. Repeated states have meaning."""
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the sensor class."""
|
"""Return the sensor class."""
|
||||||
|
@ -178,6 +178,16 @@ class RfxtrxSensor(RestoreEntity):
|
|||||||
"""Return the unit this state is expressed in."""
|
"""Return the unit this state is expressed in."""
|
||||||
return self._unit_of_measurement
|
return self._unit_of_measurement
|
||||||
|
|
||||||
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
"""No polling needed."""
|
||||||
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def force_update(self) -> bool:
|
||||||
|
"""We should force updates. Repeated states have meaning."""
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return a device class for sensor."""
|
"""Return a device class for sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user