Use more state attribute name constants (#40428)
This commit is contained in:
1 parent
f78391ce2a
commit
5e90a4d000
36 files changed
+231
-156
No files matched your search
@@ -12,6 +12,7 @@ from homeassistant.components.utility_meter.const import (
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
)
|
||||
@@ -41,7 +42,9 @@ async def test_services(hass):
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_START)
|
||||
entity_id = config[DOMAIN]["energy_bill"]["source"]
|
||||
hass.states.async_set(entity_id, 1, {"unit_of_measurement": ENERGY_KILO_WATT_HOUR})
|
||||
hass.states.async_set(
|
||||
entity_id, 1, {ATTR_UNIT_OF_MEASUREMENT: ENERGY_KILO_WATT_HOUR}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
now = dt_util.utcnow() + timedelta(seconds=10)
|
||||
@@ -49,7 +52,7 @@ async def test_services(hass):
|
||||
hass.states.async_set(
|
||||
entity_id,
|
||||
3,
|
||||
{"unit_of_measurement": ENERGY_KILO_WATT_HOUR},
|
||||
{ATTR_UNIT_OF_MEASUREMENT: ENERGY_KILO_WATT_HOUR},
|
||||
force_update=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@@ -70,7 +73,7 @@ async def test_services(hass):
|
||||
hass.states.async_set(
|
||||
entity_id,
|
||||
4,
|
||||
{"unit_of_measurement": ENERGY_KILO_WATT_HOUR},
|
||||
{ATTR_UNIT_OF_MEASUREMENT: ENERGY_KILO_WATT_HOUR},
|
||||
force_update=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@@ -91,7 +94,7 @@ async def test_services(hass):
|
||||
hass.states.async_set(
|
||||
entity_id,
|
||||
5,
|
||||
{"unit_of_measurement": ENERGY_KILO_WATT_HOUR},
|
||||
{ATTR_UNIT_OF_MEASUREMENT: ENERGY_KILO_WATT_HOUR},
|
||||
force_update=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
Reference in new issue
Block a user