/ChillyAnalyst

Script which is reading the current power from a compatible wall plug, observe the power level and sends a notifcation via your own Telegram bot to your device which is running the Telegram messenger app.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Chilly Analyst

DeepSource

Description

You are annoyed by your washing machine because the displayed time at the beginning of the programm was not correct ?
You want to get a notifiaction to your smartphone when the programm is finished ? .. .. Then we have a solution!

How does it work ?

By setting up a small script which is reading the current power from a compatible wall plug, observe the power level and sends a notifcation via your own Telegram bot to your device which is running the Telegram messenger app.

What do I need ?

  • Device which can run a Python3 application with internet connection (Raspberry Pi recommended)
  • Telegram Application
  • Wall plug with power measurement running Tasmota Firmware

Setup

  1. Install Raspberry Pi OS
  • Download imager, open application and install Os to your SD-card

  • https://www.raspberrypi.org/software/

  • Tested with Full Pi OS Desktop installation approx. 2.5GB

    • Light version can work, but it is not tested
  1. Connect hardware
  • Fire up your Raspberry Pi (e.g connect 5V)
  1. Configure your Raspberry Pi
  • Connect with Wifi or Lan
  • Open Raspberry Pi config
sudo raspi-config
  • Interfacing Options -> Enable SSH
  • Set Hostname to "chillyanalyst"
  1. Reboot your Raspberry Pi
sudo reboot
  1. Install git, python3.7 (most likely it will already be installed)
sudo apt install git 
sudo apt-get install python3.7
  1. Clone ChillyAnalyst repository to your Raspberry Pi
git clone https://github.com/Korbi-code/ChillyAnalyst.git
cd ChillyAnalyst
git checkout origin/master
  1. Install python dependencies
cd ChillyAnalyst
sudo pip3 install -r requirements.txt
  1. Configure your Telegram-Bot

    • Open telegram application on a smartphone or web application
    • Search "BotFather"
    • Create a Bot by following the instructions until your get the access token
  2. Add access token to config file

sudo nano ChillyAnalyst/config/config.cfg
  • paste your unique telegram access token into the config file (Hint: login into Telegram via browser to copy)
  • choose your personal password
  • Confirm bash with:
    • Strg + O
    • Strg + X
  1. Enable Autostart services
  • To automatically start the python script copy the provided service into your system lib and enable the service
cd ChillyAnalyst
sudo cp chillyanalyst.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable chillyanalyst.service
  1. Final reboot
  • Congrats, you finished the installation!
sudo reboot
  1. Updates
  • For updating the program
cd ChillyAnalyst
git fetch
git pull
sudo systemctl restart chillyanalyst.service

Design Doc

Parameter Description

NAME Description
PARAM_POWER_LOWER_LEVEL Power level to detect start after filter
PARAM_POWER_DEBOUNCE_LEVEL When power is below this level debouncing is active
PARAM_EMETER_PLUG_RESOLUTION Factor to convert raw power to power in [W]
PARAM_IDLE_TICK_RATE Read power rate during idle state
PARAM_MEASURE_TICK_RATE Read power rate during measure phase e.g after start till end
PARAM_DEBOUNCE_TICK_LIMIT Amount of ticks power level can be at or below PARAM_POWER_DEBOUNCE_LEVEL, if so "end" is detected
FILTER_QUEUE Size of fifo queue to calculate the mean value

Input filtering

Alt text

State Timing

Alt text