Bump hatasmota to 0.7.2 (#100129)

This commit is contained in:
Erik Montnemery 2023-09-11 18:35:48 +02:00 committed by GitHub
parent 56678851af
commit 18e08bc79f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 3 deletions

View file

@ -1835,3 +1835,35 @@ async def test_entity_id_update_discovery_update(
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, Platform.LIGHT, config
)
async def test_no_device_name(
hass: HomeAssistant, mqtt_mock: MqttMockHAClient, setup_tasmota
) -> None:
"""Test name of lights when no device name is set.
When the device name is not set, Tasmota uses friendly name 1 as device naem.
This test ensures that case is handled correctly.
"""
config = copy.deepcopy(DEFAULT_CONFIG)
config["dn"] = "Light 1"
config["fn"][0] = "Light 1"
config["fn"][1] = "Light 2"
config["rl"][0] = 2
config["rl"][1] = 2
mac = config["mac"]
async_fire_mqtt_message(
hass,
f"{DEFAULT_PREFIX}/{mac}/config",
json.dumps(config),
)
await hass.async_block_till_done()
state = hass.states.get("light.light_1")
assert state is not None
assert state.attributes["friendly_name"] == "Light 1"
state = hass.states.get("light.light_1_light_2")
assert state is not None
assert state.attributes["friendly_name"] == "Light 1 Light 2"