} else {
print $msg->string, "\n";
}
+
+# if ( $msg->topic =~ m{Inclinometer/ZCT330Ex_SWP_N_YK/869858031634109/up} ) {
+ if ( substr($msg->message,2,1) eq "\x07" ) { # heartbeat
+ my $raw = "\x5a\x0b\x03\x09\x00\x00\x04\xe8\x03\x00\x00\x21\x44\xaa\x4B\xF3";
+ my $topic = $msg->topic;
+ $topic =~ s/up$/down/;
+ send_message($socket,
+ message_type => MQTT_PUBLISH,
+ retain => 0, #$retain,
+ topic => $topic,
+ message => $raw);
+ }
+
if (defined $count && --$count == 0) {
exit;
}