Leggin / dirigera

This repository provides an unofficial Python client for controlling the IKEA Dirigera Smart Home Hub.
MIT License
119 stars 23 forks source link

AttributeError #91

Closed danielvand closed 2 months ago

danielvand commented 2 months ago

Hi, I'm running in circles after I had to recover my system from a crash from the main drive. I was able to control the lights nicely via dirigera. But now I get the following error after running a simple script to check the state of my lamps

Traceback (most recent call last): File "getLights.py", line 20, in print(lamp.is_on) File "/usr/local/lib/python3.7/dist-packages/pydantic/main.py", line 761, in getattr raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}') AttributeError: 'Light' object has no attribute 'is_on'

My script: getLights.py

Probably / hopefully something simple. I've tried to reinstall python3 and dirigera, but same result. I'm running Python 3.7.3, that's still supported as far as I understand?

Thanks for you help!

danielvand commented 2 months ago

I could reproduce the problem on another system with Python 3.9.2

When I try to get a list of attributes it will only give me default attributes of a list object.

for i in lights.getmembers(lights): # Ignores anything starting with underscore # (that is, private and protected attributes) if not i[0].startswith('_'): # Ignores methods if not inspect.ismethod(i[1]): print(i)

danielvand commented 2 months ago

I had to add ".attributes." to the code:

if lamp.attributes.light_level and lamp.attributes.is_on:

danielvand commented 2 months ago

see last comment