New at Home Assistant - Question about the SIA DC-09 Coupling of a Bosch AMAX alarm system

Good morning together,

I switched from openHAB to Home Assistant this week and now try to rebuild the old functionality.
In a direct comparison I like home assistant much better - also because of the many components and the easier programming. Here I am still practicing … :slight_smile:
However, a major problem for me is the connection of my Bosch alarm system (AMAX), which communicates exclusively by means of the SIA DC-09 protocol. For this there is a Perl script in openHAB, which handles the communication. Unfortunately this script can not be used in the Home Assistant.
I’ve seen that ioBroker has a dedicated server (https://github.com/schmupu/ioBroker.sia) that does just that. Now I do not want to install an additional ioBroker. Is there a way to take over the functionality in the Home Assistant or to create such a component? Unfortunately, I’m not proficient at programming (that’s why switching to Home Assistant).

I would be happy if I got an answer.

many Greetings
Michael

Hello everybody,

does not anyone have an idea on the subject?

many Greetings
Michael

Hello,

you can try this: https://github.com/Cheaterdev/sia-ha

Hello, I have built an interface myself that transfers the data to HA with MQTT:

# ************************************************************************** #
# UDP Message Server für AMAX SIA DC-09 Protokoll zur Kommunikation mit MQTT #
# Version 0.9.8.5 vom 21.01.2019                                             #
# ************************************************************************** #

#server
#!/usr/bin/perl -w
# udpqotd - UDP message server

use strict;
use IO::Socket;
use Net::MQTT::Simple::Auth;
use Net::MQTT::Simple;
use Digest::CRC qw(crc64 crc32 crc16 crcccitt crc crc8 crcopenpgparmor);


my $filename = "/root/siadc09.log";

my($sock, $newmsg, $hishost, $MAXLEN, $PORTNO);
my($msg_id, $msg_seq, $msg_recceive_prefix, $msg_account_prefix, $msg_account_number, $msg_content, $msg_payload, $msg_crc_calc, $crc_length, $msg_length);

$MAXLEN = 1024;
$PORTNO = 9101;

# MQTT Parameter
my $mqtt_hostname = '127.0.0.1';
my $mqtt_user = "XXXXXXX";
my $mqtt_pw = "XXXXXXXX";
my $mqtt_topic = "amax_sia/message";

# my $mqtt = Net::MQTT::Simple::Auth->new($mqtt_hostname, $mqtt_user, $mqtt_pw);

$sock = IO::Socket::INET->new(
	LocalPort => $PORTNO,
	Proto => 'udp') or die "socket: [email protected]";


	#print "Awaiting UDP messages on port $PORTNO\n";
                     
	while ($sock->recv($newmsg, $MAXLEN)) {
                        my($port, $ipaddr) = sockaddr_in($sock->peername);
                        $hishost = gethostbyaddr($ipaddr, AF_INET);
                        
                        open(FH,'>>',$filename) or die $!;
                        print FH "Client $hishost said $newmsg\n";
                        close(FH);
                    

                        my $msg_size = length $newmsg;     
                        my $line_feed = substr($newmsg, 0, 1);
                        my $msg_crc_rec = hex (substr($newmsg, 1, 4));
			$msg_length = hex (substr($newmsg, 5, 4));
			$msg_id = substr($newmsg, 9, 9);

		if ($msg_id =~ m/SIA-DCS/i) {
			$msg_payload = substr($newmsg, 9, $msg_length);
			$msg_seq = substr($newmsg, 18,4);
			$msg_recceive_prefix = substr($newmsg, 22, 2);
			$msg_account_prefix = substr($newmsg, 24, 2);
			$msg_account_number = substr($newmsg, 26, 7);
			$msg_content = substr($newmsg, 33, $msg_length - 24);
			$msg_crc_calc = crc16($msg_payload);

			$crc_length = "0016";

		}
		else {
			$msg_payload = substr($newmsg, 9, 23);
                        $msg_id = substr($newmsg, 9, 6);
                        $msg_seq = substr($newmsg, 15,4);
			$msg_recceive_prefix = substr($newmsg, 19, 2);
                        $msg_account_prefix = substr($newmsg, 21, 2);
                        $msg_account_number = substr($newmsg, 23, 7);                            
                        $msg_content = substr($newmsg, 30, 2);                                     
                        $msg_crc_calc = crc16($msg_payload);

			$crc_length = "0017";
		}


        # ACK Message generieren
							
		my $MSG_ACK_E = "\"ACK\"" . $msg_seq . $msg_recceive_prefix . $msg_account_prefix . $msg_account_number . "[]";

            #open(FH,'>>',$filename) or die $!;
			#print FH "$MSG_ACK_E\n";
			#close(FH);
            
		my $ack_length = length $MSG_ACK_E;
		my $ack_crc_d = crc16($MSG_ACK_E);
		my $ack_crc = sprintf("%X", $ack_crc_d);
		my $ack_end = chr(13);
											
		my $MSG_ACK = $line_feed . $ack_crc . $crc_length . $MSG_ACK_E . $ack_end;

                        #open(FH,'>>',$filename) or die $!;
                        #print FH "ACK: $MSG_ACK\n";                             
                        #close(FH);    
                        
                        $sock->send($MSG_ACK);


			# Ausgabeaufbereitung an Home Assistant
                         
		 # if ($msg_id =~ m/SIA-DCS/i) {
   
			my $payload_account_number;
			my $payload_rest;
			my $payload_area;
			my $payload_text;
			my $output_message;

			($payload_account_number, $payload_rest) = split (/\|/,$msg_content);
			($payload_area, $payload_text) = split (/\//,$payload_rest);

			# my $sia_rx_code = substr($payload_text,0,2);
			# my $sia_rx_text = $sia_codes{$sia_rx_code};
							
			$payload_area =~ s/\^/ /g;
			$payload_text =~ s/\^/ /g;
							
			chop($payload_text);
							
			my $timestamp = localtime;
			
			# print "Payload-Area: $payload_area\n";
			
			if ($payload_area eq "") {
				$output_message = $timestamp . " " . "NULL";
			}
			else {
				$output_message = $timestamp . " " . $payload_area . $payload_text;
			}
			
			open(FH,'>>',$filename) or die $!;
                        print FH "Output-Message: $output_message\n";
                        close(FH);
                        
                        #my $mqtt = Net::MQTT::Simple::Auth->new($mqtt_hostname, $mqtt_user, $mqtt_pw);
                        #$mqtt->publish($mqtt_topic => $output_message);
                        
                        
                        my $mqtt = Net::MQTT::Simple->new($mqtt_hostname);
                        $mqtt->publish($mqtt_topic => $output_message);
			
			sleep(1);
            
                            
		# }
			
	} 


die "recv: $!";

On the HA side you have to evaluate the corresponding telegrams, e.g.

################################################################################
##                                                                            ##
## AUTOMATISIERUNG BOSCH ALARMANLAGE ALARMSTATUS                              ##
##                                                                            ##
################################################################################


## -------------------------------------------------------------------------- ##
## Alarmbereich NRi1 scharf / unscharf - Meldungsauswertung über MQTT         ##
## -------------------------------------------------------------------------- ##

- id: 'Alarmbereich NRi1 scharf'
  alias: AMAX Bereich 1 scharf
  initial_state: true
  trigger:
  - platform: mqtt
    topic: amax_sia/message
  condition:
  - condition: template
    value_template: '{{ "Nri1" in trigger.payload }}'
  - condition: template
    value_template: '{{ "CL" in trigger.payload }}'
  action:
  - alias: ''
    data:
      value: 1
      variable: amax_nri1
    service: variable.set_variable

- id: 'Alarmbereich NRi1 unscharf'
  alias: AMAX Bereich 1 unscharf
  initial_state: true
  trigger:
  - platform: mqtt
    topic: amax_sia/message
  condition:
  - condition: template
    value_template: '{{ "Nri1" in trigger.payload }}'
  - condition: template
    value_template: '{{ "OP" in trigger.payload }}'
  action:
  - alias: ''
    data:
      value: 0
      variable: amax_nri1
    service: variable.set_variable

Greetings

Michael

Hi @MichaelR . Thanks for sharing. I have one question about your perl script. I see that you are defining $portno but I dont see anywhere to define the IP of B426 IP module of BOSS panel. Also, how do you get that port number? In my case I can access the B426 IP module by calling https://local_ip without any port number

Thanks,
Savvas

Hi there,
The target IP (the MQTT server on which the Perl script is running) is defined in the AMAX alarm system. See the first line in the parameter settings (IP no. + Port).

B426

The B426 sends to the target IP via UDP

Best wishes
Michael

Ok, so I need to connect to my AMAX panel and change the IPno+Port so as to point to the IP the perl script is running?

That way, the communication will be in both ways? I will see the current status of my Alarm using H.A., but I will be able also to change it through H.A.?

More reading for me I suppose :slight_smile:

Thanks for your help :wink: