Domotics for dummies

Non Joggler related discussion.
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Domotics for dummies

Post by Leonardo »

Hello
I'd like to share what I'm doing with Joggler and other stuffs.
Ingredients:
A Joggler... ok I don't insert an image of it, here we all know it very well!!! :D

a Raspberry PI:

Image

a RFXtrx433:

Image

a 433MHz dimmer, compatible with the big compatibility list of RFXtrx433:

Image

some Python code:

Code: Select all

#!/usr/bin/python

import serial
import sys

port = "/dev/ttyUSB0"
ser = serial.Serial(port, 38400)

command = int(str(sys.argv[1]))
if len(sys.argv) == 2:
   value = 0
else:
   value = int(str(sys.argv[2]))


output = chr(0x0B) + chr(0x11) + chr(0x00) + chr(0x00) + chr(0x00) + chr(0x00) + chr(0x00) + chr(0x01) + chr(0x01) + chr(command) + chr(value) +chr(0x00)
ser.write( output )
and some PHP code (exec.php):

Code: Select all

<?php
	
	if(!empty($_POST)) {
		switch($_POST['cmd']) {
			case 'on':
				exec('sudo /var/www/domotica/send.py 1');
			break;
			case 'off':
				exec('sudo /var/www/domotica/send.py 0');
			break;
			case 'level':
				exec('sudo /var/www/domotica/send.py 2 '.$_POST['params']);
			break;
		}
	}
	
	header('Location: /domotica/');
?>
more PHP code (index.php):

Code: Select all

<!doctype html>
<html>
	<head>
		<title>Domotica</title>
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/layout.css" rel="stylesheet">
	</head>
	<body>
		<div id="container" style="padding:20px;">
			<div>
				<form action="./exec.php" method="post" class="cmdform">
					<input type="hidden" name="cmd" value="on"/>
					<input type="hidden" name="params" value=""/>
					<button type="submit" class="btn btn-success btn-large">On</button>
				</form>
			</div>
			<div>
				<form action="./exec.php" method="post" class="cmdform">
					<input type="hidden" name="cmd" value="off"/>
					<input type="hidden" name="params" value=""/>
					<button type="submit" class="btn btn-danger btn-large">Off</button>
				</form>
			</div>
			<form action="./exec.php" method="post" class="cmdform">
				<input type="hidden" name="cmd" value="level"/>
				<input type="number" name="params" class="input-small" value=""/>
				<button type="submit" class="btn btn-primary btn-large">Livello</button>
			</form>
		</div>
	</body>
</html>
Image

Mix the ingredients and enjoy lightning :D

Ok I'll try to explain hoping someone will find it useful!

RFXtrx433 is a great 433MHz transceiver developed by some Nederlands guys. It's a USB device with a firmware able to drive a lot of 433 MHz devices, X11 protocols, etcetera. I bugget tech support a lot and I got the documentation and the SDK, I used documentation but not SDK, I don't need it because it's enough to send strings to the rs232.
Obviously the documentation is useful to understand what to send, I got it after deconding 10 of the 12 bytes send, I wrote to support saying something like: hello, I just decoded the signal, but I cannot understand this and that byte, can you please explain? :D
And they kinldy send me all the documentation!
So I wrote a very simple Python program to switch on and off light and (300 model is a dimmer) set the value of the dimmer.
The first step I did was to drive the switch from a shell, infact if I do: ./send.py 1 I turn light on, with 0 I turn it off, and with 2 [0-15] I set the 16 different level of the dimmer.
The most difficult thing has done, after this I asked to my collegue Thomas (he's italian but he has a foreing name) to help me to create a simple web interface (I'm not a web developer) and in 5 minutes he created the code you can see avove.
The result (with CSS I didn't past, you can create your own!) is a Joggler can drive the switch.
Obviously this is just the beginning, you can find a lot of differente devices and drive them as you like.
My goal is to drive lights, warming system, monitor alarm, door chimes and whatever I can.
User avatar
hawsey
Posts: 2069
Joined: Sun May 22, 2011 11:23 pm
Location: Northumberland

Re: Domotics for dummies

Post by hawsey »

Definitely interested in any home automation stuff like this :-)
Have you looked at flashXAP I think there is a version that works with the stock Os for the joggler.
So you you are using the rfxcom with the PI and then controlling with the Joggler
Keep us posted with your progress :-)
Happy Joggling
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

Hawsey I took a look but (maybe I didn't understand) it seems XAp uses it's own protocol and there's no way to use other devices? Am I wrong?
User avatar
hawsey
Posts: 2069
Joined: Sun May 22, 2011 11:23 pm
Location: Northumberland

Re: Domotics for dummies

Post by hawsey »

There's a lot of stuff on here about Flash XAP

http://www.dbzoo.com/livebox/xapflash
PeteC has been tinkering with it recently so he might know better about it :-)
The Home Seer forum is a good site for this sort of stuff as well.
Ideally I would like your sort of set up using a PI or maybee my Revo with an Rfxcom transceiver with the ability to control on the possibly with XAP Joggler and also smartphones.
Does anyone else utilise the Joggler in this sort of Home Automation set up?
I think it will take a bit of reading up on for me.....
Happy Joggling
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

Yup; here I have one Joggler PnP'd with Flash xAP on it. Works fine. I used it mostly to test differences between 1-wire connected rain guages via Cumulus.

xAP was developed kind of as an overlay to the network mostly for Home automation. I have asked and helped redo the xap Weather info standards some last year (?). Mostly cuz there is so much more weather data than when the standard was implemented.

That said relating to controlling home automation devices there is little xap widgets to interface with almost every on the line and wireless protocal.

Here my home is a bit of a HA sandbox. I am curently using X10, Insteon, Z-Wave and UPB for lighting control.

I am starting to go into the Zigbee world with my thermostat. It currently is serially wired but has the Zigbee stuff firmware in it. It is very intelligent as a stand alone thermostat and totally remote controllable.

It even has a motion sensor such that it the display goes on when you walk up to it.. That and the whole heating and cooling thing is very difficult with the WAF (wife acceptance factor). WAF can literally break your HA efforts if you are not careful.

IE: I have occupancy and motion sensors and have played with automating lighting with such devices. One day my wife mentioned to me that she preferred to walk around in the middle of the night with no lights instead of having the illumination following here around. That put an end to my interior auto illumination stuff. I do utilize it outside and in the garage and in the basement still though.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

ok but... reading around I cannot understand if I can use xAP for my needs.. xAP I saw has a good interface but it seems it talks using its protocol. At the moment I have this transceiver (obviously I want to use it!) it can send signals to a wide group of different devices, if you take a look to the site rfxcom.com you can see the compatibility list.
My house is very old (it's about end of 1700) and the tubes of electrical service, put during 1970 restoration, are very small (about 10 or 12 mm), so it's really impossibile to put inside a bus cable to send commands. This is why I choose to use RF.
I'd really like to use xAP frontend but I'm afraid I can't!
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

Understood Leonardo. Wow that is a neat house that you have built at the end of 1700.

Here this house is only about 10 years old. Mostly wood with an exterior "shell" of brick. One heavy wind would most likely blow it away. That said though and the construction allows me to put metal tubing easily from the main bus (fuse panel) to rooms in the house. Its a pain to bend and join conduit but it does allow for multiple electrical wires inside of tubing. The switches or circuits automation though is at the light switch or appliance switch and not really at the fuse panel (buse). I do have all of the interfaces from the computers to talk to these devices either inside of the fuse panel or adjacent to the fuse panel. That said from there I utilize RS-232 to Cat5E cable for the longer serial cables. The current in wall UPB switch is basically on a UBP network which is an overlay to the electrical network. Each switch can be addressed/controlled directly or via "links". They are like little computers and have a MAC address and password security. The switches also have multiple functions. IE: a single tap turns on the lamp and fades it at a set rate of 10 seconds to 30%. I have numerous single gang box switches with multiple toggles. The 2,3 and 4 toggle control linked switches with same said functionality. All in all though you can program and talk to the switches with a computer or they can function independant of a computer and control each other. I am getting too old these days to keep up with the technology though as its moving very fast.

Many folks here in the US utilize rfxcom too.

Here I utilize multiple WGL W800 receivers with one attenna in the attic and one in the middle floor of the home.

The walls though interiorly here are all wood and 1/2" or so drywall; easy for radio stuff. I know its totally different there relating to RF transmissions.

All in all its really what you feel most comfortable with and works well for you. What is nice is that there are many choices today where as there were not any choices many years ago.

I started to play with this stuff and it was only X10 in the 1970's; so I had no choice really. I was amazed just that I could utilize a wireless remote control to turn on a light or lamp. It was only 1-way communications; but the ability to turn on a light is what was amazing.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
hawsey
Posts: 2069
Joined: Sun May 22, 2011 11:23 pm
Location: Northumberland

Re: Domotics for dummies

Post by hawsey »

You have probably seen this project where I think XAP started life
http://www.homeautomationhub.com/
It would probably be possible to integrate it with the rfxcom but might take a bit of work :-S .
I see that the rfxcom had a HS2 homeseer software plugin and wonder how well that works.
HS2 also has this hs touch software that looks cool
http://store.homeseer.com/store/HomeSee ... -P980.aspx
This would also be good for the rfxcom I think.
Does the rfx come with much bundled software to control it and is it good if do.
I am really interested in the whole Home Automation thing.
:-)
Happy Joggling
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

I found automation devices (switches, dimmers, controllers, whatever) from COCO Technology, there are a lot of stuff and the price is really good. At the moment I have a couple of things I'm using for some tests, I didn't do anything with xAP yet, as soon as I understand how it works and how to integrate it I can do some test!
User avatar
roobarb!
Posts: 1746
Joined: Sat Mar 05, 2011 1:30 pm
Location: Salford, UK
Contact:

Re: Domotics for dummies

Post by roobarb! »

It's a tad late now, seeing as they've just stopped selling the version with API access, but I've been using an AlertMe system in my house for the past few years. It's a zigbee-based system with a closed hub (grr), with some really nice, small accessories (motion sensors, contact sensors, buttons, remote control plugs, electricity usage reader thingy). You can actually still buy the more recent version of it, sold by British Gas as 'Safe and Secure', but there's no API to their version. They say it's for 'security reasons', which I find completely baffling. "We don't understand your request and can't be arsed to investigate" is closer to the truth, I feel.

In the US the same system is sold by Lowe's as Iris, though they've really gone to town on it. The basic accessories are the same, but they've gone and put compatible zigbee chips in everything from window blinds to outside taps.

Actually, you can still get hold of the original systems on eBay occasionally; there's one on there right now.

http://www.ebay.co.uk/sch/i.html?_nkw=alertme

So long as the original owner tells AlertMe to remove the Hub from their account, you can set it up as a new system.
BirdsLikeWires - Get fresh builds of Debian Bullseye and Bookworm for OpenFrame with the latest 5.10 and 6.1 kernels! 8-)
User avatar
roobarb!
Posts: 1746
Joined: Sat Mar 05, 2011 1:30 pm
Location: Salford, UK
Contact:

Re: Domotics for dummies

Post by roobarb! »

Actually, thinking of AlertMe, I may as well take the opportunity to plug the forum I take care of.

http://forum.alertme.org.uk/

You may well recognise the theme, though including me there are only about 8 people who use it, and half of them are on there to complain! ;)
BirdsLikeWires - Get fresh builds of Debian Bullseye and Bookworm for OpenFrame with the latest 5.10 and 6.1 kernels! 8-)
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

Neat website there Roobarb.

I've been wanting to test out Zigbee now for a while here. Initially it may be my thermostat that I switch over to a Zigbee thermostat. I just found out the new Zigbee thermostat works serially or via Zigbee. My current thermostat has the Zigbee software but no chip for it.

Is Zigbee the most utilitized wireless communications method for automation there in the UK/EU?
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
roobarb!
Posts: 1746
Joined: Sat Mar 05, 2011 1:30 pm
Location: Salford, UK
Contact:

Re: Domotics for dummies

Post by roobarb! »

pete_c wrote:Neat website there Roobarb.

I've been wanting to test out Zigbee now for a while here. Initially it may be my thermostat that I switch over to a Zigbee thermostat. I just found out the new Zigbee thermostat works serially or via Zigbee. My current thermostat has the Zigbee software but no chip for it.

Is Zigbee the most utilitized wireless communications method for automation there in the UK/EU?
Zigbee is becoming popular, but I don't think it's really taken off yet. The mesh networking and low power features really do work well, though. What I'd really like to do is get a Raspberry Pi to chat directly with one of the AlertMe sensors, though. I'm no wireless expert, but I'm sure there'd be a way to connect one of their devices to some form of transmitter/receiver connected to a Pi.

The reason I'm interested is their devices are very nicely designed:

http://www.davidboycedesign.com/archives/144
BirdsLikeWires - Get fresh builds of Debian Bullseye and Bookworm for OpenFrame with the latest 5.10 and 6.1 kernels! 8-)
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

Very nice.

I am still experimenting with wireless sensors and my alarm panel in general.

The issues though that I have seen relating to Insteon and Z-Wave relate to the methodologies utilized for the device networking meshing topologies (IE: routing tables and such) and while the speed of the algorithms relating to the network meshing are better; I don't think they got it yet.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

Hello, yesterday I was playing with xAP, I tryed to let it communicate with my devices, (just a simple web server!), I'd really like to know if there is a way to use xAP to send a http request when I press a button!
I created a button with the standard code:

<button NAME="testing button">
<gridX>0</gridX>
<gridY>0</gridY>
<height></height>
<style>red</style>
<visible>true</visible>
<mode>text</mode>
</button>

then I inserted this portion of code:

<textbox NAME="antani">
<text><![CDATA[<img height="150" width="150" src="http://192.168.1.10/test.html"></img>]]></text>
</textbox>


I tried to set it as a toogle too, with "on" and "off" status, but (obviously) it doesn't work... I just tried to take a piece of code from the textbox tag, the only one seems to parse html calls...

I googled a lot but I really wasn't able to get any info, is there anyone so kind to help me?
Thanks a lot!
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

Hello again, it sould be ok a workaround that allows me to run a system command, so I could arrange with a shell "curl" or something like this!
For this too I wasn't able to fin anything on the web :(
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

Maybe I understand, it's a flash limitation, so I must use iserver (infact I was interrogating me why there's an additional layer for communication).
So I'll look deeper in iserver! Sorry for my stupid question!
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

Personally I like to use an xAP viewer as I play with xAP with different platformsOS's.

http://www.xapautomation.org/index.php?title=xFx_Viewer


With the viewer you can see the structured xAP message being broadcast either to or from a device.

Last summer tested some response times with xAP applications directly connected to IO hardware devices verus through some layers of software. It appeared to me to be much faster than I thought it would be.

My testing was basic.

I ran a little xAP application connected to a wireless X10 receiver. The wireless receiver sent xAP commands to a piece of software running on a linux box which was connected to a serial controllable piece of hardware.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
Leonardo
Posts: 146
Joined: Tue Dec 25, 2012 10:51 pm

Re: Domotics for dummies

Post by Leonardo »

Hi Pete, thanks for answering me!
The fact is I don't have any I/O hardware than the TRXRFX433. It's connected to a RPI with Domoticz (that's becaming always better).
I see Domoticz can receive json query to drive switches, infact with a simple "curl" or a "wget" (obviously with a browser too), I can do a lot of things.
The xAP has a great and very user friendly xml configuration, if I could, in some way use it, it should be very useful and I'd save a lot of work!!!
I didn't find any info about the xml out of the main page (where I found the xAPflash for Joggler), and I don't have any Windows machine to use the viewer, only Linux!
For me should be enough to find how to send (directly or via iserver) a http like:

<code>
http://192.168.1.10:8080/json.htm?type= ... el&level=2
</code>

this will turn a light on and setting the dimmer level to "2".

I tryed to put it on the "textbox" of the example:

<code>
<textbox NAME="Clock">
<posX>600</posX>
<posY>220</posY>
<width>180</width>
<height>180</height>
<visible>true</visible>
<text><![CDATA[<img height="150" width="150" src="http://192.168.1.10:8080/json.htm?type= ... tchcmd=Set Level&level=10"></img
</textbox>
</code>

and it sends the command correctly turning on the light, obviously it does this starting xAP application because it's a direct link of the text box. So it seems xAPflash can send http requests... but... how to integrate them inside a <button></button> tag?!?! I didn't find any doc and I'm doing some tests like a blind :(
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Domotics for dummies

Post by pete »

You can also just utilize tail to watch the logs live (viewer like?)

I think I got as far as installing I-Server for the FlashxAP. I did though configure the Joggler flashxAP with multiple temperature and rain guage stuff as I was testing it. I got as far as making larger fonts and centering them for my text stuff. I think I tested a button or two.

The methodology was different relating to the structure of the xml. I mean the groups were all there; I just didn't know where exactly to put in the commands for the xAP stuff. Yes the instructions are lacking.

I am running today a little application on Arch Linux talking xAP. It is though written in Mono though using VB. Its on a Seagate Dockstar with an ARM CPU and maybe 512 Mb of memory.

Here is a temperature view:

Code: Select all

<page NAME="Page2">
    <group>main</group>[attachment=0]sprinkler.jpg[/attachment]
    <visible>false</visible>
    <button NAME="temp1">
      <gridX>2</gridX>
      <gridY>0</gridY>
      <label>
        <text>Outside</text>
        <fontcolour>0x000000</fontcolour>
        <offset>-20</offset>
        <fontsize>20</fontsize>
      </label>
      <bsctext>
        <fontcolour>0x000000</fontcolour>
      </bsctext>
      <style>outside-temp-icon.png</style>
      <xAP>
        <schema>xAPBSC</schema>
        <uid>FF.0005:0039</uid>
        <source>mcs.OneWire.ICS-HS-2:xapmcs1Wire_Side House Temperature-June.6B000000E772F326.Temperature.1</source>
      </xAP>
      <mode>text</mode>
      <hide>state</hide>
    </button>
In the windows set up it is totally different and a little bit user friendly (see attached).

The Arch Linux is actually a port over from the Windows version; all browser based. See attached.
Attachments
sprinkler.jpg
Homeseer.jpg
xml.jpg
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
Post Reply