mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Bump hatasmota to 0.0.31 (#43319)
This commit is contained in:
parent
b358103b58
commit
14aba1f9de
@ -3,7 +3,7 @@
|
|||||||
"name": "Tasmota (beta)",
|
"name": "Tasmota (beta)",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/tasmota",
|
"documentation": "https://www.home-assistant.io/integrations/tasmota",
|
||||||
"requirements": ["hatasmota==0.0.30"],
|
"requirements": ["hatasmota==0.0.31"],
|
||||||
"dependencies": ["mqtt"],
|
"dependencies": ["mqtt"],
|
||||||
"mqtt": ["tasmota/discovery/#"],
|
"mqtt": ["tasmota/discovery/#"],
|
||||||
"codeowners": ["@emontnemery"]
|
"codeowners": ["@emontnemery"]
|
||||||
|
@ -741,7 +741,7 @@ hass-nabucasa==0.38.0
|
|||||||
hass_splunk==0.1.1
|
hass_splunk==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.0.30
|
hatasmota==0.0.31
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
|
@ -379,7 +379,7 @@ hangups==0.4.11
|
|||||||
hass-nabucasa==0.38.0
|
hass-nabucasa==0.38.0
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.0.30
|
hatasmota==0.0.31
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
|
@ -51,12 +51,12 @@ async def test_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -64,35 +64,94 @@ async def test_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"OFF"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"OFF"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
# Test periodic state update
|
# Test periodic state update
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"ON"}')
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"ON"}')
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"OFF"}')
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"OFF"}')
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
# Test polled state update
|
# Test polled state update
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"ON"}}'
|
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"ON"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"OFF"}}'
|
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"OFF"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
|
async def test_controlling_state_via_mqtt_switchname(hass, mqtt_mock, setup_tasmota):
|
||||||
|
"""Test state update via MQTT."""
|
||||||
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Custom Name"
|
||||||
|
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("binary_sensor.custom_name")
|
||||||
|
assert state.state == "unavailable"
|
||||||
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
|
# Test normal state update
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Custom Name":{"Action":"ON"}}'
|
||||||
|
)
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Custom Name":{"Action":"OFF"}}'
|
||||||
|
)
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
# Test periodic state update
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Custom Name":"ON"}')
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Custom Name":"OFF"}')
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
# Test polled state update
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Custom Name":"ON"}}'
|
||||||
|
)
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Custom Name":"OFF"}}'
|
||||||
|
)
|
||||||
|
state = hass.states.get("binary_sensor.custom_name")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
@ -109,12 +168,12 @@ async def test_pushon_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota)
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -122,34 +181,34 @@ async def test_pushon_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota)
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"OFF"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"OFF"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
# Test periodic state update is ignored
|
# Test periodic state update is ignored
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"ON"}')
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/SENSOR", '{"Switch1":"ON"}')
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
# Test polled state update is ignored
|
# Test polled state update is ignored
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"ON"}}'
|
hass, "tasmota_49A3BC/stat/STATUS10", '{"StatusSNS":{"Switch1":"ON"}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
async def test_friendly_names(hass, mqtt_mock, setup_tasmota):
|
async def test_friendly_names(hass, mqtt_mock, setup_tasmota):
|
||||||
"""Test state update via MQTT."""
|
"""Test state update via MQTT."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["rl"][0] = 1
|
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
config["swc"][1] = 1
|
config["swc"][1] = 1
|
||||||
|
config["swn"][1] = "Beer"
|
||||||
mac = config["mac"]
|
mac = config["mac"]
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
@ -197,7 +256,7 @@ async def test_off_delay(hass, mqtt_mock, setup_tasmota):
|
|||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
assert events == ["off", "on"]
|
assert events == ["off", "on"]
|
||||||
|
|
||||||
@ -205,13 +264,13 @@ async def test_off_delay(hass, mqtt_mock, setup_tasmota):
|
|||||||
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
hass, "tasmota_49A3BC/stat/RESULT", '{"Switch1":{"Action":"ON"}}'
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
assert events == ["off", "on", "on"]
|
assert events == ["off", "on", "on"]
|
||||||
|
|
||||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=1))
|
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=1))
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
state = hass.states.get("binary_sensor.test")
|
state = hass.states.get("binary_sensor.tasmota_binary_sensor_1")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
assert events == ["off", "on", "on", "off"]
|
assert events == ["off", "on", "on", "off"]
|
||||||
|
|
||||||
@ -222,6 +281,7 @@ async def test_availability_when_connection_lost(
|
|||||||
"""Test availability after MQTT disconnection."""
|
"""Test availability after MQTT disconnection."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
await help_test_availability_when_connection_lost(
|
await help_test_availability_when_connection_lost(
|
||||||
hass, mqtt_client_mock, mqtt_mock, binary_sensor.DOMAIN, config
|
hass, mqtt_client_mock, mqtt_mock, binary_sensor.DOMAIN, config
|
||||||
)
|
)
|
||||||
@ -231,6 +291,7 @@ async def test_availability(hass, mqtt_mock, setup_tasmota):
|
|||||||
"""Test availability."""
|
"""Test availability."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
await help_test_availability(hass, mqtt_mock, binary_sensor.DOMAIN, config)
|
await help_test_availability(hass, mqtt_mock, binary_sensor.DOMAIN, config)
|
||||||
|
|
||||||
|
|
||||||
@ -238,6 +299,7 @@ async def test_availability_discovery_update(hass, mqtt_mock, setup_tasmota):
|
|||||||
"""Test availability discovery update."""
|
"""Test availability discovery update."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
await help_test_availability_discovery_update(
|
await help_test_availability_discovery_update(
|
||||||
hass, mqtt_mock, binary_sensor.DOMAIN, config
|
hass, mqtt_mock, binary_sensor.DOMAIN, config
|
||||||
)
|
)
|
||||||
@ -249,6 +311,7 @@ async def test_availability_poll_state(
|
|||||||
"""Test polling after MQTT connection (re)established."""
|
"""Test polling after MQTT connection (re)established."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
poll_topic = "tasmota_49A3BC/cmnd/STATUS"
|
poll_topic = "tasmota_49A3BC/cmnd/STATUS"
|
||||||
await help_test_availability_poll_state(
|
await help_test_availability_poll_state(
|
||||||
hass,
|
hass,
|
||||||
@ -267,6 +330,8 @@ async def test_discovery_removal_binary_sensor(hass, mqtt_mock, caplog, setup_ta
|
|||||||
config2 = copy.deepcopy(DEFAULT_CONFIG)
|
config2 = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config1["swc"][0] = 1
|
config1["swc"][0] = 1
|
||||||
config2["swc"][0] = 0
|
config2["swc"][0] = 0
|
||||||
|
config1["swn"][0] = "Test"
|
||||||
|
config2["swn"][0] = "Test"
|
||||||
|
|
||||||
await help_test_discovery_removal(
|
await help_test_discovery_removal(
|
||||||
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, config1, config2
|
hass, mqtt_mock, caplog, binary_sensor.DOMAIN, config1, config2
|
||||||
@ -279,6 +344,7 @@ async def test_discovery_update_unchanged_binary_sensor(
|
|||||||
"""Test update of discovered binary_sensor."""
|
"""Test update of discovered binary_sensor."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.tasmota.binary_sensor.TasmotaBinarySensor.discovery_update"
|
"homeassistant.components.tasmota.binary_sensor.TasmotaBinarySensor.discovery_update"
|
||||||
) as discovery_update:
|
) as discovery_update:
|
||||||
@ -301,6 +367,7 @@ async def test_entity_id_update_subscriptions(hass, mqtt_mock, setup_tasmota):
|
|||||||
"""Test MQTT subscriptions are managed when entity_id is updated."""
|
"""Test MQTT subscriptions are managed when entity_id is updated."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
topics = [
|
topics = [
|
||||||
get_topic_stat_result(config),
|
get_topic_stat_result(config),
|
||||||
get_topic_tele_sensor(config),
|
get_topic_tele_sensor(config),
|
||||||
@ -316,6 +383,7 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock, setup_tasmota)
|
|||||||
"""Test MQTT discovery update when entity_id is updated."""
|
"""Test MQTT discovery update when entity_id is updated."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
config["swc"][0] = 1
|
config["swc"][0] = 1
|
||||||
|
config["swn"][0] = "Test"
|
||||||
await help_test_entity_id_update_discovery_update(
|
await help_test_entity_id_update_discovery_update(
|
||||||
hass, mqtt_mock, binary_sensor.DOMAIN, config
|
hass, mqtt_mock, binary_sensor.DOMAIN, config
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user