baracudaz / netatmo-lametric-proxy

A simple client which turns LaMetric into Netamo display. This client calls Netatmo API and updates LaMetric display.
15 stars 6 forks source link

IndexError #2

Closed sdecaux closed 8 years ago

sdecaux commented 8 years ago

Hello,

Thanks for this clever script...

I managed to create a LaMetric private app, and a Netatmo app. I have edited the apps data in the main python file. I may have done something wrong for the LaMatric app, being not sure of what to put in the frames texts ("name"?). I receive an error when running it:

MacPro:netatmo-lametric-proxy-master sd$ ./updateLaMetric.py
Detected module : 03:00:00:01:59:96 'Garage' - Temperature, CO2, Humidity
Detected other  : 05:00:00:00:2d:00 'Pluvio' - Rain
Detected station: 70:ee:50:00:50:bc 'Intérieur' - Temperature, CO2, Humidity, Noise, Pressure
Detected module : 02:00:00:00:3e:3e 'Exterieur' - Temperature, Humidity
Traceback (most recent call last):
  File "./updateLaMetric.py", line 72, in <module>
    hist_temp = [v[0] for v in measure['body'][0]['value']]
IndexError: list index out of range

Any idea?

baracudaz commented 8 years ago

Hi @sdecaux

You guys seem to be using a lot of extra modules. Of course my script did not detect all these use cases. Am I the only one in wild using the default setup? :)

Anyways, script has been updated. You are welcomed to try it out.

Frame text is optional. The script will feed the text.

sdecaux commented 8 years ago

Hi,

Thanks for your quick answer A bit better, but not yet OK

Detected other  : 03:00:00:01:59:96 'Garage' - NAModule4, Temperature, CO2, Humidity
Detected other  : 05:00:00:00:2d:00 'Pluvio' - NAModule3, Rain
Detected station: 70:ee:50:00:50:bc 'Intérieur' - NAMain, Temperature, CO2, Humidity, Noise, Pressure
Detected module : 02:00:00:00:3e:3e 'Exterieur' - NAModule1, Temperature, Humidity
Traceback (most recent call last):
  File "./updateLaMetric.py", line 70, in <module>
    hist_temp = [v[0] for v in measure['body'][0]['value']]
IndexError: list index out of range

BUT it seems that my exterior module has low battery, so problem may come from that

sdecaux commented 8 years ago

Yes all is OK now.

Detected other  : 03:00:00:01:59:96 'Garage' - NAModule4, Temperature, CO2, Humidity
Detected other  : 05:00:00:00:2d:00 'Pluvio' - NAModule3, Rain
Detected station: 70:ee:50:00:50:bc 'Intérieur' - NAMain, Temperature, CO2, Humidity, Noise, Pressure
Detected module : 02:00:00:00:3e:3e 'Exterieur' - NAModule1, Temperature, Humidity
{'trend': 'stable', 'pressure': '1007.3mb', 'temperature': '19.1\xc2\xb0C', 'humidity': '74%'}

Seems you could better handle a module in error (for instance no battery), but it is something that would quite never happen :-)