Giter Club home page Giter Club logo

home2l's Introduction

Home2L Icon

What are the Home2Ls?

The Home2L [houmtu:l] suite is a collection of tools and libraries for automation in private homes. Its main features are:

  • Home2L Resources: Novel concept to integrate and manage sensors, actors or services of any kind efficiently and precisely.

  • Automation rules written in Python - but not limited to that.

  • Easy integration of services and new devices - via MQTT, in C/C++, Python or by a shell script.

  • Home2L Brownies: Simple and efficient automation bus to interconnect cheap 8-bit microcontrollers for do-it-yourself sensor or actor hardware.

  • Home2L WallClock: Lightweight, concise, and responsive information display, suitable to be installed on cheap tablets or minicomputers and mounted in all rooms - just like a wall clock.

  • Interactive floor plan for all kinds of gadgets (windows, shades, lights, phones, computers, services, ...).

  • Video door phone and inter-room communication (SIP-based).

  • Playing music anywhere at home (MPD-based).

  • Family calendar (in WallClock).

  • Docker image and improved tutorial for getting started quickly.

What is New?

  • WallClock: Power meter for votovoltaic systems

  • WallClock: User-configurable floorplan icons

  • WallClock: Improved and more self-contained Android app

  • MQTT bridge: Support for JSON payloads

  • New drivers: Fingerprint, Fronius

  • Many small improvements and some bug fixes

How Can I Try It? Get More Information?

The main place of documentation is the Home2L Book. The APIs for developing rules and drivers or to extend the Home2Ls are documented with Doxygen: C/C++ API, Python API.

The suite comes with a Docker Demo Image allowing to test the suite easily. The Home2L Book contains a a step-by-step tutorial demonstrating the key features of the Home2L suite.

For the brave and the impatient:

$ xhost +local:  # allow X11 applications to open windows
$ docker run -ti --rm \
  --name home2l-showcase --hostname home2l-showcase \
  -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
  --ipc=host --device /dev/snd \
  gkiefer/home2l

What is Special About the Home2Ls?

Versatile Resources Library

The central component of the Home2L suite is the Resources library. It connects physical sensors and actors, software services, computers and more. Everything that can act or sense in the widest sense, can be modelled as a resource in the Home2L suite.

All resources are arranged in a common namespace, but driven and accessed in a completely distribited way from any computer. They can be manipulated or read out using the library, which provides full network transparency and supports arbitrary concurrent accesses from any process on any machine anytime.

Resources are manipulated by means of independent requests with individual attributes like priorities and time intervals. The user pushes a button to open the window blinds. One second later, a timer-triggered automatic rule tells the blinds to close. What should happen now? The request model allows to clearly specify priorities (e.g. user interaction in favor of automation rules) and to handle concurrency properly.

The Home2L Shell is a powerful administration tool and allows to access resources and submit requests on the command line or by shell scripts.

Both automation rules and resource drivers can also be part of a larger program. Any software linking against the Resources library can access resources or publish own run-time information as resources.

Efficient and Lightweight Design

All core components are written in C/C++, with a very minimum set of external dependencies beyond libc - ideally suited for small embedded devices and microcontrollers. There is no need for a Java runtime environment or a heavy web framework. Starting up a server and a command shell and shutting both down again takes less than a second altogether - on an ARM-based minicomputer running at 144 MHz!

The Home2L WallClock is written in native code (C++) and only uses SDL2 for its UI toolkit. This makes it very portable and lightweight. Low-cost, low-performance minicomputers or Android tablets can be used as end-user devices, there is no need to install and regularly update a full-featured web browser on them.

Ambient Intelligence, No Need for a Central Server

Central servers are single points of failure. Home2L follows a completely distributed concept. Any (mini-)computer can act as part of the network. If resources, such as sensors or actors, are connected to them, they can be exported to any other host in the Home2L network. A failure of a host only causes its own resources to be unavailable - everything else keeps on working.

Automation Rules Written in Python - But Not Limited to That

There is no new language or tool to learn to formulate automation rules. Home2L rules written in Python profit from the simplicity and power of the Python language. There can be multiple rules scripts, they can run on any machine, and they may be combined with other software routines or be part of larger applications.

Other ways to interact with Home2L resources is via the C/C++ API from any application or by shell scripts using the Home2L Shell.

Integrating Sensors/Actor Hardware and Services: MQTT, Python, Shell Scripts, ...

MQTT-enabled devices can be imported directly using the MQTT gateway driver.

An API for resource drivers allows to easily add support for new hardware or services. A driver can be implemented

  • in native C/C++ code,
  • as a shell script,
  • in Python.

For all three cases, documented examples are available in the source tree.

Easy Integration of Do-It-Yourself Hardware

Home2L Brownies are programmed low-cost microcontrollers (AVR ATtiny 84/85/861) connected to a Linux host over 4-wire cables (e.g. KNX/EIB cables). The bus protocol is based on i2c, robust and allows to build very simple, self-made hardware nodes. Just an ATtiny device and two resistors are enough to build a sensor node! Additional circuitry such as crystal clock generators, transceivers or voltage regulators are not necessary.

Home2L Brownies can drive, for example, window/door/light sensors (GPIOs), temperature sensors, or window shades/actuators.

The Home2L suite includes a software stack for the Linux (host) and for the microcontroller (device) side. The protocol includes various mechanisms for error correction/avoidance, host notification, as well as a variety of maintenance tools for remote configuration, diagnosis, collection of statistics, remote software updates, and device resurrection for the case that a software update failed and the device is difficult to reach physically.

Privacy

The Home2Ls do not need an Internet connection and do not try to communicate with hosts other than they are configured to. By design, the Home2Ls communicate with each other over a (trusted) LAN, which can easily be set up and secured using standard Linux/UNIX techniques. The open source licensing ensures transparency for what the software does inside the user's private home.

Modularity

The core part, the Resources library, is kept small and portable with APIs for application programs and drivers in C/C++ and Python. All other components are optional and can be used or replaced by alternatives as desired by the user.

How can I Help?

The code has been published with the hope that is useful to the community. To let the project grow further and make available to a broader audience, volunteers and partners are welcome.

Great contributions are:

  • Report and help fixing bugs.

  • Make sample installations, document them and share your experiences.

  • Packaging: Create packages for major Linux distributions.

  • Documentation: Write good documentation, particularly for end users.

For any questions on how to participate, do not hesitate to contact us directly.

Questions?

Feel free to contact: Gundolf Kiefer <[email protected]>

home2l's People

Contributors

gkiefer avatar mc3 avatar pfeffix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

home2l's Issues

Basic / productive install problems

I successfully tested the demo environment with brownies and own MQTT server.
But I can't install the productive environment properly.

After the installation according to chapter 3.3 in the home2l-book, I run home2l server and get the error below:
/usr/local/bin/home2l: Line 71: home2l-server: Command not found.
 
I run the command with home2l and root user with the same result.
The directory /opt/home2l/bin/amd64/ only contains home2l-daemon*.

 
I always used a fresh install and tested with following OS:

  • Debian 11 (5.10.0-21-amd64)
  • Debian 10.13 (4.19.0-23-amd64)
     

 
Step 1:

sudo nano /etc/apt/sources.list
---
deb http://deb.debian.org/debian/ bullseye main contrib
deb-src http://deb.debian.org/debian/ bullseye main contrib
deb http://security.debian.org/debian-security bullseye-security main contrib
deb-src http://security.debian.org/debian-security bullseye-security main contrib
deb http://deb.debian.org/debian/ bullseye-updates main contrib
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib

Step 2:

sudo apt-get -y --no-install-recommends install \
      make g++ git \
      python3 swig python3-dev libreadline-dev \
      libsdl2-dev libsdl2-ttf-dev \
      gettext imagemagick inkscape \
      libmosquitto-dev \
      libmpdclient-dev \
      gcc-avr avr-libc

git clone https://github.com/gkiefer/home2l

cd home2l

Step 3:

make CFG=basic


---
OUTPUT:
############################################################
#
#       tools
#
############################################################


#### Building 'tools' - common files...

make[1]: Entering directory '/home/test/home2l/tools'
../wallclock/home2l-fpc etc/floorplan.svg
Home2L Floorplan Compiler

Reading 'etc/floorplan.svg'...
Writing 'etc/floorplan.fpo/map.conf'...
Writing 'etc/floorplan.fpo/sample-resources.conf'...
Creating 'etc/floorplan.fpo/mini.bmp'...
Creating 'etc/floorplan.fpo/full.bmp'...
make[1]: Leaving directory '/home/test/home2l/tools'



#### Building 'tools' for 'amd64'...

make[1]: Entering directory '/home/test/home2l/tools'
Updating 'config.H' and 'config.C'...
CC /tmp/home2l-build/amd64/config.C
CC ../common/base.C
CC ../common/env.C
CC home2l-daemon.C
LD home2l-daemon
make[1]: Leaving directory '/home/test/home2l/tools'



#### Building 'tools' for 'armhf'...

make[1]: Entering directory '/home/test/home2l/tools'
Updating 'config.H' and 'config.C'...
CC /tmp/home2l-build/armhf/config.C
/bin/bash: line 1: arm-linux-gnueabihf-g++: command not found
make[1]: *** [../Setup.mk:296: /tmp/home2l-build/armhf/config.o] Error 127
make[1]: Leaving directory '/home/test/home2l/tools'
make: *** [Makefile:272: build] Error 1

Step 4:

sudo make CFG=basic install


---
OUTPUT:
############################################################
#
#       tools
#
############################################################


#### Installing 'tools' - common files...

make[1]: Entering directory '/home/test/home2l/tools'
Creating /opt/home2l/VERSION...
install -Dp -m 755 -t /opt/home2l/bin home2l home2l-adb home2l-install home2l-rollout home2l-sudo home2l-demo
install -Dp -m 644 -t /opt/home2l env.sh README
install -Dp -m 755 -t /opt/home2l/install initd-home2l
install -Dp -m 755 -t /opt/home2l/bin h2l-mkdir.sh
if [ ! -e /opt/home2l/etc ]; then \
  find etc/ -type f -exec install -Dpm 644 "{}" "/opt/home2l/{}" \; ; \
  chmod a+x /opt/home2l/etc/rules-* ; \
fi
make[1]: Leaving directory '/home/test/home2l/tools'



#### Installing 'tools' for 'amd64'...

make[1]: Entering directory '/home/test/home2l/tools'
Updating 'config.H' and 'config.C'...
BIN=/opt/home2l/bin/amd64;   \
install -Dp -s -m 755 -t $BIN /tmp/home2l-build/amd64/tools/home2l-daemon;   \

make[1]: Leaving directory '/home/test/home2l/tools'


#### Installing 'tools' for 'armhf'...

make[1]: Entering directory '/home/test/home2l/tools'
Updating 'config.H' and 'config.C'...
CC /tmp/home2l-build/armhf/config.C
/bin/bash: line 1: arm-linux-gnueabihf-g++: command not found
make[1]: *** [../Setup.mk:296: /tmp/home2l-build/armhf/config.o] Error 127
make[1]: Leaving directory '/home/test/home2l/tools'
make: *** [Makefile:291: install] Error 1

Step 5:

sudo adduser --disabled-password --gecos "User for auto-started Home2L instances" home2l
sudo chown -R home2l.home2l /opt/home2l/
/opt/home2l/bin/home2l-install -i
sudo echo "export PATH=\$PATH:/opt/home2l/bin:/opt/home2l/bin/`dpkg --print-architecture`" > /home/home2l/.bashrc

Step 6:

sudo nano  /opt/home2l/etc/home2l.conf
---
rc.config="" # declare that there is no 'resources.conf' file

# Configure the Brownies driver ...
drv.brownies=1 # enable the Brownies driver
br.link=/dev/ttyUSB0 # define the i2c device (adapt as adequate)

# Configure MQTT ...
drv.mqtt=1 # enable MQTT
mqtt.broker = 192.168.178.5:1883
mqtt.username = debug
mqtt.password = password
---

Step 7:

sudo nano /opt/home2l/etc/brownies.conf
---
# 008....
---

Step 8:

home2l server

---
OUTPUT:
/usr/local/bin/home2l: line 71: home2l-server: command not found

mqtt.birthAndWill not updated during long-term interface failure

If the bus connection gets lost and recovering isn't successful, the mqtt.birthAndWill topic is not updated and stays in online state.
The brownie device status topics are correctly set to ?, during the connection lost.
If I manually stop the home2l-server, the mqtt.birthAndWill topic gets the correct offline value.
I use the latest home2l release with an ELV USB-I2C adapter on amd64 hardware with Debian 11.

home2l.conf:
mqtt.birthAndWill = status:offline:online

Debug logs:

home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2346): /dev/ttyUSB0: Not a socket: /dev/ttyUSB0 .  
home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2672): /dev/ttyUSB0: Interface problem (received neither ACK nor NACK)
home2l[448]: [home2l-server] WARNING (/brownies/brownies.C:2838): /dev/ttyUSB0: Bus connection lost: Recovering.
home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2346): /dev/ttyUSB0: Not a socket: /dev/ttyUSB0 .
home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2672): /dev/ttyUSB0: Interface problem (received neither ACK nor NACK)
home2l[448]: [home2l-server] WARNING (/brownies/brownies.C:2838): /dev/ttyUSB0: Bus connection lost: Recovering.
home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2346): /dev/ttyUSB0: Not a socket: /dev/ttyUSB0 .
home2l[448]: [home2l-server] DEBUG-1 (/brownies/brownies.C:2672): /dev/ttyUSB0: Interface problem (received neither ACK nor NACK)
home2l[448]: [home2l-server] WARNING (/brownies/brownies.C:2838): /dev/ttyUSB0: Bus connection lost: Recovering.
...continues with same messages

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.