benningm / docker-telegraf-netatmo Goto Github PK
View Code? Open in Web Editor NEWscript and docker image to retrieve data from netatmo API
script and docker image to retrieve data from netatmo API
It seems like I am experiencing a similar error to that issue linked. Could you describe, how you could solved this problem, @jostrasser?
This is my error message:
E! Error in plugin [inputs.exec]: exec: exit status 1 for command '/usr/local/bin/netatmo': /usr/local/bin/netatmo:81:in `filter_data': private method `select' called for nil:NilClass (NoMethodError)...
Ruby 2.3.3 is installed.
Best,
AlfaJackal
Originally posted by @jostrasser in #2 (comment)
Starting October, current way to connect to Netatmo server will be removed and a new one introduced. We will need to find an other way to connect and keep the script working.
To improve the security of our products, we inform you that the Client Credentials grant type method will be completely removed. It will no longer be possible to authenticate with the username and password of the user.
The effective date of this update is October 2022.
How can you authenticate with Netatmo API ?
From this date, the OAuth2 authorization code flow must be followed for authentication.
Source: mail information I received from Netatmo
Documentation from mail: https://dev.netatmo.com/apidocumentation/oauth#authorization-code
Hi,
since yesterday no data will be imported into my influxdb. No idea if netatmo has changed anything on their end.
Last data at 4:45pm CET.
Any idea?
Thanks JO!
Managed to start the docker via:
docker run \
--name telegraf-netatmo \
-e 'NETATMO_CLIENT_ID=xxx' \
-e 'NETATMO_CLIENT_SECRET=xxx' \
-e '[email protected]' \
-e 'NETATMO_PASSWORD=1234' \
-e 'NETATMO_DEVICE_ID=xx:xx:xx:xx:xx:xx' \
--link influxdb \
benningm/telegraf-netatmo:latest
Adding the volume mount results in a crash after booting the container -v /etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
I ssh'd into the docker file and edited /etc/telegraf/telegraf.conf with the correct ip and port - I left everything else commented out like it is:
[[outputs.influxdb]]
urls = ["http://10.10.0.6:32784"]
database = "telegraf"
Unfortunately it is still http://localhost:8086:
2020-01-13T21:45:40Z E! [outputs.influxdb]: when writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: getsockopt: connection refused
Also, using a telegraf.conf with only this content doesn't work - the container crashes:
[[outputs.influxdb]]
urls = ["http://10.10.0.6:32784"]
database = "telegraf"
username = "telegraf"
password = "telegraf"
[[inputs.exec]]
commands = ["/usr/local/bin/netatmo"]
interval = "10m"
timeout = "15s"
data_format = "json"
name_suffix = "_netatmo"
What am I doing wrong? Any help is much appreciated!
Hi Markus,
First of all, thanks for the script / docker.
However, I have an issue making it run, here is the output of the docker-compose up command:
docker-compose up
Creating netatmo ...
Creating netatmo ... done
Attaching to netatmo
netatmo | 2018/02/26 11:08:03 I! Using config file: /etc/telegraf/telegraf.conf
netatmo | 2018-02-26T11:08:04Z I! Starting Telegraf (version 1.3.5)
netatmo | 2018-02-26T11:08:04Z I! Loaded outputs: influxdb
netatmo | 2018-02-26T11:08:04Z I! Loaded inputs: inputs.exec
netatmo | 2018-02-26T11:08:04Z I! Tags enabled: host=256a9033364d
netatmo | 2018-02-26T11:08:04Z I! Agent Config: Interval:10s, Quiet:false, Hostname:"256a9033364d", Flush Interval:10s
netatmo | 2018-02-26T11:08:10Z E! Error in plugin [inputs.exec]: exec: exit status 1 for command '/usr/local/bin/netatmo'
and the output when running "manually", the script from within the container:
ruby ./netatmo
(RuntimeError) `refresh_token': login failed: <html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>
from ./netatmo:18:in `initialize'
from ./netatmo:114:in `new'
from ./netatmo:114:in `<main>'
or
./netatmo
./netatmo:31:in `refresh_token': login failed: {"error":"invalid_client"} (RuntimeError)
from ./netatmo:18:in `initialize'
from ./netatmo:114:in `new'
from ./netatmo:114:in `<main>'
I am not sure why I get this error... I am already using the the same telegraf.conf on several servers and it works OK. I am pretty sure my credentials are all good. I triple checked them.
Telegraf conf:
[[outputs.influxdb]]
urls = ["http://xxxxx.yyyy.com:8086"] # required
database = "telegraf" # required
username = "telegraf"
password = "xxxxxx"
[[inputs.exec]]
commands = ["/usr/local/bin/netatmo"]
interval = "10m"
timeout = "15s"
data_format = "json"
name_suffix = "_netatmo"
And finally docker-compose.yml file:
version: '2'
services:
netatmo:
container_name: netatmo
image: benningm/telegraf-netatmo
restart: unless-stopped
volumes:
- ./conf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
environment:
- NETATMO_CLIENT_ID=
- NETATMO_CLIENT_SECRET=
- NETATMO_USERNAME=
- NETATMO_PASSWORD=
- NETATMO_DEVICE_ID=
Trying to change "urls" in the telegraf config with and without httpS didn't changed anything.
Thanks a lot for your help.
Hi @benningm
If I compare the values between the my.netatmo.com portal and my self hosted Grafana which is getting the data via the netatmo data porter script from my InfluxDB I can see that the data on Grafana does not match them on the official Netatmo App / Web Portal.
Example:
Daily Rain (sum today)
On Netatmo: 10.4 mm
On Grafana: 7.5 mm
Also the hourly data is not identical, that's the reason why the daily sum cannot be correct.
Any ideas?
Thanks JO!
Hi,
I think the script is broken since a few days:
./netatmo:81:in filter_data': private method
select' called for nil:NilClass (NoMethodError)
from ./netatmo:75:in process_data' from ./netatmo:102:in
measurements'
from ./netatmo:120:in `
Stopped working without any changes on the linux-side.
Any ideas?
Thanks JO
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.