Improve warnings in mqtt light messages (#89552)

* improved warnings in mqtt light messages.

* fixed tests.
This commit is contained in:
anotherthomas 2023-03-13 14:46:16 +01:00 committed by GitHub
parent 3637d787cf
commit 179cc4d7f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 10 deletions

View file

@ -616,14 +616,17 @@ async def test_controlling_state_via_topic2(
async_fire_mqtt_message(
hass, "test_light_rgb", '{"state":"ON", "color_mode":"col_temp"}'
)
assert "Invalid color mode received" in caplog.text
assert "Invalid color mode 'col_temp' received" in caplog.text
caplog.clear()
# Incomplete color
async_fire_mqtt_message(
hass, "test_light_rgb", '{"state":"ON", "color_mode":"rgb"}'
)
assert "Invalid or incomplete color value received" in caplog.text
assert (
"Invalid or incomplete color value '{'state': 'ON', 'color_mode': 'rgb'}' received"
in caplog.text
)
caplog.clear()
# Invalid color
@ -632,7 +635,10 @@ async def test_controlling_state_via_topic2(
"test_light_rgb",
'{"state":"ON", "color_mode":"rgb", "color":{"r":64,"g":128,"b":"cow"}}',
)
assert "Invalid or incomplete color value received" in caplog.text
assert (
"Invalid or incomplete color value '{'state': 'ON', 'color_mode': 'rgb', 'color': {'r': 64, 'g': 128, 'b': 'cow'}}' received"
in caplog.text
)
async def test_sending_mqtt_commands_and_optimistic(