Python script for Netatmo weather station

Python and python framework

Moderator: leecollings

User avatar
krazny
Posts: 27
Joined: Saturday 01 November 2014 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by krazny »

Since last wednesday the Air Quality measuments aren't updated to Domoticz anymore.
As far as I can see the data IS being downloaded from my Netatmo device but just isn't updated to Domoticz.
Image

All the other measurements (temp, pressure, etc) are just OK and are being updated in Domoticz but not the Co2 (Air Quality) graph.
It looks like the sensor type ID (should be 249, Virtual Sensor Types) isn't correct anymore?

Am I the only one having this problem?
Raspberry Pi, Aeon Z-Stick, Fibaro Motion Sensor, 4x Fibaro Wall Plug, 2x Fibaro Dimmer, Netatmo Weatherstation
fwehrle
Posts: 41
Joined: Tuesday 11 February 2014 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by fwehrle »

Hi,

I just see that I have the same problem.
User avatar
stef62376
Posts: 11
Joined: Friday 12 December 2014 22:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by stef62376 »

Came back from holidays (so I am sure I did't change anything in my setup;-) and found that I have the same issue. Perhaps the issue is caused in changes in the netatmo api?
User avatar
krazny
Posts: 27
Joined: Saturday 01 November 2014 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by krazny »

For u all who have the same problem..thanks to another forum I (he) found the solution;

If you open the netatmo_settings.xml file in the 'script' folder you'll probably see there's an extra line added with the same CO2 sensor.
The difference with the current CO2 sensor is the CAPITAL LETTERS;

[OLD]

Code: Select all

<device data_type="Co2" domoticz_dev_id="%Your_ID%" domoticz_dev_subtype="0" domoticz_dev_type="249" id="" module_id="" />
[NEW]

Code: Select all

<device data_type="CO2" domoticz_dev_id="%Your_ID%" domoticz_dev_subtype="0" domoticz_dev_type="249" id="" module_id="" />
Notice the difference in 'Co2' and 'CO2'.
This also has to has to be changed in the netatmo.py script on line 54:

Code: Select all

DATATYPE_CO2 = 'Co2'
-->

Code: Select all

DATATYPE_CO2 = 'CO2'
After that..no more problems!
Raspberry Pi, Aeon Z-Stick, Fibaro Motion Sensor, 4x Fibaro Wall Plug, 2x Fibaro Dimmer, Netatmo Weatherstation
fwehrle
Posts: 41
Joined: Tuesday 11 February 2014 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by fwehrle »

Thnk you to you. :)
It solved the problem.
User avatar
stef62376
Posts: 11
Joined: Friday 12 December 2014 22:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by stef62376 »

Yep, that worked, many thanks!
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by Mediacj »

box18 wrote:All the steps
0. Download the netatmo.py and the netatmo_settings.xml from http://www.domoticz.com/forum/download/file.php?id=785
Thanks box18 for your instructions, it helped me a lot :D

Has anyone got the noise information visible in Domoticz and if yes by which device type en subtype?
User avatar
stef62376
Posts: 11
Joined: Friday 12 December 2014 22:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by stef62376 »

Since yesterday I get errors when running netatmo.py:

pi@domoticzpi:~/domoticz/scripts$ python netatmo.py
Traceback (most recent call last):
File "netatmo.py", line 530, in <module>
main()
File "netatmo.py", line 524, in main
token = GetToken()
File "netatmo.py", line 228, in GetToken
token = LoadToken()
File "netatmo.py", line 224, in LoadToken
return RequestToken()
File "netatmo.py", line 199, in RequestToken
return CreateToken(json_data)
File "netatmo.py", line 162, in CreateToken
newtoken.set(TOKEN_ATTR_ACCESS_TOKEN, json_decoded[TOKEN_ATTR_ACCESS_TOKEN])
KeyError: 'access_token'

I did update my domoticz from 21nn to 2276 at the time.. But that could be a coincidence..

But anyone else seen these errors since yesterday? Perhaps netatmo changed their api again?
User avatar
stef62376
Posts: 11
Joined: Friday 12 December 2014 22:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by stef62376 »

Hmm my netatmo_settings.xml seems to be messed up, the netatmo credentials (client secret etc) are reset. After I corrected then again the errors disappeared but the values in domoticz are not updating.

To be continued...
petergab
Posts: 8
Joined: Sunday 25 May 2014 15:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by petergab »

Netatmo just mofifier its API.
Domoticz no longer receives data
there are mods on script do?
box18
Posts: 8
Joined: Wednesday 26 November 2014 11:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by box18 »

No, it is only Co2 in CO2 at line 57
User avatar
stef62376
Posts: 11
Joined: Friday 12 December 2014 22:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by stef62376 »

Petergap, do you receive data for anything other than co2 (or do you have issues only with co2)? I don;t receive any data at all at the moment, but haven't looked into it thoroughly yet..
petergab
Posts: 8
Joined: Sunday 25 May 2014 15:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by petergab »

error token ... API modified by netatmo ... no data !

Code: Select all

Traceback (most recent call last):
  File "netatmo.py", line 531, in <module>
    main()
  File "netatmo.py", line 525, in main
    token = GetToken()
  File "netatmo.py", line 228, in GetToken
    token = LoadToken()
  File "netatmo.py", line 224, in LoadToken
    return RequestToken()
  File "netatmo.py", line 199, in RequestToken
    return CreateToken(json_data)
  File "netatmo.py", line 162, in CreateToken
    newtoken.set(TOKEN_ATTR_ACCESS_TOKEN, json_decoded[TOKEN_ATTR_ACCESS_TOKEN])
KeyError: 'access_token'
petergab
Posts: 8
Joined: Sunday 25 May 2014 15:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by petergab »

oh sorry its my nettamo setting breakout !!
it s ok !! thank you for your patience
Fredspace
Posts: 1
Joined: Sunday 09 November 2014 19:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by Fredspace »

Hello petergab
Since 2 days i ve got the same error like yours.
You said " its my netatmo setting breakout", could you explain me ?

Thanks a lot
Philos31
Posts: 33
Joined: Friday 15 August 2014 22:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by Philos31 »

http://www.domoticz.com/forum/viewtopic ... 325#p36325

The DB meter has been added to the last beta, is there someone that can change the script to use it maybe?
RasPi2/KaKu/HUE/Xiaomi/Z-Wave/Nuki/Daikin 3,5kw Ururu Sarara/IR Heating Panels all working together with domoticz
cyberbob
Posts: 12
Joined: Monday 02 March 2015 14:46
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by cyberbob »

Basically everything from this : http://www.domoticz.com/forum/viewtopic ... =20#p26776
and this post : http://www.domoticz.com/forum/viewtopic ... =40#p33976

is correct.

However from version 2300< up it now also shows the decibel meter;

new netatmo_settings.xml

Code: Select all

<devices>
	<device data_type="Temperature" domoticz_dev_id="90001" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
        <device data_type="CO2" domoticz_dev_id="90002" domoticz_dev_subtype="0" domoticz_dev_type="249" ...
        <device data_type="Humidity" domoticz_dev_id="90003" domoticz_dev_subtype="0" domoticz_dev_type="81" ...
        <device data_type="Noise" domoticz_dev_id="90008" domoticz_dev_subtype="24" domoticz_dev_type="243" ...
        <device data_type="Pressure" domoticz_dev_id="90004" domoticz_dev_subtype="9" domoticz_dev_type="243" ...
        <device data_type="Temperature" domoticz_dev_id="90005" domoticz_dev_subtype="10" domoticz_dev_type="80" ...
        <device data_type="Humidity" domoticz_dev_id="90006" domoticz_dev_subtype="0" domoticz_dev_type="81"... 
        <device data_type="Rain" domoticz_dev_id="90007" domoticz_dev_subtype="0" domoticz_dev_type="85" ...
        </devices>
Next edit :

netatmo.py line 439 from

Code: Select all

values[PARM_NValue] = value
to

Code: Select all

values[PARM_SValue] = value
if your co2 is still nill, read this post :) http://www.domoticz.com/forum/viewtopic ... =40#p33976
cyberbob
Posts: 12
Joined: Monday 02 March 2015 14:46
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python script for Netatmo weather station

Post by cyberbob »

Before i forgot,

I believe that when you use the rain meter, (not 100% sure do)

you need to insert this line in netatmo.py at row 57:

Code: Select all

DATATYPE_Rain = 'Rain'
and at row 411
insert:

Code: Select all

elif data_type == DATATYPE_Rain:
        values[PARM_SValue] = value 
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by Mediacj »

cyberbob wrote:Basically everything from this : http://www.domoticz.com/forum/viewtopic ... =20#p26776
and this post : http://www.domoticz.com/forum/viewtopic ... =40#p33976

is correct.

However from version 2300< up it now also shows the decibel meter;

new netatmo_settings.xml
Thanks it works!

In the version of netatmo.py I use "values[PARM_NValue] = value" is on line 449 but you can't mis it because Datatype_Noise is just before it.
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Python script for Netatmo weather station

Post by Mediacj »

Has one of you succeeded in adding the Netatmo sensors to the rooms and Floorplan of Domoticz?
When I add devices to a room the Netamo sensors of the python script are not in the list of devices to add.

When I look in the devices list within configuration the Netatmo sensors have a 'Unknown?' label in the hardware column but they work perfect on the dashboard etc.
Post Reply

Who is online

Users browsing this forum: averter and 1 guest