offsets and graphs for 2OI-0000131 and 2OI-0000132
[zc] / zc-mqtt
diff --git a/zc-mqtt b/zc-mqtt
index 5060b8d..e1593be 100755 (executable)
--- a/zc-mqtt
+++ b/zc-mqtt
@@ -135,7 +135,7 @@ while (1) {
        mkdir "$queue/$dir/$date" if ! -d "$queue/$dir/$date";
        write_file "$queue/$dir/$date/$time.$t.$up_down.$function_code", $msg->message;
 
-       if ( substr($msg->message,2,1) eq "\x07" ) { # heartbeat
+       if ( $function_code == 7 || $function_code == 8 ) { #  7 = heartbeat, 8 = alarm
                my $hash = protocol_decode( $up_down, $msg->message );
                $sth->execute( map { $hash->{data_id}->{$_} } @insert_data_ids );