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!!!
a Raspberry PI:
a RFXtrx433:
a 433MHz dimmer, compatible with the big compatibility list of RFXtrx433:
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 )
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/');
?>
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>
Mix the ingredients and enjoy lightning
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?
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.