Ship your Ecobee runtime, sensor and weather data to InfluxDB.
- Register and enable the developer dashboard on your Ecobee account at https://www.ecobee.com/developers/
- Go to https://www.ecobee.com/consumerportal/index.html , navigate to Developer in the right-hand menu, and create an App.
- Create a config.json file similar to config.example.json above. This file should exist where your work_dir is defined.
- Build the project (see Build section).
- Run
ecobee_influx_connector -list-thermostats -config $WORK_DIR/config.json
at an interactive terminal; it'll provide a PIN. Make sure to you replace $WORK_DIR with your config path. - Go to https://www.ecobee.com/consumerportal/index.html, navigate to My Apps in the right-hand menu, and click Add Application.
- Paste the PIN there and authorize the app.
- Return to the
ecobee_influx_connector
CLI and hit Enter.
You should then be presented with a list of thermostats in your Ecobee account, along with their IDs.
Configuration is specified in a JSON file. Create a file (based on the template config.example.json
stored in this repository) and customize it:
api_key
is created above in steps 1 & 2.thermostat_id
can be pulled from step 5 above; it's typically your device's serial number.work_dir
is where client credentials,config.json
, and (yet to be implemented) last-written watermarks are stored.- Use the
influx_*
config fields to configure the connector to send data to your InfluxDB. If using tokens for bucket authentication, then leave the user and password config fields empty. - Use the
write_*
config fields to tell the connector which pieces of equipment you use.
A Dockerfile is provided. To build your Docker image, cd
into the project directory and run docker build -t ecobee_influx_connector .
A Docker image is also provided that can be configured via environment variables. View it on Docker Hub, or pull it via docker pull cdzombak/ecobee_influx_connector
.
To use the Docker container make sure the path to the config.json
is provided as a volume with the path /config
. This location will also be used to store the refresh token and config.json
.
Before building a persistent container, you will want to execute docker run --rm -it -v $HOME/ecobee:/config cdzombak/ecobee_influx_connector -config "/config/config.json" -list-thermostats
so that you can get your token cached (/config/ecobee-cred-cache
). This will give you a single key you can then use to authenticate with your ecobee api app. After auth you should see the thermostat_ids listed for all your devices.
If you build a persistent container before performing the above, the initial token request will loop and it will be hard to get the cached token.
There is an example docker-compose.yml
file above. Make sure to modify the volumes section so that it maps your /config
folder to containers /config
folder.
Example:
volumes:
- $DOCKERAPPPATH/ecobee_influx_connector:/config
Example:
If using the image you built from Dockerfile, use:
docker run -d --name ecobeetest --restart=always -v ./config:/config -it ecobee_influx_connector
If using the Docker image, use:
docker run -d --name ecobeetest --restart=always -v ./config:/config -it cdzombak/ecobee_influx_connector:latest
Install my Debian repository if you haven't already:
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://dist.cdzombak.net/deb.key | sudo gpg --dearmor -o /etc/apt/keyrings/dist-cdzombak-net.gpg
sudo chmod 0644 /etc/apt/keyrings/dist-cdzombak-net.gpg
echo -e "deb [signed-by=/etc/apt/keyrings/dist-cdzombak-net.gpg] https://dist.cdzombak.net/deb/oss any oss\n" | sudo tee -a /etc/apt/sources.list.d/dist-cdzombak-net.list > /dev/null
sudo apt-get update
Then install ecobee_influx_connector
via apt-get
:
sudo apt-get install ecobee-influx-connector
make build
To cross-compile for eg. Linux/amd64:
env GOOS=linux GOARCH=amd64 go build -ldflags="-X main.version=$(./.version.sh)" -o ./ecobee_influx_connector .
- Build the
ecobee_influx_connector
binary or install it per the instructions above. - Copy it to
/usr/local/bin
or your preferred location. - Create a work directory for the connector. (I put this at
$HOME/.ecobee_influx_connector
.) - Run
chmod 700 $YOUR_NEW_WORK_DIR
. (For my work directory, I ranchmod 700 $HOME/.ecobee_influx_connector
.) - Create a configuration JSON file, per the Configure instructions above. (I put this at
$HOME/.ecobee_influx_connector/config.json
.) - Customize
ecobee-influx-connector.service
with your user/group name and the path to your config file. - Copy that customized
ecobee-influx-connector.service
to/etc/systemd/system
. - Run
chown root:root /etc/systemd/system/ecobee-influx-connector.service
. - Run
systemctl daemon-reload && systemctl enable ecobee-influx-connector.service && systemctl start ecobee-influx-connector.service
. - Check the service's status with
systemctl status ecobee-influx-connector.service
.
The connector does not directly support multiple thermostats. To support this use case, I'd recommend running multiple copies of the connector. Each copy will need its own working directory and config file, but you should be able to use the same API key for each connector instance.
(If deploying using the "systemd on Linux" instructions, give each connector's service file a unique name, like ecobee-influx-connector-1.service
, ecobee-influx-connector-2.service
, and so on.
Apache 2.0; see LICENSE
in this repository.
Chris Dzombak (GitHub: @cdzombak).