Hello all together,
i have a LAN to 433MHz Gateway from Brennenstuhl. Must be the same like Connair. Is there a way to controle my power switches with pimatic over this LAN gateway? I haven’t find anything in web.
Thanks for help.
[solved]Connect to Brennenstuhl LAN Gateway 433Mhz
Hello all together,
i have a LAN to 433MHz Gateway from Brennenstuhl. Must be the same like Connair. Is there a way to controle my power switches with pimatic over this LAN gateway? I haven’t find anything in web.
Thanks for help.
well, i guess this is not possible (yet). there are no protocols / api for these gateways, at least i did not find any useful information on that.
but you can use homeduino to control your remotes! check the howto
don’t know if this will help developing a possible plugin
https://github.com/power-web/connair-webapp
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebook
make it so !
I found this:
http://simple-solutions.de/forum/viewtopic.php?t=260
Web-App will be possible, too. So with shell commands i can controll this. But i hope there is a better solution then this.
@Swen I found similar information as part of Amazon product reviews which sometimes provide valuable information. One of the reviewers has written a php script which might be useful for experimenting. If you have a working solution based on a simple example it’ll be possible to write a plugin or extend an existing - possibly homeduino. If the scripted solution is good enough it would also be possible to integrate this using a ShellSwitch - see pimatic-shell-execute
http://my-palm.de/gw433
http://www.amazon.de/Brennenstuhl-Brematic-Automation-Gateway-1294100/product-reviews/B00EPR87O0
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Yes, this solution was an alternative chance to get control my power switches. Otherwise i use pilight and build a 433MHz receiver/transmitter.
OK thanks guy’s. Are there tutorials to write plug ins by myself?
@Swen My suggestion is to try ShellSwitch first as it is probably good enough for what you’re trying to achieve and it is a lot easier than rolling your own plugin. If you want to look into plugin development though, you’ll find more information at https://pimatic.org/guide/development/
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Thanks for this all useful informations. I will give a try with shell commands first.
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?