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!

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
ArduinoWaterHeaterIOT - IoT Probe of a solar PV water heating system - Arduino, Python, MQTT, MySQL

ArduinoWaterHeaterIOT IoT Probe of a solar PV water heating system - Arduino, Raspberry Pi, Python, MQTT, MySQL The Arduino sends the AC and DC watts

Jacques Fourie 1 Jan 11, 2022
Home Assistant component to handle key atom

KeyAtome Home Assistant component to handle key atom, a Linky-compatible device made by Total/Direct-Energie. Installation Either use HACS (default),

18 Dec 21, 2022
Bucatini: a soft PIPE PHY for FPGA SerDes

Bucatini: a soft PIPE PHY for FPGA SerDes Bucatini is a noodly gateware layer capable of transforming an FPGA SerDes into a PIPE PHY, allowing you to

Great Scott Gadgets 28 Dec 02, 2022
OPNsense integration with Home Assistant

hass-opnsense Join OPNsense with home-assistant! hass-opnsense uses the built-in xmlrpc service of OPNsense for all interactions. This project is curr

Travis Glenn Hansen 54 Jan 03, 2023
Designed a system that can efficiently sort recyclables and transfer them to corresponding bins using Python, a Raspberry Pi, and Quanser Labs.

System for Sorting and Recycling Containers - Project 3 Table of contents Overview The challenge Screenshot My process Built with Code snippets What I

Mit Patel 2 Dec 02, 2022
Lego Mindstorms EV3 and Lego Spike Prime

Lego Mindstorms EV3 and Lego Spike Prime What is FLL? The FIRST LEGO League Challenge Robotics Tournament challenges students from 9 to 16 years old t

Danimar Campos da Costa 1 Nov 14, 2021
Watson-Assistant with integration capabilities

Watson-Assistant-Integration Watson-Assistant with integration capabilities "main.py" should be deployed as Cloud Function (Action) on IBM Cloud. For

Sergey Usachev 1 Dec 20, 2021
A ch341dll Wrap is for using in Python 32bits windows to access I2C SPI and MDIO (by GPIO), and Demo with display PC sreen on OLED by i2c or SPI .

ch341dll_wrap_typcal_app A ch341dll Wrap is for using in Python 32bits windows to access I2C SPI and MDIO (by GPIO). In addition, I provided 3 Demo. I

13 Jan 02, 2023
A Python script to monitor the latest block on an LCD.

PiHole-Monitoring A Python script to monitor the latest block on a lcd display. The first number represents the dns queries from the last 24h, the sec

Maxi 4 Dec 05, 2022
Implementation of Forwards Kinematics, Inverse Kinematics, Point to Point Movement and Synchronous movement for Kuka KR 120 R2700-2.

I made this project for my university course in robotics. I rarely found any information regarding the implementation of mathematics in code. So I decided to make this repo in order to help others :)

2 Dec 27, 2022
Resmed_myair_sensors - This is a Home Assistant custom component to pull daily CPAP data from ResMed's myAir service using an undocumented API

resmed_myair This component will set up the following platforms. Platform Description sensor Show info from the myAir API. Installation Using the tool

Preston Tamkin 17 Dec 29, 2022
Component for deep integration LedFx from Home Assistant.

LedFX for Home Assistant Component for deep integration LedFx from Home Assistant. Table of Contents FAQ Install Config Performance FAQ Q. What versio

Dmitry Mamontov 28 Dec 13, 2022
Cow Feeder is a bot automatically execute trade on cowswap

Cow Feeder is a bot automatically execute trade on cowswap, includes functions: Monitoring Ethereum network gas price and execute trade whe

6 Apr 20, 2022
This allows you to record keyboard and mouse input, and play it back using pynput.

Record and Play with Python! This allows you to record keyboard and mouse input, and play it back (with looping) using pynput. It allows for automatio

George Jensen 45 Jan 02, 2023
Python Wrapper for Homeassistant's REST API

HomeassistantAPI Python Wrapper for Homeassistant's REST API Please ⭐️ the repo if you find this project useful or cool! Here is a quick example. from

Nate 29 Dec 31, 2022
Classes and functions for animated text and graphics on an LED display

LEDarcade A collection of classes and functions for animated text and graphics on an Adafruit LED Matrix.

datagod 31 Jan 04, 2023
Pinion — Nice-looking interactive diagrams for KiCAD PCBs

Pinion — Nice-looking interactive diagrams for KiCAD PCBs Pinion is a simple tool that allows you to make a nice-looking pinout diagrams for your PCBs

Jan Mrázek 297 Jan 06, 2023
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
Toy robot that traverses on a finite surface

Toy Robot Challenge - Release Notes November 12, 2021 New features Initialisation - Users can set the home position and heading of the robot. Position

Ze Fei Teo 0 Feb 03, 2022