A python3 library to automate (home) devices
Project description
Automate home
Yet another home automation (iot) project because a smart light is more than just on or off.
Overview
When talking about home automation there are at least two goals you could have in mind:
- let a user interact with the home devices through many interfaces locally or remotely
- let devices interact together and let the system change their state
I believe the other home automation projects fits perfectly the first goal, this project focuses on automation, the second one.
What's the difference between this project model and other home automation projects?
The main difference is the design of an Appliance where, with the name Appliance, I refer to entities like a light, a curtain, a sound player ecc.
One of the simplest Appliances I could imagine is a light with two physical states: on and off.
A light model could be designed like a deterministic state machine; all the other home automation projects I know do it like that.
Or it could be designed like a non deterministic state machine; which is how it is done by this project.
When using a deterministic state machine if you have a light with on/off physical states its model states will be just on/off. When using a non-deterministic state machine it is quite simple to have more model states for an on/off light, as an example, your light could be in an alarmed state and it could start blinking.
Behavior-driven development
I believe logics are the building bricks of a smart home system. Nevertheless, they are complex to build, debug and share and one of this project goals is to make it easier.
Having an Appliance grouping together all its logics simplifies debug and reuse.
All Appliances inner states can be tested with BDD style tests like this.
BDD style tests make it quite easy to understand the behaviour of every Appliance in every possible state and thus make it shareable.
I like to think of this project as a way to share behavioural models for our smart devices more easily.
What this project is
A proof of concept.
This project allows me to create and test, through python, automation rules (logics) which can be more complex and more expressive.
I made a draft (I am not a front-end developer) for a really simple web interface. I can interact with the automation rules (logics) through the web interface. Looking at the web interface I can always answer the most obvious questions: why the light is turning on/off, why the curtain is being closed/opened...
I was tired of explaining why some magic was happening in my home. I think I have built a system able to answer these questions by itself.
I integrated really few protocols, the ones I am using the most at my home: KNX, Lifx and Sonos.
For all the other protocol integrations I needed I have used Home Assistant.
Documentation
For a deep dive into this project see the documentation.
For a minute guide to this project see the landing page.
For suggestions, questions or anything else, please, write here: discussions.
Contributing
Pull requests are welcome!
License
The automate-home project is licensed under GPL3.
Example projects
The following are some example projects.
These links point to a statical html example of the final GUI you will obtain using the configuration files, and to a github project with all the configuration files:
Ideally, you should be able to use the configuration files in the examples by changing:
- the
configuration.ini
file, adjusting the paths and the ip addresses; - the files in the
performer
directory, modifying the devices addresses (if you have devices speaking the same protocol); - you can also change automation details in the
scheduler_triggers
directory
Maybe, this page can help me clarify what I mean: landing page.
When, the project configuration files fits your needs, you can use them in different ways.
Installation
Docker image
You can use the following docker image
docker pull majamassarini/automate-home:latest
Yocto build
You can build your personal Linux image with the automate-home framework for your favorite hardware using this yocto distro meta layer.
Pip install
You can just pip install it, but you will not obtain nor the KNX USBHID daemon or the graphite server.
pip install automate-ws
python -m home --configuration-file configuration.ini
python -m ws --configuration-file configuration.ini
python -m graphite_feeder --configuration-file configuration.ini
GUI Example
Latest events
Devices collections
Lights
State of a light
Events history for a light
Events graphs for a light
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file automate-home-0.9.1.tar.gz
.
File metadata
- Download URL: automate-home-0.9.1.tar.gz
- Upload date:
- Size: 126.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35a9df8a3d2aceadcce4a2fc1786dde2adb7189587a1059d47678e3265ee1c3 |
|
MD5 | c9ed862028064b921c3a98ca1fad2086 |
|
BLAKE2b-256 | 60174b016b902896b2d475d1c4fb448dcb3a97adcaa9e7cd957d0361a7b23101 |
File details
Details for the file automate_home-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: automate_home-0.9.1-py3-none-any.whl
- Upload date:
- Size: 359.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a08da556b06a085b4947527ff573cbd90a96a516b2aea6da7e2f70560a15340f |
|
MD5 | 5dfbc7519b3b3125c39adadb42f65eaf |
|
BLAKE2b-256 | bddc5b2273c0bb8656809b25241bf922284bb8c5514ee8f7e7054ca3aaee4527 |