rene-d / netatmo

Python3 API for the Netatmo Weather Station
The Unlicense
36 stars 18 forks source link

Python error with list, fetch, and dump #1

Closed LindyM closed 6 years ago

LindyM commented 6 years ago

Any idea why I'm getting the error KeyError: 'module_name' when running options that retrieve data?

Details: $ python3 --version Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

RHEL 6.9.

Example: $ ./netatmo.py list 1 station 70:ee:50:00:00:00 My_Station Traceback (most recent call last): File "./netatmo.py", line 754, in main() File "./netatmo.py", line 742, in main list_stations(args) File "./netatmo.py", line 648, in list_stations print(" module", module['_id'], module['module_name'], ','.join(module['data_type'])) KeyError: 'module_name'

In the other functions the error is the same, just the print() is slightly different. Adding -v verbose options display the data correctly, but all end with the same error.

LindyM commented 6 years ago

Problem was that in the Netatmo setting I didn't have a name for the indoor module. Filled that in and it works fine!

rene-d commented 6 years ago

Thanks for your interest ;-)

Hirnscheisse commented 2 years ago

Any idea why I'm getting the error KeyError: 'module_name' when running options that retrieve data?

Details: $ python3 --version Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

RHEL 6.9.

Example: $ ./netatmo.py list 1 station 70:ee:50:00:00:00 My_Station Traceback (most recent call last): File "./netatmo.py", line 754, in main() File "./netatmo.py", line 742, in main list_stations(args) File "./netatmo.py", line 648, in list_stations print(" module", module['_id'], module['module_name'], ','.join(module['data_type'])) KeyError: 'module_name'

In the other functions the error is the same, just the print() is slightly different. Adding -v verbose options display the data correctly, but all end with the same error.

Mate - i searching since 1 week for a solution to fix that problem - and i only created the GitHub Account to say you one thing: THANK YOU !

rene-d commented 2 years ago

Hello @Hirnscheisse What version of netatmo.py are you using? The quoted lines do not correspond to anything, in the last version at least.

I have tried with Python 3.6.15 (inside a Docker container), and:

root@43cca75c89d2:/a/src/netatmo# python3 --version
Python 3.6.15
root@43cca75c89d2:/a/src/netatmo# ./netatmo.py list
1 station 70:ee:50:xx:xx:xx XXXXX (Salon) XXXXX
   module 70:ee:50:xx:xx:xx XYZ Temperature,CO2,Humidity,Noise,Pressure
   module 02:00:00:xx:xx:xx XYZ Temperature,Humidity
   module 03:00:00:xx:xx:xx XYZ Temperature,CO2,Humidity

The ~/.netatmorc is filled with my credentials.