milanmeu / pyrituals

Async Python wrapper for the Rituals Perfume Genie API
https://pypi.org/project/pyrituals/
Other
6 stars 0 forks source link

KeyError: 'fanc' when using diffuser.is_on #2

Open smitec11 opened 2 years ago

smitec11 commented 2 years ago

Milan,

can you check this,

diffuser.is_on is giving error :

traceback (most recent call last): File "/home/pi/scripts/genie.py", line 33, in run(main()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/pi/scripts/genie.py", line 28, in main print(f'stat: : {diffuser.is_on}') File "/home/pi/.local/lib/python3.9/site-packages/pyrituals/init.py", line 71, in is_on return self.hub_data["attributes"]["fanc"] == "1" KeyError: 'fanc'

when i use the example, and add the 'diffuser.is_on'

(diffuser.perfume_amount is also not working)

i am using python3.9 on rpi4 bullseye

regards, Chris

milanmeu commented 2 years ago

Hi @smitec11, sorry for my late response.

Please see https://github.com/milanmeu/pyrituals#diffuser-data:

Some properties require data that is only available after executing update_data().