mirror of
https://github.com/home-assistant/core.git
synced 2025-04-30 20:27:57 +00:00
Bump hatasmota to 0.1.2 (#43719)
This commit is contained in:
parent
a4ae2d210e
commit
5d7d2dee2a
@ -92,7 +92,6 @@ class TasmotaLight(
|
|||||||
|
|
||||||
if light_type != LIGHT_TYPE_NONE:
|
if light_type != LIGHT_TYPE_NONE:
|
||||||
supported_features |= SUPPORT_BRIGHTNESS
|
supported_features |= SUPPORT_BRIGHTNESS
|
||||||
supported_features |= SUPPORT_TRANSITION
|
|
||||||
|
|
||||||
if light_type in [LIGHT_TYPE_COLDWARM, LIGHT_TYPE_RGBCW]:
|
if light_type in [LIGHT_TYPE_COLDWARM, LIGHT_TYPE_RGBCW]:
|
||||||
supported_features |= SUPPORT_COLOR_TEMP
|
supported_features |= SUPPORT_COLOR_TEMP
|
||||||
@ -104,6 +103,9 @@ class TasmotaLight(
|
|||||||
if light_type in [LIGHT_TYPE_RGBW, LIGHT_TYPE_RGBCW]:
|
if light_type in [LIGHT_TYPE_RGBW, LIGHT_TYPE_RGBCW]:
|
||||||
supported_features |= SUPPORT_WHITE_VALUE
|
supported_features |= SUPPORT_WHITE_VALUE
|
||||||
|
|
||||||
|
if self._tasmota_entity.supports_transition:
|
||||||
|
supported_features |= SUPPORT_TRANSITION
|
||||||
|
|
||||||
self._supported_features = supported_features
|
self._supported_features = supported_features
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -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.1.1"],
|
"requirements": ["hatasmota==0.1.2"],
|
||||||
"dependencies": ["mqtt"],
|
"dependencies": ["mqtt"],
|
||||||
"mqtt": ["tasmota/discovery/#"],
|
"mqtt": ["tasmota/discovery/#"],
|
||||||
"codeowners": ["@emontnemery"]
|
"codeowners": ["@emontnemery"]
|
||||||
|
@ -738,7 +738,7 @@ hass-nabucasa==0.38.0
|
|||||||
hass_splunk==0.1.1
|
hass_splunk==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.1.1
|
hatasmota==0.1.2
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
|
@ -376,7 +376,7 @@ hangups==0.4.11
|
|||||||
hass-nabucasa==0.38.0
|
hass-nabucasa==0.38.0
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.1.1
|
hatasmota==0.1.2
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
|
@ -62,6 +62,30 @@ async def test_attributes_on_off(hass, mqtt_mock, setup_tasmota):
|
|||||||
assert state.attributes.get("supported_features") == 0
|
assert state.attributes.get("supported_features") == 0
|
||||||
|
|
||||||
|
|
||||||
|
async def test_attributes_dimmer_tuya(hass, mqtt_mock, setup_tasmota):
|
||||||
|
"""Test state update via MQTT."""
|
||||||
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
|
config["rl"][0] = 2
|
||||||
|
config["lt_st"] = 1 # 1 channel light (dimmer)
|
||||||
|
config["ty"] = 1 # Tuya device
|
||||||
|
mac = config["mac"]
|
||||||
|
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass,
|
||||||
|
f"{DEFAULT_PREFIX}/{mac}/config",
|
||||||
|
json.dumps(config),
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/STATE", '{"POWER":"ON"}')
|
||||||
|
|
||||||
|
state = hass.states.get("light.test")
|
||||||
|
assert state.attributes.get("effect_list") is None
|
||||||
|
assert state.attributes.get("min_mireds") is None
|
||||||
|
assert state.attributes.get("max_mireds") is None
|
||||||
|
assert state.attributes.get("supported_features") == SUPPORT_BRIGHTNESS
|
||||||
|
|
||||||
|
|
||||||
async def test_attributes_dimmer(hass, mqtt_mock, setup_tasmota):
|
async def test_attributes_dimmer(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)
|
||||||
@ -509,6 +533,53 @@ async def test_sending_mqtt_commands_on_off(hass, mqtt_mock, setup_tasmota):
|
|||||||
mqtt_mock.async_publish.reset_mock()
|
mqtt_mock.async_publish.reset_mock()
|
||||||
|
|
||||||
|
|
||||||
|
async def test_sending_mqtt_commands_rgbww_tuya(hass, mqtt_mock, setup_tasmota):
|
||||||
|
"""Test the sending MQTT commands."""
|
||||||
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
|
config["rl"][0] = 2
|
||||||
|
config["lt_st"] = 5 # 5 channel light (RGBCW)
|
||||||
|
config["ty"] = 1 # Tuya device
|
||||||
|
mac = config["mac"]
|
||||||
|
|
||||||
|
async_fire_mqtt_message(
|
||||||
|
hass,
|
||||||
|
f"{DEFAULT_PREFIX}/{mac}/config",
|
||||||
|
json.dumps(config),
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
|
state = hass.states.get("light.test")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
mqtt_mock.async_publish.reset_mock()
|
||||||
|
|
||||||
|
# Turn the light on and verify MQTT message is sent
|
||||||
|
await common.async_turn_on(hass, "light.test")
|
||||||
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
|
"tasmota_49A3BC/cmnd/Backlog", "NoDelay;Power1 ON", 0, False
|
||||||
|
)
|
||||||
|
mqtt_mock.async_publish.reset_mock()
|
||||||
|
|
||||||
|
# Tasmota is not optimistic, the state should still be off
|
||||||
|
state = hass.states.get("light.test")
|
||||||
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
# Turn the light off and verify MQTT message is sent
|
||||||
|
await common.async_turn_off(hass, "light.test")
|
||||||
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
|
"tasmota_49A3BC/cmnd/Backlog", "NoDelay;Power1 OFF", 0, False
|
||||||
|
)
|
||||||
|
mqtt_mock.async_publish.reset_mock()
|
||||||
|
|
||||||
|
# Turn the light on and verify MQTT messages are sent
|
||||||
|
await common.async_turn_on(hass, "light.test", brightness=192)
|
||||||
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
|
"tasmota_49A3BC/cmnd/Backlog", "NoDelay;Dimmer3 75", 0, False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_sending_mqtt_commands_rgbww(hass, mqtt_mock, setup_tasmota):
|
async def test_sending_mqtt_commands_rgbww(hass, mqtt_mock, setup_tasmota):
|
||||||
"""Test the sending MQTT commands."""
|
"""Test the sending MQTT commands."""
|
||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user