mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 10:47:51 +00:00
Fix Home Connect service validation error placeholders (#131294)
This commit is contained in:
parent
c61e94dac2
commit
53b87f47fb
@ -329,10 +329,10 @@ async def async_migrate_entry(
|
|||||||
|
|
||||||
def get_dict_from_home_connect_error(err: api.HomeConnectError) -> dict[str, Any]:
|
def get_dict_from_home_connect_error(err: api.HomeConnectError) -> dict[str, Any]:
|
||||||
"""Return a dict from a Home Connect error."""
|
"""Return a dict from a Home Connect error."""
|
||||||
return (
|
return {
|
||||||
err.args[0]
|
"description": cast(dict[str, Any], err.args[0]).get("description", "?")
|
||||||
if len(err.args) > 0 and isinstance(err.args[0], dict)
|
if len(err.args) > 0 and isinstance(err.args[0], dict)
|
||||||
else {"description": err.args[0]}
|
else err.args[0]
|
||||||
if len(err.args) > 0 and isinstance(err.args[0], str)
|
if len(err.args) > 0 and isinstance(err.args[0], str)
|
||||||
else {}
|
else "?",
|
||||||
)
|
}
|
||||||
|
@ -38,13 +38,13 @@
|
|||||||
"message": "Error while trying to set color of {entity_id}: {description}"
|
"message": "Error while trying to set color of {entity_id}: {description}"
|
||||||
},
|
},
|
||||||
"set_setting": {
|
"set_setting": {
|
||||||
"message": "Error while trying to assign the value \"{value}\" to the setting \"{key}\" for {entity_id}: {description}"
|
"message": "Error while trying to assign the value \"{value}\" to the setting \"{setting_key}\" for {entity_id}: {description}"
|
||||||
},
|
},
|
||||||
"turn_on": {
|
"turn_on": {
|
||||||
"message": "Error while trying to turn on {entity_id} ({key}): {description}"
|
"message": "Error while trying to turn on {entity_id} ({setting_key}): {description}"
|
||||||
},
|
},
|
||||||
"turn_off": {
|
"turn_off": {
|
||||||
"message": "Error while trying to turn off {entity_id} ({key}): {description}"
|
"message": "Error while trying to turn off {entity_id} ({setting_key}): {description}"
|
||||||
},
|
},
|
||||||
"start_program": {
|
"start_program": {
|
||||||
"message": "Error while trying to start program {program}: {description}"
|
"message": "Error while trying to start program {program}: {description}"
|
||||||
|
@ -162,7 +162,7 @@ async def test_switch_functionality(
|
|||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"Dishwasher",
|
"Dishwasher",
|
||||||
r"Error.*turn.*off.*appliance.*value",
|
r"Error.*turn.*off.*",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"switch.dishwasher_power",
|
"switch.dishwasher_power",
|
||||||
@ -170,7 +170,7 @@ async def test_switch_functionality(
|
|||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"Dishwasher",
|
"Dishwasher",
|
||||||
r"Error.*turn.*on.*appliance.*",
|
r"Error.*turn.*on.*",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"switch.dishwasher_child_lock",
|
"switch.dishwasher_child_lock",
|
||||||
@ -178,7 +178,7 @@ async def test_switch_functionality(
|
|||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"Dishwasher",
|
"Dishwasher",
|
||||||
r"Error.*turn.*on.*key.*",
|
r"Error.*turn.*on.*",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"switch.dishwasher_child_lock",
|
"switch.dishwasher_child_lock",
|
||||||
@ -186,7 +186,7 @@ async def test_switch_functionality(
|
|||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"Dishwasher",
|
"Dishwasher",
|
||||||
r"Error.*turn.*off.*key.*",
|
r"Error.*turn.*off.*",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
indirect=["problematic_appliance"],
|
indirect=["problematic_appliance"],
|
||||||
@ -297,7 +297,7 @@ async def test_ent_desc_switch_functionality(
|
|||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
r"Error.*turn.*on.*key.*",
|
r"Error.*turn.*on.*",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"switch.fridgefreezer_freezer_super_mode",
|
"switch.fridgefreezer_freezer_super_mode",
|
||||||
@ -305,7 +305,7 @@ async def test_ent_desc_switch_functionality(
|
|||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
"set_setting",
|
"set_setting",
|
||||||
"FridgeFreezer",
|
"FridgeFreezer",
|
||||||
r"Error.*turn.*off.*key.*",
|
r"Error.*turn.*off.*",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
indirect=["problematic_appliance"],
|
indirect=["problematic_appliance"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user