Galaxy Flex, read outputs to home automation?

Joined
17 Mar 2015
Messages
25
Reaction score
0
Country
United Kingdom
So, my last question on this system i promise!

I'm running a Fibaro HC2 to control all my lighting and other things around the house. I would like to make use of the alarm sensors in the house by somehow getting the alarm and fibaro to talk to each other. If i have to write an application to do this then so be it. However what protocol does the flex system output for me to tap into to read the zone status?
I currently have it connected to my home network by ethernet but i doubt it reports zone open/closed status on that?

Anyone have any experience of this?

Cheers
Mat
 
Sponsored Links
The panel can communicate in SIA protocol. Take a look at the open Galaxy project. In the source code, you will see the command set for Zone query. Other than that, you would need to buy the SIA publication.

Honeywell software communicates in Microtech format, but this is closed and not even available under NDA.
 
How quick does it report though? Is it instant or does it report every 30 seconds for example?
What about the RS485, Could that be tapped into and the string read?
 
The reading of the zone registers frequency is dependent on your request program. If performing over Ethernet, you may saturate the bus if trying to do this every second. Scraping the RS485 bus is possible, but only for external zones, as the internal to panel are not placed out on the RS485 bus. If you look at the home automation forum, you will find a thread where the guy is using a big Dimension panel and power RIO's. He is reading zone status on the external RIO's from RS485, then using the information for home automation.
 
Sponsored Links
Sorry, I'm a bit green to this. External zones?

I think it's going to be too much work to be honest. The ethernet won't report zone status on the fly so i'm stuck to RS485. To read this properly i need to convert it to RS232 and some how get a cable to the alarm from a computer. I have an ethernet cable in there currently that i could use a couple of the spare wires inside that but it's a fair job.
It's annoying that devices come with ethernet ports and you think it will be able to do everything because its connected to the network. Then you find out that you have to resort to 20 year old protocols to make it work how you want it to.

My last option is to use a fibaro universial binary sensor to read that output of the PIR but from within the alarm box. I have 2 sitting on my desk with 2 inputs each so thats 4 PIR's in total. No idea how to wire them up though! What if i wanted a set/not set command only with them, Is that possible?
 
The panel has 16 on-board zones and you cannot get info on these zones from the RS485 bus. The Dimension 48 has the capability to add another 32 zones via external RIO's and these connect on the RS485 bus, so you can gain information by looking at the traffic going to the RIO's.

With the Dimension, you can also use links to link an input directly to an output, enabling the monitoring of individual sensors. For example, you can place a RIO board near your HA controller, then link a zone to the output on the RIO and connect the RIO output to the HA controller. There are only 4 outputs per RIO, so you may need a few if you want to monitor multiple zones. The Dimension 48 can only take 4 external RIO's, so that gives you capability of 16 outputs if you wanted to do it that way.

It is possible for Ethernet to give a zone status, but I don't think anyone has written an interface yet.
 
Ok thanks, i could write the interface for it but what protocol does the flex output the data over ethernet? I have checked the ports for it and also scanned the IP for activity but it seems dead.
 
It supports SIA over Ethernet the same as it supports SIA over serial/usb. You may need to purchase the latest standards in order to write for Ethernet though.
 
I've managed this, use a 485 to rs232 adaptor and it's quite easy to read the zone status. however as has already been stated, you can't see the 16 on board zones, so need to use ext RIOs. I have a Gal96 with approx 60 zones monitored in this way
 
Chaps,

Apols for the delay, been busy. Anyhow, here's the code I use at home for the Galaxy reading.
I'm not much of a coder TBH, and in anycase there is quite a lot of other stuff going on in here, as I call some web services and other stuff, hopefully though it's of use. To be honest, if you can't follow what's going on here, then frankly you've got no chance of getting this to work!! Lols...!

Good luck, feel free to use the code however you like. It works a treat, in fact this code has been running on a RasPi for over 3 years, without so much as a reboot!


Basics are that the data is encoded (not encrypted) the first section of code pulls that apart, from then its just RIO ids and zone numbers accompanied by the zone resistance in HEX.


Cheers
Dan



pi@bla ~ $ cat galaxy.perl

#!/usr/bin/perl
# Note this adaptor is for Galaxy GD-96
# Client Program

use Device::SerialPort 0.12 ;

#Set up serial port

$ob = Device::SerialPort->new ("/dev/ttyAMA0") || die "Can't Open $PORT: $!";
$ob->baudrate(9600) || die "failed setting baudrate";
$ob->parity("none") || die "failed setting parity";
$ob->databits(8) || die "failed setting databits";
$ob->stopbits(1) || die "failed setting stopbits";

$count=100 ;


system( "logger 'HAL - galaxy.perl rebooted' ");

while (1) {
$dan=$ob->read(1);
select(undef, undef, undef, 0.001); #sleep 250 mS
$req = unpack ("H*" , $dan );
$req =~ s/[^\w]//g ;
$req =~ s/' '//g ;
chomp($req);


if ( $req ne "") {
if ($req eq "11") {
$match = 1 ;
$val1 = $req ;
}

if (( $match == 1 ) && ( $req eq "fe" )) {
$match = 2 ;
$val2 = $req ;
}

if (( $match == 2 ) && ( $req eq "ba" )) {
$match = 3 ;
$val3 = $req ;
}

if (($req != "11") && ($req != "fe") && ($req != "ba")) {
$match = "0" ;
}


if ( $match == 3 ) {
$count = 0 ;
$match = 0 ;
@dan=() ;
push (@Dan , $val1 ) ;
push (@Dan , $val2 ) ;
}

if ( $count < 25 ) {
push ( @Dan, $req ) ;
}


if ( $count == 25 ) {
$epoch = time();
# print "@Dan \n";
if (($dan[3] eq "02") && ($dan[7] eq "f1")) {
# print " $dan[3] == @Dan \n";
$out_21 = $dan[8] . $dan[9] ;
$out_22 = $dan[10] . $dan[11] ;
$out_23 = $dan[12] . $dan[13] ;
$out_24 = $dan[14] . $dan[15] ;
$out_25 = $dan[16] . $dan[17] ;
$out_26 = $dan[18] . $dan[19] ;
$out_27 = $dan[20] . $dan[21] ;
$out_28 = $dan[22] . $dan[23] ;

if (( $out_21 =~ /^07/ ) && ( $out_21_stat ne "O" )) {
open($fh, '>', 'out_21.txt'); print $fh "O $epoch \n" ; close $fh;
$out_21_stat = "O" ;
`curl -d "varname=out_21&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 21 activated - PlantRmPIR' ");
}

if (( $out_21 !~ /^07/ ) && ( $out_21_stat ne "C" )) {
open($fh, '>', 'out_21.txt'); print $fh "C $epoch \n" ; close $fh;
$out_21_stat = "C" ;
`curl -d "varname=out_21&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_22 =~ /^07/ ) && ( $out_22_stat ne "O" )) {
open($fh, '>', 'out_22.txt'); print $fh "O $epoch \n" ; close $fh;
$out_22_stat = "O" ;
`curl -d "varname=out_22&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 22 activated - PlantRmSmoke' ");
}

if (( $out_22 !~ /^07/ ) && ( $out_22_stat ne "C" )) {
open($fh, '>', 'out_22.txt'); print $fh "C $epoch \n" ; close $fh;
$out_22_stat = "C" ;
`curl -d "varname=out_22&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_23 =~ /^07/ ) && ( $out_23_stat ne "O" )) {
open($fh, '>', 'out_23.txt'); print $fh "O $epoch \n" ; close $fh;
$out_23_stat = "O" ;
`curl -d "varname=out_23&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 23 activated - CellarRearDoor' ");
}

if (( $out_23 !~ /^07/ ) && ( $out_23_stat ne "C" )) {
open($fh, '>', 'out_23.txt'); print $fh "C $epoch \n" ; close $fh;
$out_23_stat = "C" ;
`curl -d "varname=out_23&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_24 =~ /^07/ ) && ( $out_24_stat ne "O" )) {
open($fh, '>', 'out_24.txt'); print $fh "O $epoch \n" ; close $fh;
$out_24_stat = "O" ;
`curl -d "varname=out_24&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 24 activated - CellarPassagePIR' ");
}

if (( $out_24 !~ /^07/ ) && ( $out_24_stat ne "C" )) {
open($fh, '>', 'out_24.txt'); print $fh "C $epoch \n" ; close $fh;
$out_24_stat = "C" ;
`curl -d "varname=out_24&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_25 =~ /^07/ ) && ( $out_25_stat ne "O" )) {
open($fh, '>', 'out_25.txt'); print $fh "O $epoch \n" ; close $fh;
$out_25_stat = "O" ;
`curl -d "varname=out_25&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 25 activated - BackLoungeSmoke' ");
}

if (( $out_25 !~ /^07/ ) && ( $out_25_stat ne "C" )) {
open($fh, '>', 'out_25.txt'); print $fh "C $epoch \n" ; close $fh;
$out_25_stat = "C" ;
`curl -d "varname=out_25&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_26 =~ /^07/ ) && ( $out_26_stat ne "O" )) {
open($fh, '>', 'out_26.txt'); print $fh "O $epoch \n" ; close $fh;
$out_26_stat = "O" ;
`curl -d "varname=out_26&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 26 activated - FrontDoor' ");
}

if (( $out_26 !~ /^07/ ) && ( $out_26_stat ne "C" )) {
open($fh, '>', 'out_26.txt'); print $fh "C $epoch \n" ; close $fh;
$out_26_stat = "C" ;
`curl -d "varname=out_26&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_27 =~ /^07/ ) && ( $out_27_stat ne "O" )) {
open($fh, '>', 'out_27.txt'); print $fh "O $epoch \n" ; close $fh;
$out_27_stat = "O" ;
`curl -d "varname=out_27&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 27 activated - FrontLoungePIR' ");
}

if (( $out_27 !~ /^07/ ) && ( $out_27_stat ne "C" )) {
open($fh, '>', 'out_27.txt'); print $fh "C $epoch \n" ; close $fh;
$out_27_stat = "C" ;
`curl -d "varname=out_27&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_28 =~ /^07/ ) && ( $out_28_stat ne "O" )) {
open($fh, '>', 'out_28.txt'); print $fh "O $epoch \n" ; close $fh;
$out_28_stat = "O" ;
`curl -d "varname=out_28&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 28 activated - Spare' ");
}

if (( $out_28 !~ /^07/ ) && ( $out_28_stat ne "C" )) {
open($fh, '>', 'out_28.txt'); print $fh "C $epoch \n" ; close $fh;
$out_28_stat = "C" ;
`curl -d "varname=out_28&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


}


@dan=() ;
}

$count = $count + 1 ;
}
}
 
Sorry guys the forum wouldn't allow me to post the full code (this is just the first 8 zones) but you get the picture.
To ge the other RIOs it's just a case of replacing/adding bits like:

if (($dan[3] eq "03") && ($dan[7] eq "f1")) {
$out_31 = $dan[8] . $dan[9] ;
$out_32 = $dan[10] . $dan[11] ;
$out_33 = $dan[12] . $dan[13] ;
$out_34 = $dan[14] . $dan[15] ;
$out_35 = $dan[16] . $dan[17] ;
$out_36 = $dan[18] . $dan[19] ;
$out_37 = $dan[20] . $dan[21] ;
$out_38 = $dan[22] . $dan[23] ;


if (( $out_31 =~ /^07/ ) && ( $out_31_stat ne "O" )) {
open($fh, '>', 'out_31.txt'); print $fh "O $epoch \n" ; close $fh;
$out_31_stat = "O" ;
`curl -d "varname=out_31&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 31 activated - MasterBedPIR' ");
}

if (( $out_31 !~ /^07/ ) && ( $out_31_stat ne "C" )) {
open($fh, '>', 'out_31.txt'); print $fh "C $epoch \n" ; close $fh;
$out_31_stat = "C" ;
`curl -d "varname=out_31&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_32 =~ /^07/ ) && ( $out_32_stat ne "O" )) {
open($fh, '>', 'out_32.txt'); print $fh "O $epoch \n" ; close $fh;
$out_32_stat = "O" ;
`curl -d "varname=out_32&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 32 activated - SPARE' ");
}

if (( $out_32 !~ /^07/ ) && ( $out_32_stat ne "C" )) {
open($fh, '>', 'out_32.txt'); print $fh "C $epoch \n" ; close $fh;
$out_32_stat = "C" ;
`curl -d "varname=out_32&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}

if (( $out_33 =~ /^07/ ) && ( $out_33_stat ne "O" )) {
open($fh, '>', 'out_33.txt'); print $fh "O $epoch \n" ; close $fh;
$out_33_stat = "O" ;
`curl -d "varname=out_33&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 33 activated - SmallBedSmoke' ");
}

if (( $out_33 !~ /^07/ ) && ( $out_33_stat ne "C" )) {
open($fh, '>', 'out_33.txt'); print $fh "C $epoch \n" ; close $fh;
$out_33_stat = "C" ;
`curl -d "varname=out_33&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_34 =~ /^07/ ) && ( $out_34_stat ne "O" )) {
open($fh, '>', 'out_34.txt'); print $fh "O $epoch \n" ; close $fh;
$out_34_stat = "O" ;
`curl -d "varname=out_34&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 34 activated - SmallBedPIR' ");
}

if (( $out_34 !~ /^07/ ) && ( $out_34_stat ne "C" )) {
open($fh, '>', 'out_34.txt'); print $fh "C $epoch \n" ; close $fh;
$out_34_stat = "C" ;
`curl -d "varname=out_34&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_35 =~ /^07/ ) && ( $out_35_stat ne "O" )) {
open($fh, '>', 'out_35.txt'); print $fh "O $epoch \n" ; close $fh;
$out_35_stat = "O" ;
`curl -d "varname=out_35&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 35 activated - JoshBedPIR' ");
}

if (( $out_35 !~ /^07/ ) && ( $out_35_stat ne "C" )) {
open($fh, '>', 'out_35.txt'); print $fh "C $epoch \n" ; close $fh;
$out_35_stat = "C" ;
`curl -d "varname=out_35&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_36 =~ /^07/ ) && ( $out_36_stat ne "O" )) {
open($fh, '>', 'out_36.txt'); print $fh "O $epoch \n" ; close $fh;
$out_36_stat = "O" ;
`curl -d "varname=out_36&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 36 activated - BackLoungePIR' ");
}

if (( $out_36 !~ /^07/ ) && ( $out_36_stat ne "C" )) {
open($fh, '>', 'out_36.txt'); print $fh "C $epoch \n" ; close $fh;
$out_36_stat = "C" ;
`curl -d "varname=out_36&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_37 =~ /^07/ ) && ( $out_37_stat ne "O" )) {
open($fh, '>', 'out_37.txt'); print $fh "O $epoch \n" ; close $fh;
$out_37_stat = "O" ;
`curl -d "varname=out_37&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 37 activated - BigGaragePIR' ");
}

if (( $out_37 !~ /^07/ ) && ( $out_37_stat ne "C" )) {
open($fh, '>', 'out_37.txt'); print $fh "C $epoch \n" ; close $fh;
$out_37_stat = "C" ;
`curl -d "varname=out_37&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}


if (( $out_38 =~ /^07/ ) && ( $out_38_stat ne "O" )) {
open($fh, '>', 'out_38.txt'); print $fh "O $epoch \n" ; close $fh;
$out_38_stat = "O" ;
`curl -d "varname=out_38&value=O|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
system( "logger 'HAL - Galaxy Zone 38 activated - BigGarageViper' ");
}

if (( $out_38 !~ /^07/ ) && ( $out_38_stat ne "C" )) {
open($fh, '>', 'out_38.txt'); print $fh "C $epoch \n" ; close $fh;
$out_38_stat = "C" ;
`curl -d "varname=out_38&value=C|$epoch&action=Send" http://192.168.100.100/varstore.php` ;
}

}



etc....etc....etc.....


Then something like :

if (($dan[3] eq "04") && ($dan[7] eq "f1")) {
# print " $dan[3] == @Dan \n";
$out_41 = $dan[8] . $dan[9] ;
$out_42 = $dan[10] . $dan[11] ;
$out_43 = $dan[12] . $dan[13] ;
$out_44 = $dan[14] . $dan[15] ;
$out_45 = $dan[16] . $dan[17] ;
$out_46 = $dan[18] . $dan[19] ;
$out_47 = $dan[20] . $dan[21] ;
$out_48 = $dan[22] . $dan[23] ;







You get the picture....

Anyway, the basics are there, it works for me
 
@roasty , would you mind explaining how you have connected the panel to the raspi? Is it RS485 to RS232 connected to the Raspi over USB? I can find RS232 to RS485 converters for around £10 on amazon. are these bidirectional? If you could send me the model / link you are using, that will be a great help.
 
Last edited:

DIYnot Local

Staff member

If you need to find a tradesperson to get your job done, please try our local search below, or if you are doing it yourself you can find suppliers local to you.

Select the supplier or trade you require, enter your location to begin your search.


Are you a trade or supplier? You can create your listing free at DIYnot Local

 
Sponsored Links
Back
Top