#538 Polling data from Netatmo devices

Andrew Stokes Thu 21 Sep 2017

Hi everyone,

I'm new to Haystack and I have a project that I am having trouble solving. I have these devices from Netatmo, the "Healthy Home Coach" or "Weather Station," I believe (https://dev.netatmo.com/resources/technical/reference/healthyhomecoach).

These devices record data and send it to a server, which I have to poll data for. They aren't on BACnet, otherwise I wouldn't have an issue, but I have found a way to poll for data using Python and I'm at a loss now what to do because I need the data to be brought into Niagara N4. I believe when I poll the data, it comes through as JSON, which I believe Haystack can read? But I don't know how to connect the two ends.

I feel like I need some sort of server to save the data on and/or some sort of device to put onto our JACE or something in order to have Haystack be able to read the data. It's been a struggle and my inexperience has left me bewildered and unsure what to do.

If anyone can offer me any help or guidance, it would be greatly appreciated. Thank you!

Christopher Howard Thu 21 Sep 2017

would this work? https://github.com/ChristianTremblay/pyhaystack

Brian Frank Fri 22 Sep 2017

I believe when I poll the data, it comes through as JSON, which I believe Haystack can read?

Haystack has a specific JSON format it uses, which I don't think that product supports to my knowledge. So you probably won't be able to leverage any Haystack library directly, nor nHaystack. What you are looking at is custom software development to glue two systems together. What you could do is write a little program that polls their server and then pushes it to Niagara using Haystack (or to any Haystack compliant server at that point)

Christian Tremblay Mon 25 Sep 2017

I would try to make a driver in the Jace that would poll the info directly... Or maybe only a small script that reads from a URL if sufficient.

Or you will need a 3rd device between the 2 everytime...

Andrew Stokes Wed 27 Sep 2017

Chris, I did download and install Pyhaystack and installed it on a Raspberry Pi, but I never got it to work, mostly through my own inexperience with Linux OSes. Although, maybe it was Pypipes... or both.

Brian, right now I have a script in Python which can poll for the data and using pprint, this is the format that all the data arrives as:

{'body': {'devices': [{'_id': '*********',

'cipher_id': '****************',
'co2_calibrating': False,
'dashboard_data': {'AbsolutePressure': 1003.2,
                   'CO2': 980,
                   'Humidity': 62,
                   'Noise': 48,
                   'Pressure': 1012.1,
                   'Temperature': 22.7,
                   'date_max_temp': 1497383969,
                   'date_min_temp': 1497359852,
                   'max_temp': 22.7,
                   'min_temp': 21.2,
                   'time_utc': 1497384269},
'data_type': ['Temperature',
              'CO2',
              'Humidity',
              'Noise',
              'Pressure'],
'date_setup': 1366459135,
'firmware': 124,
'last_setup': 1366459135,
'last_status_store': 1497384282,
'last_upgrade': 1440322796,
'module_name': 'Indoor',
'modules': [{'_id': '**********',
             'battery_percent': 100,
             'battery_vp': 6335,
             'dashboard_data': {'Humidity': 67,
                                'Temperature': 22.3,
                                'date_max_temp': 1446918449,
                                'date_min_temp': 1446918449,
                                'max_temp': 22.3,
                                'min_temp': 22.3,
                                'time_utc': 1446918449},
             'data_type': ['Temperature', 'Humidity'],
             'firmware': 34,
             'last_message': 1446918525,
             'last_seen': 1446918500,
             'last_setup': 1366638628,
             'module_name': 'Outdoor',
             'rf_status': 32,
             'type': 'NAModule1'}],
'place': {'altitude': 75.891496494971,
          'city': '*******',
          'country': 'US',
          'location': [******, *******],
          'timezone': 'America/New_York'},
'station_name': 'JP_Atmo',
'type': 'NAMain',
'wifi_status': 45}],
'user': {'administrative': {'country': 'US',
                            'feel_like_algo': 1,
                            'lang': 'en-US',
                            'pressureunit': 1,
                            'reg_locale': 'en-US',
                            'unit': 1,
                            'windunit': 1},
         'mail': '***********'}},

status: ok, time_exec: 0.019564867019653, time_server: 1506541397}

I also, through formating, can print out individual values. Is that the same JSON format Haystack follows? Really, the only value I actually care about is temperature. Which the code

print("Temperature":, data['body']['devices'][0]['dashboard_data']['Temperature'])

will print out:

"Temperature": 22.7

so even if I reduce the code to just be the number value, I'm not sure how I get that value through my JACE, whether I save it and somehow get it sent to the JACE, or have something poll for the data using a similar script and send it to the JACE.

Login or Signup to reply.