{"id":13771645,"url":"https://github.com/labordep/PharoNetatmoAPI","last_synced_at":"2025-05-11T04:30:49.685Z","repository":{"id":140127478,"uuid":"579386517","full_name":"labordep/PharoNetatmoAPI","owner":"labordep","description":"Pharo Netatmo API implementation for Legrand Netatmo products","archived":false,"fork":false,"pushed_at":"2023-03-17T10:47:59.000Z","size":88,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T15:39:25.286Z","etag":null,"topics":["aircare","api","authentication","desktop-app","healthy-home-coach","iot","legrand","netatmo","netatmo-api","netatmo-energy","netatmo-weather-station","netatmo-welcome","oauth2","pharo","pharo-smalltalk","smalltalk","web-app"],"latest_commit_sha":null,"homepage":"","language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labordep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-12-17T14:22:49.000Z","updated_at":"2024-10-27T14:24:22.000Z","dependencies_parsed_at":"2024-01-06T21:59:10.986Z","dependency_job_id":null,"html_url":"https://github.com/labordep/PharoNetatmoAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labordep%2FPharoNetatmoAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labordep%2FPharoNetatmoAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labordep%2FPharoNetatmoAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labordep%2FPharoNetatmoAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labordep","download_url":"https://codeload.github.com/labordep/PharoNetatmoAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518941,"owners_count":21921074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aircare","api","authentication","desktop-app","healthy-home-coach","iot","legrand","netatmo","netatmo-api","netatmo-energy","netatmo-weather-station","netatmo-welcome","oauth2","pharo","pharo-smalltalk","smalltalk","web-app"],"created_at":"2024-08-03T17:00:53.898Z","updated_at":"2025-05-11T04:30:49.175Z","avatar_url":"https://github.com/labordep.png","language":"Smalltalk","funding_links":[],"categories":["IOT"],"sub_categories":[],"readme":"# Pharo Netatmo API\n\n![image](https://user-images.githubusercontent.com/49183340/215271343-913354fa-5616-451c-914d-f34825c64078.png)\n\nPharo Netatmo API implementation for Legrand Netatmo products.\n\nSupported products :\n- Weather station products\n- Healthy HomeCoach / Aircare product\n\n## Connexion and OAuth2 authentication\n\nYou cannot access data directly from the devices : Netatmo not provide that for the moment. The only way to access the data and the devices is via Netatmo servers. You need to be connected to Internet to get datas from your devices.\n\nThe access require an OAuth2 authentication to get an access token. This token should be refresh in time with another authentication request. For more details about the security see the link to official Netatmo documentation at the bottom of this page. \n\nOAuth2 authentication is working in this project using Zinc and can be used for desktop or web applications.\n\nWhen your token is recover, use the api with it during the token validity time.\n\n## Installing\n\n```smalltalk\nMetacello new\n   baseline: 'NetatmoAPI';\n   repository: 'github://labordep/PharoNetatmoAPI:main';\n\tonConflictUseIncoming;\n\tignoreImage;\n   load.\n```\n\n## Prerequisites\n\nCreate an application access with your Netatmo connect account to get your client_id and client_secret datas.\nSee the bottom section to use the OAuth2 authentication in this project. \n\nFor more details [see the official guidelines](https://dev.netatmo.com/guideline).\n\n## How to authenticate\n\nThis section describes how to authenticate and get an access token.\nThis step is not mandatory if you get manually a token, for example directly by a Netamo account website or another providing library.\nWhen you get a token you can use the API, see next section to have some examples.\n\nFirst, instanciate a new ```NetatmoAPIAuthentificator``` with your client_id and client_secret datas. You need to specifiy the scope of your datas, for examples : thermostat temperature, humidity, etc. If your are not sure or if you need all use ```NetatmoScopeEnum allReadScopes``` to get all can be read datas.\n\n```smalltalk\nauthenticator := NetatmoAPIAuthentificator \n\tclientId: 'myClientId' \n\tclientSecret: 'myClientSecret' \n\tscopes: (NetatmoScopeEnum allReadScopes).\n```\n\nNow create a new session to request the authentication.\nThis method return a ```ZnOAuth2Session``` which provide OAuth2 connexion process.\n\n```smalltalk\nsession := authenticator createOAuth2Session. \n```\n\nIf this is the first try to get a token, the session is not live. Call the ```requestUserAuthentication``` method to open your web browser and validate the authentication using the Netatmo online form.\n\n```smalltalk\nsession isLive ifFalse:[\n\tauthenticator requestUserAuthentication.\n].\n```\nAt this step your default web browser open the online Netatmo authentication form :\n\n![image](https://user-images.githubusercontent.com/49183340/211155898-80ff55bc-6129-49df-9d64-b73da93bdd00.png)\n\nCheck and accept if you are agree. \nA basic result page is display to confirm the good authentication, close this page when it appears : \n\n![image](https://user-images.githubusercontent.com/49183340/211156062-c3c5d6d1-9669-49a1-bb1f-19ae43f584bb.png)\n\nGetting your token :\n\n```smalltalk\ntoken := session liveAccessToken.\n```\n\n## How to use the API to get datas\n\nInstanciante ```NetatmoAPI``` to have to request datas from the API. Use a token to setup the connection.\n\n```smalltalk\n| api |\napi := NetatmoAPI new.\napi token: 'yourAccess|tokenHere'\n```\n\nUse \"api\" category methods to request datas.\n\n### Get availables devices\n\nGet all devices, return a list of ```NetatmoDevice```. The list can change depending session authorization. \n\n```smalltalk\n| devices |\ndevices := api getDevices.\n```\n\n### Get Weather station datas\n\nGet all device, return a list of ```NetatmoStation``` devices.\n\n```smalltalk\n| devices |\ndevices := api getStationDevices.\n```\n\nGet specific device from mac address (id), return a list of ```NetatmoStation``` devices.\n\n```smalltalk\n| devices |\ndevices := api getStationDevice:: '01:23:45:67:89:ab'.\n```\n\n### Get Healthy Home Coach datas\n\nGet all device, return a list of ```NetatmoHealthyHomeCoach``` devices.\n\n```smalltalk\n| devices |\ndevices := api getHealthyHomeCoachDevices.\n```\n\nGet specific device from mac address (id), return a list of ```NetatmoHealthyHomeCoach``` devices.\n\n```smalltalk\n| devices |\ndevices := api getHealthyHomeCoachDevice: '01:23:45:67:89:ab'.\n```\n\n### Get measures from a device\n\nUse the API to get measure from a device, return a list of ```NetatmoMeasure``` measures. \nEach ```NetatmoMeasure``` contains data (for example ```56```), type (for example ```'humidity'```), unit (for example ```'%'```), data unit (for example ```Number```) and a ```DateTime``` of the measure.\nWhen requested a measure from the API use ```types:``` to choose data type by passing a list of ```NetatmoMeasureType```.\n\nGet one type of data from a device.\n\n```smalltalk\n| measures |\nmeasures := api getMeasures: (device id) \n                types: NetatmoMeasureType humidity.\n```\n\nGet multiples types of data from a device.\n\n```smalltalk\n| measures |\nmeasures := api getMeasures: (device id) \n                types: (OrderedCollection \n                           with: NetatmoMeasureType temperature \n                           with: NetatmoMeasureType humidity).\n```\n\nIt is possible to request a date time interval of measure, with a scale for the sample.\nExample : get temperature each days at the current time in the last week.\n\n```smalltalk\n| measures |\nmeasures := api getMeasures: (device id) \n                types: NetatmoMeasureType temperature \n                scale: 1 day \n                dateTimeBegin: (DateAndTime now - 7 day) \n                dateTimeEnd: DateAndTime now.\n```\n\n## More examples\n\nThe package ```NetatmoAPI-Examples``` contains some API uses examples with basics user interfaces using ```Spec``` and ```Roassal```.\n\nA list of availables devices (with sub devices) :\n\n![image](https://user-images.githubusercontent.com/49183340/213928950-00fe6fbd-57a1-41e6-b23e-a7eadf304c4b.png)\n\nA list of last 7 days Healthy Home Coach measures :\n\n![image](https://user-images.githubusercontent.com/49183340/213929145-148b183b-f1c0-4db0-a15d-7166284e557a.png)\n\nA Weather Station dashboard :\n\n![image](https://user-images.githubusercontent.com/49183340/213929287-af549f2a-7a1d-4b92-ad85-e64b02efcc28.png)\n\nA Weather Station last 7 days indoor and outdoor humidity :\n\n![image](https://user-images.githubusercontent.com/49183340/213929305-d1985a81-38b8-4d45-b098-5756282cc9b5.png)\n\nEtc.\n\n## Legals and privacy\n\nUsing Netatmo Connect APIs you will have access to very sensitive information. This is particularly true if your app accesses our Cameras (live stream or videos). Make sure you respect user's privacy and have a strong privacy policy.\n\n[Netatmo Connect APIs Terms of Use](https://dev.netatmo.com/legal) \n\n## Legrand Netatmo API documentation\n\nThis ressources are my reference to implement this API.\nThere are two API product groups : Weather/Security/Energy and HomeCoach/Aircare.\n\n### Weather, Security and Energy products\n\n[General Netatmo documentation](https://dev.netatmo.com/)\n\nMore specific produtcs API :\n- Weather product : [Weather API Documentation](https://dev.netatmo.com/apidocumentation/weather)\n- Energy product : [Energy API Documentation](https://dev.netatmo.com/apidocumentation/energy)\n- Security : [Home + Security API Documentation](https://dev.netatmo.com/apidocumentation/security)\n\n### Healthy HomeCoach / Aircare product\n\n[Netatmo Aircare API Documentation](https://dev.netatmo.com/apidocumentation/aircare)\n\n## Licence\n\nThis project is a personnal work, I'm not affilied with Legrand.\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabordep%2FPharoNetatmoAPI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabordep%2FPharoNetatmoAPI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabordep%2FPharoNetatmoAPI/lists"}