This repository contains 2 applications:
- A script to extract data from the a youless logger
- A dash-application which creates a dashboard to visualize the data
In order to run this script and the app you need a Youless logger connected to the same network as the machine you run this script on.
We assume the logger is reachable on http://youless/
via your browser.
The python script looger.py
in this repository extracts the logged data (hour, minute and daily data) from a Youless logger.
The data is stored in a SQLite database named youless.db
with 3 tables set up:
youless_minute
for minute based energy consumptionyouless_hour
for hourly energy consumptionyouless_day
for daily energy consumption
In case the gas sensor is enabled via the config, there will be additional tables:
youless_hour_gas
for hourly gas consumptionyouless_day_gas
for daily gas consumption
The dash application runs a dashboard to visualize the energy consumption and optionally gas consumption as well.
First you need to create a config.json
file in the root of the repository. This file can have the following parameters:
{
"db_path": "/home/user/youless-logger/youless.db",
"debug_mode": false,
"gas_enabled": false
}
db_path
: Full path to the file which should store your data (file will be created automatically)debug_mode
: Indicator whether the dash app should be ran in debug modegas_enabled
: Indicator whether the collection of data from a youless gas monitor is enabled as well
You can run the logger script (logger.py
) manually or set up a crontab to run it automatically.
This example sets it up to run every minute:
Edit your crontab
crontab -e
Enter the following line (adjust the path to the script):
* * * * * /path/to/your/python/env /full/path/to/logger.py
Example:
* * * * * /home/pi/.pyenv/versions/youless-logger/bin/python /home/pi/youless-logger/logger.py
Save it.
You can run the dashboard script (app.py
) manually or set up a crontab to run it automatically.
This example sets it up to run on startup:
Edit your crontab
crontab -e
Enter the following line (adjust the path to the script):
@reboot /path/to/your/python/env /full/path/to/app.py
Example:
@reboot /home/pi/.pyenv/versions/youless-logger/bin/python /home/pi/youless-logger/app.py
Save it.
Alternatively you can also use the provided youless-app.service
file and run the application with systemd.
Make sure to adjust the WorkingDirectory
and the ExecStart
parameters correctly.
You should be able to access the app in your browser while you are in the same network via the devices IP address or host name. For a standard raspberry pi you could reach it on
rasbperrypi:8050