Thanks for this all useful informations. I will give a try with shell commands first.
-
[solved]Connect to Brennenstuhl LAN Gateway 433Mhz
-
I get it to work. Thanks Mwittig!
This script http://my-palm.de/gw433 works nice with parts of my custom code. Now i can use execute commands like this:lightsscript.php 01001 01000 1
And lights switch on. Thanks guys!
-
@Swen That’s great! Are you also able able to receive state changes, for example if you switch a socket using the remote control? I am not sure, whether or not this is possible at all with the LAN gateway.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Hm, no that is a point that i don’t stated yet. I think the LAN Gateway is only a transmitter. If you dont sniff the network, you will never be able to now which state the power switches has.
-
I dont give support for this script, but i hope it can help somebody if i post it here.
#!/usr/bin/php <?php function tx433_send($msg) { $IP="192.168.1.5"; $PORT=49880; $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $len = strlen($msg); if($sock) { socket_sendto($sock, $msg, $len, 0, $IP, $PORT); socket_close($sock); } else { echo "Socket error IP:PORT=".$IP.":".$PORT."\n"; exit(0); } } function tx433_brennstuhl($Master,$Slave,$onoff) { $sA=0; $sG=0; $sRepeat=15; $sPause=5600; $sTune=350; $sBaud=25; $sSpeed=16; $uSleep=800000; $HEAD="TXP:$sA,$sG,$sRepeat,$sPause,$sTune,$sBaud,"; $TAIL=",1,1,$sSpeed,;"; $AN="1,3,1,3,3"; $AUS="3,1,1,3,1"; $bitLow=1; $bitHgh=3; $seqLow=$bitHgh.",".$bitHgh.",".$bitLow.",".$bitLow.","; $seqHgh=$bitHgh.",".$bitLow.",".$bitHgh.",".$bitLow.","; $bits=$Master; $msg=""; for($i=0;$i<strlen($bits);$i++) { $bit=substr($bits,$i,1); if($bit=="0") $msg=$msg.$seqLow; else $msg=$msg.$seqHgh; } $msgM=$msg; $bits=$Slave; $msg=""; for($i=0;$i<strlen($bits);$i++) { $bit=substr($bits,$i,1); if($bit=="0") $msg=$msg.$seqLow; else $msg=$msg.$seqHgh; } $msgS=$msg; $msg_ON=$HEAD.$bitLow.",".$msgM.$msgS.$bitHgh.",".$AN.$TAIL; $msg_OFF=$HEAD.$bitLow.",".$msgM.$msgS.$bitHgh.",".$AUS.$TAIL; if($onoff==1) $msg=$msg_ON; else $msg=$msg_OFF; tx433_send($msg); } function checkdigits($int){ if(!ctype_digit($int)){ die("Only digits no words. Script die.\n"); } } function getallgets($gets){ $datarr = array(); foreach($gets as $key => $value) { checkdigits($value); $datarr[$key] = $value; } return $datarr; } function startcontrol($datarr){ tx433_brennstuhl($datarr['m'],$datarr['s'],$datarr['p']); } if(count($argv)>=4){ $_GET['m'] = $argv[1]; $_GET['s'] = $argv[2]; $_GET['p'] = $argv[3]; if(isset($argv[4])){ $_GET['d'] = $argv[4]; } }else{ echo "To less arguments!\n"; } $data = getallgets($_GET); startcontrol($data); ?>
Now you can control via:
yourscript.php 11111 00000 1
for switch on or:
yourscript.php 11111 00000 0
for switch off.Otherwise for those to add a device in config just do it like this:
{ "id": "light1", "name": "Lamp Desktop", "class": "ShellSwitch", "onCommand": "/home/user/yourscript.php 01101 10000 1", "offCommand": "/home/user/yourscript.php 01101 10000 0" },
Thanks for your support, i hope that i can give a little back of my experiences now.
-
@Swen It looks great to me. Thanks for sharing! Much appreciated.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Is there a good soul to help me with this from the very beginning?
-
You have my attention. Start asking with your issues.
-
@Swen
I have brennenstuhl 433 and i want to send commands to it with web-app and create timers on PC. I have abyss server installed and php on my PC. Can you tell me what next, what software do i have to use, … -
PC? Or did you mean Pi?