philippelt / netatmo-api-python

Netatmo connect API python client (for Netatmo information, see https://dev.netatmo.com)
GNU General Public License v3.0
186 stars 118 forks source link

Add Homecoach from API #64

Closed JurgenLB closed 8 months ago

JurgenLB commented 9 months ago

I have put the following code for My HomeCoach devices;

` Common definitions

 _GETHOMECOACH          = _BASE_URL + "api/gethomecoachsdata"

class HomeCoach: """ List the HomeCoach modules Args: authData (clientAuth): Authentication information with a working access Token home : Home name or id of the home who's HomeCoach belongs to """

def __init__(self, authData, home=None):
    self.getAuthToken = authData.accessToken
    postParams = {
            "access_token" : self.getAuthToken
            }
    resp = postRequest("HomeCoach", _GETHOMECOACH, postParams)
    self.rawData = resp['body']['devices']
    # homecoach data
    if not self.rawData : raise NoDevice("No HomeCoach available")
    for i in range(len(self.rawData)):
       #
       self.HomecoachDevice = self.rawData[i]
       print (self.HomecoachDevice)
       print (' ')
       print (self.HomecoachDevice['dashboard_data'])
       print (' ')

`

this give me the following data;

` {'_id': '70:ee:50:25:f3:58', 'station_name': 'Slaapkamer', 'date_setup': 1529696933, 'last_setup': 1529696933, 'type': 'NHC', 'last_status_store': 1695673789, 'firmware': 59, 'last_upgrade': 1529696984, 'wifi_status': 63, 'reachable': True, 'co2_calibrating': False, 'data_type': ['Temperature', 'CO2', 'Humidity', 'Noise', 'Pressure', 'health_idx'], 'place': {'altitude': 65, 'city': 'Bree', 'country': 'BE', 'timezone': 'Europe/Brussels', 'location': [5.58998, 51.121652]}, 'dashboard_data': {'time_utc': 1695673788, 'Temperature': 20.8, 'CO2': 586, 'Humidity': 58, 'Noise': 37, 'Pressure': 1024.8, 'AbsolutePressure': 1017, 'health_idx': 0, 'min_temp': 20.1, 'max_temp': 20.8, 'date_max_temp': 1695659280, 'date_min_temp': 1695593088}}

{'time_utc': 1695673788, 'Temperature': 20.8, 'CO2': 586, 'Humidity': 58, 'Noise': 37, 'Pressure': 1024.8, 'AbsolutePressure': 1017, 'health_idx': 0, 'min_temp': 20.1, 'max_temp': 20.8, 'date_max_temp': 1695659280, 'date_min_temp': 1695593088} `

I'm not sure on how to handle the rest of the code but I'm willing to assist

Kind regards

JurgenLB commented 8 months ago

resolved #69