Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump hatasmota to 0.7.2 #100129

Merged
merged 1 commit into from Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/tasmota/manifest.json
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_push",
"loggers": ["hatasmota"],
"mqtt": ["tasmota/discovery/#"],
"requirements": ["HATasmota==0.7.1"]
"requirements": ["HATasmota==0.7.2"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions tests/components/tasmota/test_light.py
Expand Up @@ -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"
32 changes: 32 additions & 0 deletions tests/components/tasmota/test_switch.py
Expand Up @@ -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"