Switch async_track_state_change to the faster async_track_state_change_event part 6 (#37869)

Calling async_track_state_change_event directly is faster than async_track_state_change (see #37251) since async_track_state_change is a wrapper around async_track_state_change_event now
This commit is contained in:
J. Nick Koston
2020-07-14 22:24:27 -07:00
committed by GitHub
parent bf72e3c965
commit e65235b207
5 changed files with 39 additions and 22 deletions
+1 -4
View File
@@ -54,7 +54,6 @@ async def test_valid_data(hass):
for reading, value in GOOD_DATA.items():
sensor.state_changed(
GOOD_CONFIG["sensors"][reading],
None,
State(GOOD_CONFIG["sensors"][reading], value),
)
assert sensor.state == "ok"
@@ -72,9 +71,7 @@ async def test_low_battery(hass):
sensor.hass = hass
assert sensor.state_attributes["problem"] == "none"
sensor.state_changed(
"sensor.mqtt_plant_battery",
State("sensor.mqtt_plant_battery", 45),
State("sensor.mqtt_plant_battery", 10),
"sensor.mqtt_plant_battery", State("sensor.mqtt_plant_battery", 10),
)
assert sensor.state == "problem"
assert sensor.state_attributes["problem"] == "battery low"