Page 7 of 9

Re: My home automation project / software

Posted: Sat Oct 01, 2011 11:23 am
by structor
I thought you also had 'window' sensors with hall efect sensor. I was curious how you build them and mounted them 'casing wise'. Which current voltage clamps are you goning to use?

Re: My home automation project / software

Posted: Sat Oct 01, 2011 3:08 pm
by airox
@Jeffrey: I added debug info the the OOKrelay program from jeelabs. This produced a program which rendered a whole lot of numbers. When you press press / use the item you will see a pattern. I tried to identify the pattern (2000,800,600, etc) and wrote a small "decoder" for it. These decoders only identify the signal send through the air, they don't decode it into usefull data. But for my smoke detectors and the byron doorbell this wasn't needed. I suppose this is also not needed for your tooth brush :-)

Here is the code for the two decoders (which i put in decoders.h of the ookrelay program).
SmokeDecoder is the Flamingo FA12RF and the other one the Flamingo FA15RF. The Byron decoder is the Byron SX30T.

Code: Select all

class FlamingoDecoder : public DecodeOOK {
public:
    FlamingoDecoder () {}
     
    // see also http://homeeasyhacking.wikia.com/wiki/Home_Easy_Hacking_Wiki
    virtual char decode (word width) {
        // ligt tussen 200 en 1200
        if ((width > 740 && width < 780) || (width > 2650 && width < 2750) || (width > 810 && width < 950) || (width > 1040 && width < 1450)) {
 
            // de byte is een 1 of 0 afhankelijk van of het boven
            // of onder de 600 us
            byte w = width >= 950;            
            gotBit(w);
            
        // als width boven de 5000 ligt 
        } else if (pos >= 4 /*&& 8 * pos + bits == 50*/) {
          // if the first six values are 255 in int
          if ( (int) data[0] == 84 && (int) data[1] == 85 && (int) data[2] == 85 && (int) data[3] == 85 ) {
             resetDecoder();
             pos = 1;
             bits = 1;
             data[0] = (byte) 255;
             
             return 1; 
          } else {
             return -1;
          }
        } else
            return -1;
        return 0;
    }
};

class SmokeDecoder : public DecodeOOK {
public:
    SmokeDecoder () {}
     
    // see also http://homeeasyhacking.wikia.com/wiki/Home_Easy_Hacking_Wiki
    virtual char decode (word width) {
        // ligt tussen 200 en 1200
        if (width > 20000 && width < 21000 || width > 6900 && width < 7000 || width > 6500 && width < 6800 ) {
            // de byte is een 1 of 0 afhankelijk van of het boven
            // of onder de 600 us
            byte w = width > 0;
            gotBit(w);
        } else if ( width > 3000 && width < 4000) {
            byte w = width < 100;
        } else if (pos >= 4 /*&& 8 * pos + bits == 50*/) {
          // if the first six values are 255 in int
          if ( (int) data[0] == 255 && (int) data[1] == 255 && (int) data[2] == 255 && (int) data[3] == 255 ) {
             resetDecoder();
             pos = 1;
             bits = 1;
             data[0] = (byte) 255;
             
             return 1; 
          } else {
             return -1;
          }
        } else
            return -1;
        return 0;
    }
};

class ByronbellDecoder : public DecodeOOK {
public:
    ByronbellDecoder () {}
     
    // see also http://homeeasyhacking.wikia.com/wiki/Home_Easy_Hacking_Wiki
    virtual char decode (word width) {
        // ligt tussen 200 en 1200
//        Serial.print("DE ");
  //      Serial.println(width);
    
        if (width > 5100 && width < 5400 ) {
            // de byte is een 1 of 0 afhankelijk van of het boven
            // of onder de 600 us
            byte w = width > 0;
            gotBit(w);
        } else if ( width > 660 && width < 715) {
            byte w = width < 100;
            gotBit(w);
        } else if ( width > 270 && width < 380) {
            byte w = width < 100;
        } else if (pos >= 8 /*&& 8 * pos + bits == 50*/) {
          // if the first six values are 255 in int
           resetDecoder();
           pos = 1;
           bits = 1;
           data[0] = (byte) 255;
           
           return 1; 
        } else {
           return -1;
        }
        return 0;
    }
};
@Structor I use reed contacts for all my doors and three KAKU AMST-606 for the windows. Our windows are all on the first floor, so that's why I did not choose for a reliable method just now. Other problem is getting a nice casing in the windows.
For the doors I used the door draft strips to put the cable in (telephone cable). This fitted perfectly. I used the casing of some old AMST-606 to put the reed contact into. Then put the cable in the draft strips towards the place where it will head to the JeeNode. I do have seen reed contacts inside a nice casing one a wire. Conrad.nl has some of this stuff.. or maybe a more local electronics supplier.

For the clamps. I ordered five of them at seeedstudio (http://www.seeedstudio.com/depot/noninv ... p-547.html). These are also used at the openenergymonitor.org (http://openenergymonitor.org/emon/node/205).
So I hope to get them working properly.

Re: My home automation project / software

Posted: Sat Oct 01, 2011 4:48 pm
by structor
airox wrote:
For the clamps. I ordered five of them at seeedstudio (http://www.seeedstudio.com/depot/noninv ... p-547.html). These are also used at the openenergymonitor.org (http://openenergymonitor.org/emon/node/205).
So I hope to get them working properly.
Interesting I will give the led pulse one more try once i have found my box of electronics (which lost some movingbox). But i already looked into an alternative and saw the openenergy (had seen them before), has the price of those clamps dropped?? Keep me posted.

Re: My home automation project / software

Posted: Mon Oct 03, 2011 9:14 am
by Jeffrey
Thanks Airox for the explanation! This is definitly something to try when time permits.

Re: My home automation project / software

Posted: Wed Oct 05, 2011 8:59 pm
by airox
Damn! Apple stole my product backlog with Siri :-)

Well it brought me a lot of new ideas for my home automation system. The list:

- Add reminders to the home automation system by speech. But more importantly, check where I am when the event begins and send a reminder on the telephone and/or tell it through the home.
- Add reminders based on the position and geofence in or out (which I already built!) I am (leaving work, entering home, entering my living place... etc!)
- Lots of voice commands to add for weather, traphic jams, traphic directions, etc.
- The contextual way of thinking is really nice in Siri!

They were just one step ahead :-(

Re: My home automation project / software

Posted: Fri Oct 07, 2011 9:47 am
by airox
Small update:
- added the possiblity to monitor devices by pinging.
-added possibility to check a webpage for a certain value.

I added these things so i can check the paye of my router for which wireless devices are. Connected. Wired devices i check with ping. Now i can check if the printer, tv, onkyo receiver, ipad, laptops are online. I can also check if my phone is connected. Another way to check if i am home.

Greetings

Gijs

Re: My home automation project / software

Posted: Fri Oct 07, 2011 6:12 pm
by freakstar
Are there plans to make the PHP driver public? I'm very interested in controlling my Z-Wave devices by PHP...

Re: My home automation project / software

Posted: Sat Oct 08, 2011 2:55 pm
by structor
freakster, have a look at Maarten Daamens work on his python wrapper around openzwave. Probably portable to php. Perhaps not my place, but airox has indicated several times that he has no plans for sharing (at this moment).

Re: My home automation project / software

Posted: Tue Oct 11, 2011 2:51 pm
by airox
Freakstar,

I would also suggest to look at open-zwave. Maybe even create a PHP port for it. My Z-wave driver supports a few specific devices which I use in my house (HSM100, Duwi ZS3500, Act HomePro ZTW230, Act HomePro ZDW232, Everspring AN157, Aeon labs door/window, Act HomePro ZRM230). I am sure the open-zwave guys support a bunch more (HVAC?). If you need help creating the driver let me know.

Greetings,

Gijs

Re: My home automation project / software

Posted: Wed Oct 12, 2011 12:12 am
by airox
Small update again. Added the following:

Agent functionality. A PC can run a home automation agent. A simple script which will check if there are actions for it to execute on the local PC. In combination with nircmd I use this to turn of the touchpanel monitor when there is no presence in the room anymore and to turn the touchpanel in standby when we leave the house.

Code for this looks like this:

Code: Select all

$rules[] = Rule::create(Rule::TYPE_MANUAL, 'Touchpaneel scherm uit als geen beweging in de woonkamer')
			->addCondition(new Rule_Statement_FlagBased(PRESENCE_LIVINGROOM, 'ja'))
			->addActionOnTrue(new Rule_Action_AgentCommand('wallpc', 'C:\remote\nircmd.exe monitor on'))
			->addActionOnFalse(new Rule_Action_AgentCommand('wallpc', 'C:\remote\nircmd.exe monitor off'));

$rules[] = Rule::create(Rule::TYPE_MANUAL, 'Touchpaneel uit als beveiliging aan')
			->addTrigger(new Rule_Trigger_FlagValueBased(FLAG_PRESENCE, 'nee'))
			->addActionOnTrue(new Rule_Action_AgentCommand('wallpc', 'C:\remote\nircmd.exe standby'));
Added a telnet plugin which is an action like this:

Code: Select all

new Rule_Action_TelnetCommand('192.168.123.123', 'user', 'password', array('C:\remote\nircmd.exe monitor off'))
Which I didn't needed anymore because of the agent approach.

A timer and clock plugin for the touchpanel also created. Now my girlfriend can use the timer for her cooking stuff ;-) It will alarm and tell the timer has run out throughout the house. I also added a skratchpad. I had seen it from another forum member and I would try to implement it using HTML5 canvas element and some javascript. It's a area in which you can draw with (in my case) the pen of the touchscreen. You can leave messages on it for the other people in your home. The canvas is saved to disk on every edit so it's always in correct state.

Check the pictures of the touchpanel so far on these following links. Notice you can press each icon on the map of my home.
It will show you the image of the camera, a graph of the data of this day or do other stuff.

http://fotoboek.vandulmen.net/domotica/ ... screen.png
http://fotoboek.vandulmen.net/domotica/ ... hpanel.png
http://fotoboek.vandulmen.net/domotica/ ... chpad2.png
http://fotoboek.vandulmen.net/domotica/ ... stairs.png
http://fotoboek.vandulmen.net/domotica/ ... garden.png
http://fotoboek.vandulmen.net/domotica/ ... graphs.png

Re: My home automation project / software

Posted: Wed Oct 12, 2011 12:14 am
by airox
Oh, and the panel is realtime. So it receives updates when new values come along. That's the reason the small graphs with the current values don't have their actual values. I took the screenshots too early :-)

Re: My home automation project / software

Posted: Mon Oct 17, 2011 9:06 pm
by airox
Update:

Integrated the Youw8 weightscale into the system. I now got a tab on the touchpanel named "Health" which shows our BMI, Weight, Muscle mass and Fat percentage. Youw8 is really straightforward to integrate as you will read elsewhere on the forum. Just hookup to their API using OAuth and you can readout the values. No PUSH towards my server so the values will always be out of sync. I checkup on new data every 15 minutes (which is quite often I guess).

Re: My home automation project / software

Posted: Wed Nov 16, 2011 12:11 am
by airox
Update! Have done a lot lately. The most important part is making DeviceProviders and InformationStreamProviders modular! The first step to making it releasable? ;-)

When I did this, adding a module was a piece of cake. So I decided to add some support I wanted a long time. The device following plugins were written.
- Next to the motion and zoneminder plugin I created a more general plugin, the webcam plugin. You can add an URL and it will be usable in events to capture pictures from it. I use it for timelapse videos of some weathercameras nearby for a nice timelampse video on the touch panel.
- Latitude plugin is now capable of adding unlimited devices. The OAuth procedure is baked in :-)

The main work was done on the informationstreamproviders. The modules can be used to fetch information from several sources and put rules on them.
- Facebook wall feed plugin
- Facebook checkins feed plugin
- Facebook foto tags feed plugin
- Twitter messages plugin
- Google Chat plugin (XMPP plugin)
- Facebook Chat plugin
- IRC chat plugin
- P2000 plugin changes (capable of selecting a region in the Netherlands)
- Travel time plugin (monitor travel time from point A to point B using Google Directions API)

As you see there are several chat plugins. This makes it possible to create chatbots which can control your home! :-)
Other plugins are used in my home to let the home automation system tell me through the speakers when someone says my name or responds to a message etc. Pushing social media into your home :-)

I also added some actions:
- Notify my android support (http://www.notifymyandroid.com), push messages to Android devices!
- Toasty support (Windows Phone 7 push messages)
- Set social status (plugins need to support this, facebook, twitter and IRC already do). This lets you set statuses on different social media from your home automation system. Let the whole world know the alarm is triggered ;-)
- Set social checkin (plugins need to support this, facebook, twitter and IRC already do). Let's you checkin on places and add locations to messages on twitter. Autocheckings on Facebook and Twitter based on a Google Latitude devices! :-)

So now we have iPhone, Android and Windows Phone 7 push messages support! :-)

Other alterations:
- Architectural change to allow time based and recurring triggers also to work on seconds. You can now define a recurring event each X seconds.
- A lot of "under the hood" work to make everything modular.
- Beginnings of a new mobile app and getting familiar with PhoneGap to create sort of "universal mobile interface" for the three major mobile OS'es.

Re: My home automation project / software

Posted: Thu Nov 17, 2011 10:05 pm
by Digit
Thanks for the update! I just had to take a look at NMA, looked cool (and it is!):
http://blog.hekkers.net/2011/11/17/send ... fications/
Even a Homeseer script should be able to handle the NMA API :)
(and Prowl too!)

Re: My home automation project / software

Posted: Thu Nov 17, 2011 10:15 pm
by Mdamen
Nice idea indeed! I like it..