Switch tests to use hass objects instead of direct (#37530)
* Switch tests to use hass objects instead of direct * Make sure sensor update state * Add some initial binary sensor tests * Add initial binary sensor tests * Add tests for pt2262 * Add test for off delay
This commit is contained in:
1 parent
3ad59f877c
commit
01fd33f173
11 files changed
+640
-548
No files matched your search
@@ -93,7 +93,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
entity.get(CONF_COMMAND_ON),
|
||||
entity.get(CONF_COMMAND_OFF),
|
||||
)
|
||||
device.hass = hass
|
||||
sensors.append(device)
|
||||
RFX_DEVICES[device_id] = device
|
||||
|
||||
@@ -121,7 +120,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
||||
pkt_id = "".join(f"{x:02x}" for x in event.data)
|
||||
sensor = RfxtrxBinarySensor(event, pkt_id)
|
||||
sensor.hass = hass
|
||||
RFX_DEVICES[device_id] = sensor
|
||||
add_entities([sensor])
|
||||
_LOGGER.info(
|
||||
@@ -271,4 +269,5 @@ class RfxtrxBinarySensor(BinarySensorEntity):
|
||||
def update_state(self, state):
|
||||
"""Update the state of the device."""
|
||||
self._state = state
|
||||
self.schedule_update_ha_state()
|
||||
if self.hass:
|
||||
self.schedule_update_ha_state()
|
||||
Reference in new issue
Block a user