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

@ -8,5 +8,5 @@
"iot_class": "local_push",
"loggers": ["hatasmota"],
"mqtt": ["tasmota/discovery/#"],
"requirements": ["HATasmota==0.7.1"]
"requirements": ["HATasmota==0.7.2"]
}

View File

@ -29,7 +29,7 @@ DoorBirdPy==2.1.0
HAP-python==4.7.1
# homeassistant.components.tasmota
HATasmota==0.7.1
HATasmota==0.7.2
# homeassistant.components.mastodon
Mastodon.py==1.5.1

View File

@ -28,7 +28,7 @@ DoorBirdPy==2.1.0
HAP-python==4.7.1
# homeassistant.components.tasmota
HATasmota==0.7.1
HATasmota==0.7.2
# homeassistant.components.doods
# homeassistant.components.generic

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"

View File

@ -283,3 +283,35 @@ async def test_entity_id_update_discovery_update(
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, Platform.SWITCH, config
)
async def test_no_device_name(
hass: HomeAssistant, mqtt_mock: MqttMockHAClient, setup_tasmota
) -> None:
"""Test name of switches 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"] = "Relay 1"
config["fn"][0] = "Relay 1"
config["fn"][1] = "Relay 2"
config["rl"][0] = 1
config["rl"][1] = 1
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("switch.relay_1")
assert state is not None
assert state.attributes["friendly_name"] == "Relay 1"
state = hass.states.get("switch.relay_1_relay_2")
assert state is not None
assert state.attributes["friendly_name"] == "Relay 1 Relay 2"