Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulated hue error since 2023.11.x unable to control via harmony hub #104013

Closed
dshokouhi opened this issue Nov 15, 2023 · 4 comments · Fixed by #104020
Closed

Emulated hue error since 2023.11.x unable to control via harmony hub #104013

dshokouhi opened this issue Nov 15, 2023 · 4 comments · Fixed by #104020

Comments

@dshokouhi
Copy link
Member

The problem

After updating to HA core 2023.11.x I am unable to control my emulated hue devices via the harmony hub. Even if I attempt to refresh the device list in the harmony app the process fails and says it was not able to retrieve the devices.

When attempting to troubleshoot I noticed that http://192.168.1.48:8300/api/v2/lights gives a 500 error for me and I am not sure where to begin troubleshooting that.

Ths was working fine in 2023.10 and older versions

What version of Home Assistant Core has the issue?

2023.11.x

What was the last working version of Home Assistant Core?

2023.10.x

What type of installation are you running?

Home Assistant Core

Integration causing the issue

emulated_hue

Link to integration documentation on our website

https://www.home-assistant.io/integrations/emulated_hue/

Diagnostics information

n/a

Example YAML snippet

emulated_hue:
  exposed_domains:
  - switch
  - light

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /srv/homeassistant3.11/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: November 10, 2023 at 9:54:33 AM (7858 occurrences)
Last logged: 8:27:35 PM

Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/http/view.py", line 150, in handle
    result = handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 238, in get
    return self.json(create_list_of_entities(self.config, request))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 876, in create_list_of_entities
    json_response[config.entity_id_to_number(entity_id)] = state_to_json(
                                                           ^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 761, in state_to_json
    state_dict = get_entity_state_dict(config, state)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 655, in get_entity_state_dict
    return _build_entity_state_dict(entity)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 687, in _build_entity_state_dict
    data[STATE_BRIGHTNESS] = hass_to_hue_brightness(
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/emulated_hue/hue_api.py", line 890, in hass_to_hue_brightness
    return max(1, round((value / 255) * HUE_API_STATE_BRI_MAX))
                         ~~~~~~^~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

Additional information

When I get the 500 error from the API URL I see this error generate. This error has generated thousands of times as well.

@home-assistant
Copy link

Hey there @bdraco, @Tho85, mind taking a look at this issue as it has been labeled with an integration (emulated_hue) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of emulated_hue can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign emulated_hue Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


emulated_hue documentation
emulated_hue source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Nov 15, 2023

Thanks for the trace.

Its likely the light platform changes that we had to fix for HomeKit as well

@bdraco
Copy link
Member

bdraco commented Nov 15, 2023

The fix for homekit was #102290

@bdraco
Copy link
Member

bdraco commented Nov 15, 2023

The change that likely introduced this issue #101946

bdraco added a commit that referenced this issue Nov 15, 2023
regressed from #101946

fixes #104013
likely fixes #103538 (but nobody in that issue provided logs)
bdraco added a commit that referenced this issue Nov 15, 2023
regressed from #101946

fixes #104013
likely fixes #103538 (but nobody in that issue provided logs)
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants