Giter Club home page Giter Club logo

homeauto's Introduction

Background on the HomAuto project.

My home automation program has been a work of several years and is used to automate everything that can be in my house.

It originally started out as a python-based set of scripts that would read and write from text-based content with a structure and syntax comprising of key-value pairs. That project is here. https://github.com/7ooL/home_auto_scripts While these scripts work just fine, they do not take kindly to updates. Updates in the form of new smart home devices and changes to any configurations already set. There was no real interface and all updates required new code changes. There were a few different front-end dashboard style interfaces along the way, but nothing that allowed for to much interactions.

HomeAuto

This is a Django based application that makes used of the admin site to administer all aspects of this home automation program.
Automation is achieved in two main ways.

  1. Scheduled Jobs
  2. Nugget firing.

Jobs

First, jobs can be scheduled to do things on a regular basis. There are a number of pre-defined jobs, for example, many that update devices status and look for new devices. Each job can be fine tuned to run at its own frequency depending on what makes sense. Syncing light states from Hue devices is more important than checking if new groups have been defined.

Image of Jobs

Nuggets

Nuggets are made up of Triggers and Actions. When all the Triggers in a Nugget are TRUE then its Actions will be executed. It's this framework that allows for the expansion of automation through a web interface.

Image of Nugget

Triggers

Triggers become TRUE when certain events occur. For example when it’s a specific time, when a door is opened, or when motion is detected. Once a Trigger is defined it can be used in multiple Nuggets, or even combined with other Triggers in a Nugget.

Image of Triggers

Actions

Actions are what happens when all the Triggers in a Nugget become TRUE.

Image of Actions

House Devices

One of the things that HomeAuto does is normalize devices form multiple manufactures into House objects. Current House Objects consist of:

  • House Lights
  • House Locks
  • House Sensors
  • House Motion Detectors

This allows for example Hue Light Bulbs, Decora Switches, and WeMo Plugs to be combined and controlled as House Lights. If I ever get a new device from a different manufacture, it would be just a matter of integrating into the House Models. This happens much less frequent then add a new device from an existing manufacturer.

HomeAuto currently supports devices from the following:

Phillips Hue

  • Bridges (syncing devices)
  • Lights (triggers and actions)
  • Sensors (triggers)
  • Groups (actions)
  • Schedules (triggers)
  • Scenes (actions)

Leviton Decora Wifi

  • api account (syncing devices)
  • Switches (triggers and actions)

Wemo

  • Wifi Smart Plug (triggers and actions)

Vivint Security System

  • Sensors (triggers)
  • Locks (triggers and actions)
  • Panel (syncing devices)
  • Alarm (triggers)
  • Camera (triggers)

Carrier Infinity

  • Systems (syncing devices)
  • Profiles (actions)
  • Activities (actions)
  • Status (triggers and actions)

homeauto's People

Contributors

7ool avatar

Stargazers

 avatar

Watchers

 avatar

homeauto's Issues

after awhile database queries stop working when checking for people status

2020-12-30 12:29:39,020-INFO house.py house register_watcher_event : Found:{arrive}{name}
2020-12-30 12:29:39,022-ERROR house.py house register_watcher_event : Unexpected error:Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (2006, 'MySQL server has gone away')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/ha/web_home_auto/homeauto/house.py", line 118, in register_watcher_event
p = Person.objects.get(user__username=value)
File "/usr/local/lib/python3.7/dist-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/db/models/query.py", line 425, in get
num = len(clone)
File "/usr/local/lib/python3.7/dist-packages/django/db/models/query.py", line 269, in len
self._fetch_all()
File "/usr/local/lib/python3.7/dist-packages/django/db/models/query.py", line 1303, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.7/dist-packages/django/db/models/query.py", line 53, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/usr/local/lib/python3.7/dist-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/dist-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/base.py", line 73, in execute
return self.cursor.execute(query, args)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
res = self._query(query)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
db.query(q)
File "/home/ha/.local/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (2006, 'MySQL server has gone away')

2020-12-30 12:29:39,024-WARNING house.py house register_watcher_event : end of register watcher event - <FileCreatedEvent: src_path='/home/ha/Dropbox/IFTTT/home-auto/December 30, 2020 at 12:29PM (1).txt'>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.