Return emulated hue id for update requests (#35139)
* Return emulated hue id for update requests * Emulated Hue: Rename function argument to match its content * Use HTTP status consts throughout the test * Use HTTP status consts in UPnP test
This commit is contained in:
parent
7e36699aac
commit
e4e89becc6
3 changed files with 98 additions and 57 deletions
|
@ -506,7 +506,9 @@ class HueOneLightChangeView(HomeAssistantView):
|
|||
|
||||
# Create success responses for all received keys
|
||||
json_response = [
|
||||
create_hue_success_response(entity_id, HUE_API_STATE_ON, parsed[STATE_ON])
|
||||
create_hue_success_response(
|
||||
entity_number, HUE_API_STATE_ON, parsed[STATE_ON]
|
||||
)
|
||||
]
|
||||
|
||||
for (key, val) in (
|
||||
|
@ -517,7 +519,7 @@ class HueOneLightChangeView(HomeAssistantView):
|
|||
):
|
||||
if parsed[key] is not None:
|
||||
json_response.append(
|
||||
create_hue_success_response(entity_id, val, parsed[key])
|
||||
create_hue_success_response(entity_number, val, parsed[key])
|
||||
)
|
||||
|
||||
return self.json(json_response)
|
||||
|
@ -710,9 +712,9 @@ def entity_to_json(config, entity):
|
|||
return retval
|
||||
|
||||
|
||||
def create_hue_success_response(entity_id, attr, value):
|
||||
def create_hue_success_response(entity_number, attr, value):
|
||||
"""Create a success response for an attribute set on a light."""
|
||||
success_key = f"/lights/{entity_id}/state/{attr}"
|
||||
success_key = f"/lights/{entity_number}/state/{attr}"
|
||||
return {"success": {success_key: value}}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue