cyr-ius / cozytouchpy

Cozytouch python implementation
GNU General Public License v3.0
13 stars 8 forks source link

When using 3.1 version, example.py is returning an issue #13

Open Li0nc0 opened 3 years ago

Li0nc0 commented 3 years ago

Hi,

Using 2.0.3 version for a while, I uninstalled this version to use the new 3.1, but when I want to try the "example.py", it does not work properly with this result:

$ python3 example.py 2021-09-20 15:16:27,384 - root - INFO - ### PLACES ### Traceback (most recent call last): File "example.py", line 98, in <module> loop.run_until_complete(async_demo()) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "example.py", line 65, in async_demo logger.info(place.id) AttributeError: 'str' object has no attribute 'id'

I uninstalled 3.1 and reinstalled 2.0.3, and the example.py is working fine with my cozytouch account set in example.py. Maybe something to change in example.py?

Great work, by the way. :)

AuroreVgn commented 3 years ago

Hi,

As the API groups together all the devices in an object named "devices" instead of exposing the categories water heater, heating, etc. in separate objects, you have to browse the object name "devices" as a table :

or id_device in setup.devices: print(device_info(setup.devices[id_device]))

Instead of :

for heater in setup.heaters: logger.info(heater.id) device_info(heater)

:-)