[CODE] Map House + scheduler + Speech recognition + stats

Moderator: Telldus

Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

[CODE] Map House + scheduler + Speech recognition + stats

Post by Manticus2 »

WHAT'S THIS ?

YouTube demo : http://youtu.be/G2vwF3t49f0
YouTube complet demo HD with annotation : http://www.youtube.com/watch?v=l6r5DSuqOUI

I have created one map of my house in HTML5 and I control my lights and my heatings with the tellstick net

I control also my freebox TV (french box with ADSL),
my projector with LAN (viewsonic PJD6221),
I'm using the speech recognition to show actions on my devices (in developpment : 80% done),
and all the 5 minutes the sensor is checked and heatings are started or stoped depending on the temperature !

I have a crontab who call my scheduler page every 5 minutes with phpsessid given in get param.

My php session doesn't expire and I have on my desktop one shortcuts :
http://xxxxxx.xx/?PHPSESSID=xxxxxxxxxxxxxxxxxxxx
This link give an access without identification

HOW TO INSTALL IT :

You need to configure the php server :

Code: Select all

1	sudo apt-get install php5 curl php5-dev php5-curl php-pear libpcre3-dev make 
2	sudo pecl install oauth
3	pear install channel://pear.php.net/HTTP_OAuth-0.3.1
4	pear install HTTP_OAuth
5	sudo nano /etc/php5/apache2/php.ini # add extension=oauth.so at the end of the file
6	sudo /etc/init.d/apache2 restart


for voice command :
5	sudo apt-get install sox aften flac
6	sudo apt-get install alsa-utils
7	sudo apt-get install pulseaudio
Download the package and unzip it in /var/www/
Configure the web acces to the new folder ...

Edit the file : config.php with your parameters
exemple :

Code: Select all

telldus_secret = your private key
telldus_key = your public key

define('TELLDUS_CLIENT', 123456);
define('DEVICE_SOUND', 54114);
define('SENSOR_BEDROOM', 34748);
(help : how to know my PHPSESSID ? Use the link : http://xxxxxx.xxxxx/?whatismyphpsessid )

Add this line in /etc/crontab

Code: Select all

*/5 *  * * *   root    cd /tmp/ && wget "http://xxxxxxxxx.xxx/scheduler.php?PHPSESSID=xxxxxxx" -nv -b > /dev/null
Create the file /etc/init.d/telldus-listener with the content :

Code: Select all

cd /var/www/xxxxxx/voice && ./3_listener YOUR_PHPSESSID
Give possibility to execute this file in starting your system :

Code: Select all

sudo chmod +x /etc/init.d/telldus-listener
Add in /etc/rc.local before the line "exit 0" :

Code: Select all

/etc/init.d/telldus-listener
Go in root folder and give a write access to files and folders :

Code: Select all

sudo chown www-data:www-data -R parameters
sudo chown www-data:www-data voice/2_dialog.log

Info : One security on the page, if one guy try to use this personnal login, he's killed because I check the client ID

SOME SCREENSHOTS :

The map ...
with a slidebar to start/stop the heatings only when I want (All time / Only night and weekend / Never)...
and a log console to see activities.
Image

My freebox remote :
Image

My projector remote :
Image

Scheduler events :
Image

Context menu (right click) :
Image

The speech recognition (only in chrome and on android for now) :
Image
All devices are named : "location - name"
For exemple :
The light in the bedroom is named on telldus live : "Bedroom - Light"
If I said : "Start the light on the bedroom" the script convert speech to text and analyze "start + light + bedroom"
And the action is to turn on the device :)


Last update :
- add graphs for temperature and humidity
- add context menu (right click)
- optimization of code

Have FUN !
Last edited by Manticus2 on Mon Nov 18, 2013 12:54 pm, edited 34 times in total.
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House

Post by Manticus2 »

update
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
lioelec
Posts: 60
Joined: Fri Mar 17, 2023 9:45 am
Location: TARN 81 France
Contact:

Re: [CODE] Map House

Post by lioelec »

Hi

good work, I test that as possible
telldus Live!, http://tellmon.net, http://templight.se, Domospeak
tellstickNet rev17
20x otio,chacon,phoenix,GAO
2x THN132N
1x niclasf wireless t° sensor
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House

Post by Manticus2 »

Big update for all interested :wink:
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
swemag
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: [CODE] Map House + scheduler

Post by swemag »

I downloaded it now and will check it out this evening. It looks interesting!

Is it hard to get it up and running or is it just to unpack?
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler

Post by Manticus2 »

Hi,
You need to edit the file config.php

- you have device's ID on this page : http://api.telldus.com/explore/devices/list
- you need your key on this page : http://api.telldus.com/keys/index

You need to configure the php server :

Code: Select all

1	sudo apt-get install php5 curl php-curl
2	sudo pecl install oauth
3	sudo nano /etc/php5/apache2/php.ini # add extension=oauth.so at the end of the file
4	sudo /etc/init.d/apache2 restart
I think it's all ...
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
swemag
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: [CODE] Map House + scheduler

Post by swemag »

Hi again.
Some questions regarding the inputs in config.php:

I got 4 keys from telldus API keys: private, public, token, token secret.
Is 'telldus_key' the private key and 'telldus_secret' the token secret key?

are the devices defined like this
define('DEVICE_Light', xxxx); where the xxxx is the device number? (or should it just be '0'?)

and the last question.
How/Where do I configure the PHP server

I use Xampp

I get this error message:

Warning: require_once(HTTP/OAuth/Consumer.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\home\config.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'HTTP/OAuth/Consumer.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\home\config.php on line 5
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler

Post by Manticus2 »

Hi,
swemag wrote: Some questions regarding the inputs in config.php:

I got 4 keys from telldus API keys: private, public, token, token secret.
Is 'telldus_key' the private key and 'telldus_secret' the token secret key?
telldus_secret = private key
telldus_key = public key
swemag wrote: are the devices defined like this
define('DEVICE_Light', xxxx); where the xxxx is the device number? (or should it just be '0'?)
Yes it's the current ID of your device

exemple :
define('TELLDUS_CLIENT', 123456);
define('DEVICE_SOUND', 54114);
define('SENSOR_BEDROOM', 34748);
swemag wrote: I use Xampp

I get this error message:

Warning: require_once(HTTP/OAuth/Consumer.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\home\config.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'HTTP/OAuth/Consumer.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\home\config.php on line 5
you need help for the installation of OAuth in php (maybe : http://stackoverflow.com/questions/5535 ... ation-help )
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
swemag
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: [CODE] Map House + scheduler

Post by swemag »

Finally got it to work!

Had to do some reading to get the PHP extensions I needed for your code. It was a couple of extensions that weren't in the xampp package.

I also had to do some alterations to your index.php - code to get it to work with my switches/sensors.

I must say you done a really good job!!
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler

Post by Manticus2 »

thx !

And it's not finish, I'm working on the voice recognition ;)
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler

Post by Manticus2 »

first post edited with new features but package is not available for now...
please waiting :lol:
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
swemag
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: [CODE] Map House + scheduler + Speech recognition

Post by swemag »

Hi again.

I'm struggling to understand how you've made the logging of events since it will not work on my system.

could you explain this piece of code?

$logs = shell_exec('tail -n 60 '.ACTIONS_LOG.' | grep "\[DOMOTIQUE]"')

edit: I'm using xampp on a windows conputer so it's probably a linux/Windows-syntax problem..
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler + Speech recognition

Post by Manticus2 »

swemag wrote: $logs = shell_exec('tail -n 60 '.ACTIONS_LOG.' | grep "\[DOMOTIQUE]"')
Yes shell_exec is a linux function only, it's for execute a command in this system.
And tail with the option "-n 60" is a linux command to display the last 60 lines of the file
the "|" is for redirect the output in the next command on the right (who is : grep)
and the command grep is a filter to return only lines of files who content the string : "[domotique]" because I'm using this files to log other software too :)

so !
on windows you can replace :

Code: Select all

      $logs = shell_exec('tail -n 60 '.ACTIONS_LOG.' | grep "\[DOMOTIQUE]"');
      $logs = str_replace("\n", '<br />'."\n", $logs);
by

Code: Select all

      $logs = file(ACTIONS_LOG);
      $logs = array_slice($logs, -60);
      $logs = implode('<br />'."\n", $logs); 
this code will be in new package with speech recognition ;)
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler + Speech recognition

Post by Manticus2 »

package updated, same link to download
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
Manticus2
Posts: 108
Joined: Fri Mar 17, 2023 9:45 am
Location: France - Bordeaux
Contact:

Re: [CODE] Map House + scheduler + Speech recognition

Post by Manticus2 »

package updated !

big changes :
all requests are in ajax
add feature in timer to execute actions enter 1 minute and 24h

Edit : Thx to all replies and support by mail :)
Image Using a Tellstick Net
Web app with group of devices : here
Map House + scheduler with sensors + Speech recognition : here
Android app : Domospeak
Post Reply