Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /customers/9/b/5/fun-tech.se/httpd.www/FunTechHouse/class.page.php on line 126 FunTechHouse - WeekTimer

The FunTechHouse project, a open source home automation system - WeekTimer

Abstract

This WeekTimer project has 3 parts.

  1. A MQTT server with websockets support.
  2. A Webserver that provides html5 pages as user interface. Please note the javascript part that enables mqtt over websockets in the web browser.
  3. WeekTimer programs
    • "GPIO", that controls a couple of relays connected to a PI
    • "Nexa", that controls Nexa wallsockets through a Tellstick duo

In this example I have put the webserver, mosquitto and gpio weektimer in a raspberry pi, and the nexa weektimer on a random pc on the same network.

But you could put it all on the Raspberry PI.

Install Mosquitto

Follow all the instructions on the mosquitto page.

Please note that you need a version of mosquitto that is compiled with web socket support, and since websockets support in mosquitto is experimental it is not used in most prebuilt packages. This is the reason why I use a build-script to build mosquitto.

Install WebServer

Install and configure lighttpd as webserver.

cd ~/funtech/FT_Tools/
sudo ./pkg.raspian.lighttpd.sh
sudo adduser $USER www-data

Then check so the webserver is running either with your pc, or locally with curl, you should see a "placeholder page".

curl localhost

Activate group settings (restart the system).

Then put FunTechHouse_Web project in the www dir and use it.

cd /var/www
git clone git@github.com:jsiei97/FunTechHouse_Web.git funweb
chown -R $USER.www-data funweb/
sudo sed -i 's/\"\/var\/www\"/\"\/var\/www\/funweb\"/g' /etc/lighttpd/lighttpd.conf
sudo service lighttpd force-reload

Now check that lighttpd loads FunTechHouse_Web and not the "placeholder page".

WeekTimer

WeekTimer GPIO

Then we can get the WeekTimer that is using gpio over sysfs.

cd ~/funtech/
git clone git@github.com:jsiei97/FunTechHouse_WeekTimer_Nexa.git -b sysfs_gpio WeekTimer_gpio
cd WeekTimer_gpio
git submodule init
git submodule update
qmake
make -j

For now start it with.

./WeekTimer 

Now you can go over to the webpage and talk to him...

WeekTimer Nexa

Feature description

The WeekTimer has a focus on what day of week it is, and has an option to force it either on or off for a specified time.

The basic timer is programmed by a couple of "timer lines", where each "line" has a starting day of week, hour, minute and a ending day of week, hour, minute. Each "line" is then separated from each other with a ';'.

Syntax

Valid wildcards for day of week.

dow means
0 all days
1..7 mon to sun
8 mon to fri aka weekday
9 sat to sun aka weekend

Example

A timer that is on all weekends between 21:00 and 22:30 would look like.

9:21:00-9:22:30;

And if we also would like it to be on during Friday nights, we would add another line.

9:21:00-9:22:30; 5:21:00-5:22:30;

Then let's say you would like it turn be on all mornings between 7 and 9, we would add.

9:21:00-9:22:30; 5:21:00-5:22:30; 0:07:00-0:09:00;