Switch predictor for Home Assistant with AppDeamon

Overview

Home Assistant AppDeamon - Event predictor

"Buy Me A Coffee"

WORK IN PROGRESS - CURRENTLY NOT COMPLETE AND NOT WORK

This is an idea under development (when I have free time)

I am Italian, sorry for any mistakes in English.

I want to try it right now!

No, wait.

This is a program in Python that I'm making in my spare time and is currently unfinished.

To try it and possibly contribute (thanks!) these are the ingredients:

  • knowledge of Python

  • a working instance of Home Assistant

  • the appDeamon addon correctly installed and running

The idea (and the dream)

My goal (and dream) is for Home Assistant to decide autonomously when it is appropriate to activate a certain event, based on the history of one or more switches, relating the date and time and the status of other sensors. Based on the calculations performed, if the level of certainty is high it could directly activate the switch, or if it is low (uncertain) it could ask through Alexa (Amazon) if you want to proceed with the activation and based on the answer given it could even modify its data model.

Use case example

  • An automation is automatically created to start the robot vacuum cleaner when nobody is at home, the time slot is from 14:00 to 18:00, the balcony door is closed and the humidity is below 60%.

  • An automation is automatically created to turn on the television when someone is at home, it is between 20:00 and 22:00, dinner is being served, the temperature in the house is above 22°C and there is no upcoming appointment on the calendar.

  • Asked if you want coffee if the time slot is from 12:00 to 14:00, someone is at home, you have just finished having lunch, the temperature at home is below 25°C - if not, the model is modified

Warning: all these automatic automations are based on actions already performed previously, according to probabilistic calculations.

It is not foreseen that the system considers to ask or to execute actions in a completely spontaneous way.

Progress & ToDo

  • (OP#1) Getting the history of a specific switch in specified time period

  • (DF#1) Getting the history from influxdb

  • (OP#2) Getting the history of all connected sensors

  • Caching the history

  • (OP#3) get time slot from the history of the based on sensors

  • (OP#4) Filters the BaseSwitch periodOn data by excluding insignificant events

  • (OP#5) Save the model (and reuse for caching)

  • (OP#6) Listen of variation on baseOnSensor

  • (OP#7) Send an event to Home Assistant with the potential switch

  • (Thanks @Pirol62) consider the variation of time (season, year, ecc...)

  • Optimizing Code

  • Testing

  • more Testing :)

Operation diagram

  1. (OP#1) Getting the history of a specific switch (baseSwitch) in specified time period (by config)

  2. (OP#2) Getting the history of all connected sensors (basedOnSensor - declared on Config) in the time interval in which baseSwitch has been activated (on) since a time specified in configuration

  3. (OP#3) From the history of the various sensors (basedOnSensor), when they change state, group the times by rounding them to a value specified in the configuration, thus obtaining the day of the week, the hour, the minutes of the event and calculate the frequency of repetition

  4. (OP#4) Discard the data that are not satisfactory or because they are too few (by config)

  5. (OP#5) Save the model

  6. (OP#6) Listen to the variations of the basedOnSensor and compare them with the results of the model

  7. (OP#7) Send an event to Home Assistant with the potential switch to manage the probability of it happening. It will be in Home Assistant that will decide what to do, whether to activate the switch or ask the user if they want to activate it.

Problems and difficulties

  1. (DF#1) Unfortunately, I realized that I can't rely on HomeAssistant's history, because the save range for the data is very limited. I have to get the data from influxDB

Want to help? You are welcome!

This is and shall be an open, free and non-profit project; the goal is to create an automated system to manage situations in HomeAssistant.

Or, if you want to thank me for what I do by buying me a coffee:

"Buy Me A Coffee"

No one should and will ever make money from this project.

If you want to help me in any way (advice, code, etc...) you are welcome to do so and I really thank you very much! Use the tools that Github provides!

Imbalaced Classification and Robust Semantic Segmentation

Imbalaced Classification and Robust Semantic Segmentation This repo implements two algoritms. The imbalance clibration (IC) algorithm for image classi

24 Jul 23, 2022
Like htop (CPU and memory usage), but for your case LEDs. 😄

Like htop (CPU and memory usage), but for your case LEDs. 😄

Derek Anderson 3 Dec 08, 2021
Terkin is a flexible data logger application for MicroPython and CPython environments.

Terkin Data logging for humans, written in MicroPython. Documentation: https://terkin.org/ Source Code: https://github.com/hiveeyes/terkin-datalogger

hiveeyes 45 Dec 15, 2022
Homeautomation system created with Raspberry Pi 3 and Firebase.

Homeautomation System - Raspberry Pi 3 Desenvolvido com Python, Flask com AJAX e Firebase permite o controle local e remoto Itens necessários Raspberr

Joselino Santos 0 Mar 09, 2022
Connect a TeslaMate instance to Home Assistant, using MQTT

TeslaBuddy Connect a TeslaMate instance to Home Assistant, using MQTT. It allows basic control of your Tesla vehicle via Home Assistant (currently, ju

4 May 23, 2022
A DUCO (Duino-Coin) miner for GigaDevice ARM boards.

GD32 Duino-Coin Miner Description Contains the firmware and miner software for mining DUCO (Duino-Coin) on GigaDevice GD32 chips. Supported boards GD3

Maximilian Gerhardt 2 Feb 20, 2022
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
Ansible tools for operating and managing fleets of Blinksticks in harmony using the Blinkstick Python library.

Ansible tools for operating and managing fleets of Blinksticks in harmony using the Blinkstick Python library.

Greg Robinson 3 Aug 10, 2022
Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the co

Johan Jonk Stenström 3 Sep 08, 2022
Example Python code for building RPi-controlled robotic systems

RPi Example Code Example Python code for building RPi-controlled robotic systems These python files have been compiled / developed by the Neurobionics

Elliott Rouse 2 Feb 04, 2022
A global contest to grow and monitor your own food with Raspberry Pi

growlab A global contest to grow and monitor your own food with Raspberry Pi A capture from phototimer of my seed tray with a wide-angle camera positi

Alex Ellis 442 Dec 23, 2022
Modeling and Simulation of Satellite Servicing Manipulators

Modeling and Simulation of Satellite Servicing Manipulators Final Project for the course ENPM662: Introduction to Robot Modeling (Fall 2021). This pro

Adarsh M 1 Jan 24, 2022
A install script for installing qtile and my configs on Raspberry Pi OS

QPI OS - Qtile + Raspberry PI OS Qtile + Raspberry Pi OS :) Installation Run this command in the terminal

RPICoder 3 Dec 19, 2021
🏡 My Home Assistant Configs. Be sure to 🌟 my repo to follow the updates!

Home Assistant Configuration Here's my Home Assistant configuration. I have installed HA on a Lenovo ThinkCentre M93P Tiny with an Intel Dual-Core i5-

iLyas Bakouch 25 Dec 30, 2022
Christmasvillage-rpi - Raspberry Pi relay controller for ChristmasVillage.io

ChristmasVillage.io Relay Controller Links ChristmasVillage.io - Live Stream & Controls Youtube Instagram About This repository controls the light rel

Grant Windes 2 Feb 15, 2022
Brogrammer-keyboard - FIrmware for the Brogrammer Keyboard v1.0

Brogrammer Keyboard Firmware The package contains the firmware that runs on the Brogrammer Keyboard v1.0 See https://imgur.com/a/oY5QZ14 This keyboard

Devin Hartleben 1 Apr 21, 2022
Monitor Live USB Plug In & Plug Out Events

I/O - Live USB Monitoring Author: Jonathan Scott @jonathandata1 Date: 3/13/2021 CURRENT VERSION 1.0 This is just a simple bash script that calls a pyt

Jonathan Scott 17 Dec 03, 2022
A PYTHON Library for Controlling Motors using SOLO Motor Controllers with RASPBERRY PI, Linux, windows, and more!

A PYTHON Library for Controlling Motors using SOLO Motor Controllers with RASPBERRY PI, Linux, windows, and more!

SOLO Motor Controllers 3 Apr 29, 2022
An emulated LED scoreboard for Major League Baseball ⚾

An LED scoreboard for Major League Baseball. Displays a live scoreboard for your team's game on that day.

Tyler Porter 8 Apr 08, 2022
PBA: Pleco Breeding Assistant

A small monitor that reports the external, fishroom and water change parameters to have suitable water parameters and induce breeding. These two features already represent 50% of the "reproductive su

Mirko Mancin 1 Jan 19, 2022