mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 04:35:11 +02:00
Bump hatasmota to 0.2.5 (#45297)
This commit is contained in:
@@ -1059,6 +1059,69 @@ async def test_transition(hass, mqtt_mock, setup_tasmota):
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
|
||||
async def test_transition_fixed(hass, mqtt_mock, setup_tasmota):
|
||||
"""Test transition commands."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
config["rl"][0] = 2
|
||||
config["lt_st"] = 5 # 5 channel light (RGBCW)
|
||||
config["so"]["117"] = 1 # fading at fixed duration instead of fixed slew rate
|
||||
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()
|
||||
|
||||
# Dim the light from 0->100: Speed should be 4*2=8
|
||||
await common.async_turn_on(hass, "light.test", brightness=255, transition=4)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"tasmota_49A3BC/cmnd/Backlog",
|
||||
"NoDelay;Fade 1;NoDelay;Speed 8;NoDelay;Dimmer 100",
|
||||
0,
|
||||
False,
|
||||
)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Dim the light from 0->100: Speed should be capped at 40
|
||||
await common.async_turn_on(hass, "light.test", brightness=255, transition=100)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"tasmota_49A3BC/cmnd/Backlog",
|
||||
"NoDelay;Fade 1;NoDelay;Speed 40;NoDelay;Dimmer 100",
|
||||
0,
|
||||
False,
|
||||
)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Dim the light from 0->0: Speed should be 4*2=8
|
||||
await common.async_turn_on(hass, "light.test", brightness=0, transition=4)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"tasmota_49A3BC/cmnd/Backlog",
|
||||
"NoDelay;Fade 1;NoDelay;Speed 8;NoDelay;Power1 OFF",
|
||||
0,
|
||||
False,
|
||||
)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Dim the light from 0->50: Speed should be 4*2=8
|
||||
await common.async_turn_on(hass, "light.test", brightness=128, transition=4)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"tasmota_49A3BC/cmnd/Backlog",
|
||||
"NoDelay;Fade 1;NoDelay;Speed 8;NoDelay;Dimmer 50",
|
||||
0,
|
||||
False,
|
||||
)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
|
||||
async def test_relay_as_light(hass, mqtt_mock, setup_tasmota):
|
||||
"""Test relay show up as light in light mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
|
Reference in New Issue
Block a user