Giter Club home page Giter Club logo

netatmo-pi-controller's Introduction

Control Netatmo Thermostat from Raspberry PI temperature monitor

NOTE: this is alpha software. Don't rely on it! There's no guarantee it'll work properly!

This python application can be used in combination with this temperature and humidity sensor:

https://www.amazon.co.uk/dp/B078SVZB1X DHT22/AM2302

The idea is that the pi runs a python application that monitors the local room temperature. If that gets below a certain point it requests the paired Netatmo smarty thermostat to boost its setpoint for 15 minutes. It keeps extending the boost as necessary.

There is a set of 'acceptable hours' where it runs - the idea being that it doesn't control the temperature outside of those hours.

The temperature values and setpoint values are recorded into a Prometheus time-series database so you can keep track of how it's performing.

Instructions

This was tested on Raspbian 10.

Connect the sensor up to the pi by plugging it into the correct GPIO pins as mentioned in the instructions provided with the sensor. The script has a variable that indicates which pin it should use to access the sensor.

You need to create a Netatmo App at https://dev.netatmo.com/apps

Install using the setup.sh script - there are some details in there that you need to modify to get working. These are the items listed as {var}. The clientID and clientSecret are configured at https://dev.netatmo.com/apps.

Once installed you can bring up the app using up.sh script.

Once the python app is running, you need to authenticate your app against Netatmo by accessing the webpage of the app at : http://{my-pi-hostname}:3000/ . You should only need to do this once. Once you login at Netatmo they'll redirect you back to the redirect_url configured in setup.sh. That URL doesn't need to be publically accessible, just accessible from the place the web browser is running.

Note, there is no authentication on the PI webpage - anyone with access to port 3000 can access it. Don't make it publically accessible and make sure you trust anyone that can route to it. They'll be able to control whether your boiler is on or not.

To have the script auto-start after a reboot add the following to the root crontab (replacing {user} with the username which installed the dependencies): @reboot su {user} -c 'cd /home/{installpath} && ./up.sh |& logger -t netatmo'

Logs can be viewed by running: journalctl -f -t netnatmo

netatmo-pi-controller's People

Contributors

bigfatpaulyj avatar

Stargazers

John Kelly avatar

Watchers

 avatar  avatar

netatmo-pi-controller's Issues

Problem when Netatmo relay can't reach internet.

Script crashes with:

2023-12-06 15:15:34 INFO Got homestatus response(200): {"status":"ok","time_server":1701875734,"body":{"home":{"id":"???"},"errors":[
{"code":6,"id":"???"},{"code":6,"id":"???"}]}} ???
2023-12-06 15:15:34 ERROR Exception on / [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "./app.py", line 170, in handleAdminPageRequest
'netatmo': getNetatmoTemp(conn, config),
File "./app.py", line 58, in getNetatmoTemp
return getNetatmoTemp(conn, config, True)
File "./app.py", line 48, in getNetatmoTemp
for roomData in jsonPayload['body']['home']['rooms']:
KeyError: 'rooms'

App.py needs to properly handle error codes returned by Netatmo api.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.