Giter Site home page Giter Site logo

netatmo-client-influx's Introduction

netatmo-client-influx

pyatmo

Netatmo Weather Station dashboard for Grafana

Screenshot

InfluxDB 2.0

This Version is for InfluxDB 2.0 only.

If you want to upgrade your Docker InfluxDB to 2.0, there is a guide available here.

Installation

  • Create a Netatmo developer account and create an app there.
  • Generate a refresh token in your app, scroll down to the "Token generator" and generate a new one with the appropriate scopes.
  • Create file called "config" or use Environment Variables and fill in your NETATMO_CLIENT_ID, NETATMO_CLIENT_SECRET and NETATMO_REFRESH_TOKEN.
  • Environment Variables take precedence over everything else and will overwrite your config vars.
  • The default is to search for a config file right next to the script, but you can point to any config file with the "-f" switch.
[global]
interval = 600
loglevel = INFO

[netatmo]
client_id =
client_secret =
refresh_token =

[influx]
influx_host =
influx_port =
influx_bucket =
influx_protocol =
influx_token =
influx_org =
  • Create a cron job to run the script periodically e.g.
# cat /etc/cron.d/netatmo
*/10 * * * * root  /usr/local/bin/netatmo_influx.py > /dev/null 2>&1

You can also use docker to run the script. Either build it yourself or use my prebuilt containers from GitHub Container Registry.

netatmo-client-influx's People

Contributors

karaktaka avatar dependabot[bot] avatar florianbeer avatar mnin avatar dkozinn avatar

Watchers

 avatar  avatar

netatmo-client-influx's Issues

Getting KeyError: 'module_name'

Hi @karaktaka

Thank you for sharing your project.
While trying get everything to work, I get the following error.

2024/01/28 11:05:50 | stdout | KeyError: 'module_name'
2024/01/28 11:05:50 | stdout | ~~~~~~~^^^^^^^^^^^^^^^
2024/01/28 11:05:50 | stdout | station_module_name = station["module_name"]
2024/01/28 11:05:50 | stdout | File "/app/netatmo-client/netatmo_influx.py", line 201, in <module>
2024/01/28 11:05:50 | stdout | Traceback (most recent call last):
2024/01/28 11:05:50 | stdout | 28.01.2024 10:05:50 - INFO:Written batch with size 2762.
2024/01/28 11:05:50 | stdout | 28.01.2024 10:05:50 - INFO:Starting Netatmo Crawler...
2024/01/28 11:05:50 | stdout | 28.01.2024 10:05:50 - INFO:Setting loglevel to INFO.

My Modules are named "Innen" and "Aussen"

Any ideas?

InvalidClientError

Hi @karaktaka ,

It's me again. After my token expired, the container stopped working.

For better debugging I switched from the synology to a other docker host.

Every time I try to start the container I get the following response:

netatmo-client-influx  | 05.08.2024 20:42:41 - netatmo_influx:90 - INFO:Setting loglevel to DEBUG.
netatmo-client-influx  | 05.08.2024 20:42:41 - netatmo_influx:233 - INFO:Starting Netatmo Crawler...
netatmo-client-influx  | Traceback (most recent call last):
netatmo-client-influx  |   File "/app/netatmo_influx.py", line 235, in <module>
netatmo-client-influx  |     authorization, refresh_token, token_expiration = get_authorization(
netatmo-client-influx  |                                                      ^^^^^^^^^^^^^^^^^^
netatmo-client-influx  |   File "/app/netatmo_influx.py", line 110, in get_authorization
netatmo-client-influx  |     _result = _auth.refresh_tokens()
netatmo-client-influx  |               ^^^^^^^^^^^^^^^^^^^^^^
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/pyatmo/auth.py", line 95, in refresh_tokens
netatmo-client-influx  |     token = self._oauth.refresh_token(
netatmo-client-influx  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token
netatmo-client-influx  |     self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
netatmo-client-influx  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 427, in parse_request_body_response
netatmo-client-influx  |     self.token = parse_token_response(body, scope=scope)
netatmo-client-influx  |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response
netatmo-client-influx  |     validate_token_parameters(params)
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters
netatmo-client-influx  |     raise_from_error(params.get('error'), params)
netatmo-client-influx  |   File "/app/.venv/lib/python3.12/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error
netatmo-client-influx  |     raise cls(**kwargs)
netatmo-client-influx  | oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client)

I double checked the Environment Variables for NETATMO_CLIENT_ID, NETATMO_CLIENT_SECRET and NETATMO_REFRESH_TOKEN. I've also tried to create a new app on dev.netatmo, no success.

Any idea?

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.