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

KeyError: "GroupedLight.owner of type <class 'aiohue.v2.models.resource.ResourceIdentifier'> is required." #1032

Closed
Ro4cHii opened this issue Jul 31, 2024 · 36 comments

Comments

@Ro4cHii
Copy link

Ro4cHii commented Jul 31, 2024

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Docker

Home Assistant related?

Yes

Description

Hello all,

today in the morning I noticed that my hue lights stopped working.
I updated diyHue to the newest version in hopes it would solve the problem but unfortunately it didn't.
The error remains the same after updating diyHue, deleting the Hue integration and readding diyHue bridge in HA.
I use watchtower to automatically update my HA docker container. Since 2024.7.4 has been released yesterday, it might be related to the update.

Logger: homeassistant.components.hue.bridge
Quelle: components/hue/bridge.py:78
Integration: Philips Hue (Dokumentation, Probleme)
Erstmals aufgetreten: 14:14:01 (1 Vorkommnisse)
Zuletzt protokolliert: 14:14:01

Unknown error connecting to Hue bridge
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 78, in async_initialize_bridge
    await self.api.initialize()
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 108, in initialize
    await self.fetch_full_state()
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 252, in fetch_full_state
    await asyncio.gather(
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 336, in initialize
    await resource_control.initialize(initial_data)
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 80, in initialize
    await self._handle_event(EventType.RESOURCE_ADDED, item)
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 209, in _handle_event
    raise exc
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 200, in _handle_event
    cur_item = self._items[item_id] = dataclass_from_dict(
                                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 202, in _parse_value
    raise KeyError(f"`{name}` of type `{value_type}` is required.")
KeyError: "`GroupedLight.owner` of type `<class 'aiohue.v2.models.resource.ResourceIdentifier'>` is required."

Errorlog:

diyhue.log

Steps to reproduce

Add diyHue bridge in the philips hue integration.

Please enter your operating system details here

Hue-Emulator Version: 2024-07-29 08:12:08.000000000 +0200
WebUI Version: 2024-07-27 21:16:38.000000000 +0200
Architecture: aarch64
OS: Linux
Linux version: #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023
Linux release: 6.1.21-v8+
Hardware: %Hardware%

Upload debug tar

config_debug.zip

What DiyHue version(branch) are you using?

master (latest)

@Ro4cHii Ro4cHii changed the title diyHue suddenly stopped working in Home Assistant KeyError: "GroupedLight.owner of type <class 'aiohue.v2.models.resource.ResourceIdentifier'> is required." Jul 31, 2024
@hendriksen-mark
Copy link
Member

hendriksen-mark commented Jul 31, 2024

Hi your groups.yaml file is empty.
Also you have debug logging disabled, to enable this you have to go to the config page of diyhue in HA and flip the debug switch.
I have no experience with aiohue.
All the logs in diyhue looks good, only tasmota is unreachable.
If you had groups configured you can look in the backup folder for the previous groups.yaml maybe that contains the previous info.

@ummetcivi
Copy link

Same for me. It started after latest Homeassistant update

@hendriksen-mark
Copy link
Member

update of home assistant or diyhue addon?

@ummetcivi
Copy link

Docker image of Homeassistant updated, I'm not sure if Hue addon or Homeassistant updated.

@Ro4cHii
Copy link
Author

Ro4cHii commented Jul 31, 2024

Hi your groups.yaml file is empty. Also you have debug logging disabled, to enable this you have to go to the config page of diyhue in HA and flip the debug switch. I have no experience with aiohue. All the logs in diyhue looks good, only tasmota is unreachable. If you had groups configured you can look in the backup folder for the previous groups.yaml maybe that contains the previous info.

As far as I know, I have never configured any groups. I use diyHue only for connecting my DIY lights (and original Hue lights via official hue bridge) to Home Assistant.

Im regards to aiohue: I don't even know what that is to be honest.

In regards to debug logging: I'll have to check tomorrow if I can switch it on and receive any more information out of it.

@hendriksen-mark
Copy link
Member

the logs you show in the description are not from diyhue but from aiohue.
the log from diyhue are in the file and on the addon page of diyhue.

@hendriksen-mark
Copy link
Member

hendriksen-mark commented Jul 31, 2024

found some interesting things about this.
please take a look an this.
home-assistant/core#66900
https://www.home-assistant.io/integrations/hue#lights-for-hue-zones-and-rooms

Home Assistant
Instructions on setting up Philips Hue within Home Assistant.

@Ro4cHii
Copy link
Author

Ro4cHii commented Jul 31, 2024

As said, I have no idea what aiohue is.
This is the error message that Home Assistant shows me when I try to add the diyHue bridge in the HA hue integration.

@hendriksen-mark
Copy link
Member

aiohue is used to connect to philips hue, is a component of HA.

@Ro4cHii
Copy link
Author

Ro4cHii commented Jul 31, 2024

found some interesting things about this. please take a look an this. home-assistant/core#66900 https://www.home-assistant.io/integrations/hue#lights-for-hue-zones-and-rooms

Home Assistant**Philips Hue**Instructions on setting up Philips Hue within Home Assistant.

I may have grouped some of my original hue lights in groups and zones back when I have not been using Home Assistant yet.
My diyHue lights however have never been grouped or anything.

Home Assistant
Instructions on setting up Philips Hue within Home Assistant.

@macfly92
Copy link

macfly92 commented Aug 2, 2024

Hi,
Same here after a HA docker upgrade to 2024.7.4.
I'm using groups and my groups.yaml isn't empty.

2024-08-02 11:57:16.368 DEBUG (MainThread) [aiohue.v2[192.168.1.101].bridge] fetched 1 items 2024-08-02 11:57:16.369 DEBUG (MainThread) [aiohue.v2[192.168.1.101].bridge_home] fetched 1 items 2024-08-02 11:57:16.369 DEBUG (MainThread) [aiohue.v2[192.168.1.101].entertainment] fetched 54 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].entertainment_configuration] fetched 0 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].homekit] fetched 1 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].matter] fetched 0 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].matter_fabric] fetched 0 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].behavior_script] fetched 8 items 2024-08-02 11:57:16.372 DEBUG (MainThread) [aiohue.v2[192.168.1.101].behavior_instance] fetched 0 items 2024-08-02 11:57:16.373 DEBUG (MainThread) [aiohue.v2[192.168.1.101].device] fetched 57 items 2024-08-02 11:57:16.377 DEBUG (MainThread) [aiohue.v2[192.168.1.101].light] fetched 53 items 2024-08-02 11:57:16.384 DEBUG (MainThread) [aiohue.v2[192.168.1.101].scene] fetched 10 items 2024-08-02 11:57:16.387 DEBUG (MainThread) [aiohue.v2[192.168.1.101].smart_scene] fetched 0 items 2024-08-02 11:57:16.387 DEBUG (MainThread) [aiohue.v2[192.168.1.101].button] fetched 8 items 2024-08-02 11:57:16.387 DEBUG (MainThread) [aiohue.v2[192.168.1.101].camera_motion] fetched 0 items 2024-08-02 11:57:16.387 DEBUG (MainThread) [aiohue.v2[192.168.1.101].contact] fetched 0 items 2024-08-02 11:57:16.387 DEBUG (MainThread) [aiohue.v2[192.168.1.101].device_power] fetched 13 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].geofence_client] fetched 1 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].light_level] fetched 0 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].motion] fetched 1 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].relative_rotary] fetched 0 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].tamper] fetched 0 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].temperature] fetched 0 items 2024-08-02 11:57:16.388 DEBUG (MainThread) [aiohue.v2[192.168.1.101].zigbee_connectivity] fetched 65 items 2024-08-02 11:57:16.390 DEBUG (MainThread) [aiohue.v2[192.168.1.101].room] fetched 0 items 2024-08-02 11:57:16.390 DEBUG (MainThread) [aiohue.v2[192.168.1.101].zone] fetched 2 items 2024-08-02 11:57:16.390 DEBUG (MainThread) [aiohue.v2[192.168.1.101].grouped_light] fetched 3 items 2024-08-02 11:57:16.390 ERROR (MainThread) [homeassistant.components.hue.bridge] Unknown error connecting to Hue bridge Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 78, in async_initialize_bridge await self.api.initialize() File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 108, in initialize await self.fetch_full_state() File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 252, in fetch_full_state await asyncio.gather( File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 336, in initialize await resource_control.initialize(initial_data) File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 80, in initialize await self._handle_event(EventType.RESOURCE_ADDED, item) File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 209, in _handle_event raise exc File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 200, in _handle_event cur_item = self._items[item_id] = dataclass_from_dict( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict field.name: _parse_value( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 202, in _parse_value raise KeyError(f"{name}of type{value_type} is required.") KeyError: "GroupedLight.ownerof type<class 'aiohue.v2.models.resource.ResourceIdentifier'> is required."

@hendriksen-mark
Copy link
Member

I have to look into this, this takes some time because i need to see if i can replicate this issue and see what aiohue is missing.

@hendriksen-mark
Copy link
Member

hendriksen-mark commented Aug 2, 2024

It has something to do with this.
home-assistant-libs/aiohue@eff93f3
The grouped_lights.py

@hendriksen-mark
Copy link
Member

I think I know what to do, whem im home I will make the changes.

@macfly92
Copy link

macfly92 commented Aug 2, 2024

thanks a lot to have a look into this !

@hendriksen-mark
Copy link
Member

it should be fixed now.
Please check if everything works and give feedback.

@ummetcivi
Copy link

It works, thanks!

@hendriksen-mark
Copy link
Member

thank you for the fast feedback.
if @Ro4cHii with his empty groups.yaml also does not have the error this issue can be closed.

@Ro4cHii
Copy link
Author

Ro4cHii commented Aug 2, 2024

Sorry, I didn't understand before that you were talking about Home Assistant groups.
Indeed, I have one entry in my groups.yaml but it is completely unrelated to diyhue.

The fix is also working for me. Thank you so much for fixing it so quickly!

Feel free to close the issue. In case you want me to test it with a completely empty groups.yaml first to be sure, I can do it, but only sometime on Sunday. Just let me know.

Cheers!

@hendriksen-mark
Copy link
Member

hendriksen-mark commented Aug 2, 2024

the groups.yaml i was talking about is the one from diyhue, so if you have rooms/zones in the hue app it will be in there and also visible on the webui.
if HA also have a groups.yaml this is separate from the diyhue one.

@Ro4cHii
Copy link
Author

Ro4cHii commented Aug 2, 2024

Okay I see, sorry for the confusion.
Indeed, I don't have any groups in diyhue. So it's also working in this scenario.

Thanks again! :)

@Ro4cHii Ro4cHii closed this as completed Aug 2, 2024
@macfly92
Copy link

macfly92 commented Aug 2, 2024

Same here, works like a charm. Merci beaucoup !

@csprocket777
Copy link

I’m confused. I’m running into this right now. What was the solution?

@hendriksen-mark
Copy link
Member

Hi, what version of diyhue are running?

@csprocket777
Copy link

csprocket777 commented Aug 28, 2024 via email

@hendriksen-mark
Copy link
Member

When im home i will check this, can you share the logs from HA and the config_debuf.tar from diyhue

@csprocket777
Copy link

I'm not sure how to get at the config_debuf.tar file from diyhue, I'm running it in a container using portainer.

Here is the contents of the log from HomeAssistant for this:

Logger: homeassistant.components.hue.bridge
Source: components/hue/bridge.py:78
integration: Philips Hue (documentation, issues)
First occurred: August 27, 2024 at 8:35:20 PM (2 occurrences)
Last logged: August 27, 2024 at 8:35:20 PM

Unknown error connecting to Hue bridge
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 78, in async_initialize_bridge
    await self.api.initialize()
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 108, in initialize
    await self.fetch_full_state()
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/__init__.py", line 252, in fetch_full_state
    await asyncio.gather(
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 336, in initialize
    await resource_control.initialize(initial_data)
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 80, in initialize
    await self._handle_event(EventType.RESOURCE_ADDED, item)
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 209, in _handle_event
    raise exc
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 200, in _handle_event
    cur_item = self._items[item_id] = dataclass_from_dict(
                                      ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 244, in dataclass_from_dict
    field.name: _parse_value(
                ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohue/util.py", line 202, in _parse_value
    raise KeyError(f"`{name}` of type `{value_type}` is required.")
KeyError: "`GroupedLight.owner` of type `<class 'aiohue.v2.models.resource.ResourceIdentifier'>` is required."

@hendriksen-mark
Copy link
Member

You can find the config_debuf.tar on the webui of diyhue under diyhue>bridge>bridge control>full debug

@csprocket777
Copy link

config_debug.zip

Had to recompress it to zip because github doesn't like tar files.

@hendriksen-mark
Copy link
Member

you do not have the latest diyhue version, your version is from 2024-07-29 and the newest is from 2024-08-16
the fix for this in implemented in the version of 2024-08-10
please update/rebuild diyhue in HA

@csprocket777
Copy link

Ahhh I see. I just recreated (re-pulling) the container for DiyHue and it magically worked. :) Thanks.

@hendriksen-mark
Copy link
Member

ow sorry then i misinterpreting that part of HA.
still you have a old version of diyhue and need to update diyhue

@jaspervanisterdael
Copy link

jaspervanisterdael commented Sep 2, 2024

I'm running version 2.0.15. The problem still occurs at my side when I add entertainment area's to the DiyHue hub.

Difference in Group.yaml. The groups labeled as "Entertainment" dont have a owner. I tried adding an owner manually, but the owner row disappears after a restart:

  id_v2: xx
  name: Living room
  class: Other
  lights:
  - '1'
  - '4'
  - '5'
  - '7'
  - '6'
  - '23'
  - '2'
  - '13'
  - '21'
  - '22'
  - '1'
  - '4'
  - '5'
  - '7'
  - '6'
  - '13'
  - '2'
  - '23'
  - '22'
  - '21'
  action:
    'on': false
    bri: 100
    hue: 0
    sat: 254
    effect: none
    xy:
    - 0.0
    - 0.0
    ct: 153
    alert: none
    colormode: xy
  type: Zone
  owner: xx
'11':
  id_v2: xx
  name: Gaming desk
  configuration_type: monitor
  lights:
  - '8'
  - '9'
  - '10'
  action:
    'on': false
    bri: 100
    hue: 0
    sat: 254
    effect: none
    xy:
    - 0.0
    - 0.0
    ct: 153
    alert: none
    colormode: xy
  type: Entertainment
  locations:
    '8':
    - x: -0.01532066471653426
      y: 0.0902390012459866
      z: 1.0
    '9':
    - x: 0.04292484592501555
      y: -0.11525788469625597
      z: 1.0
    '10':
    - x: 0.06180010137764591
      y: -0.07344790793926337
      z: 1.0```

@hendriksen-mark
Copy link
Member

hendriksen-mark commented Sep 2, 2024

Hi, i will test this when im home. I see now that the owner is specified in the apiv2. If you add this to the groups.yaml it will not be used because it is not yet in diyhue. Also if you add it and then restart with save it is overwritten. If you want to edit the config files shutdown diyhue and then edit the files and start diyhue. When im home I will change this.

hendriksen-mark added a commit that referenced this issue Sep 2, 2024
Remove unused import
Add .000 to lastupdate
Add diyhue info to apiV2 response
Update apiV2 response
Fix grouped.light error for entertainment #1032
Update openwrt install
@hendriksen-mark
Copy link
Member

I made a update, please update and give feedback

@jaspervanisterdael
Copy link

After updating and rebuilding, it is now working. Thank you for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants