Hello,
i use a Raspberry PI4 with a RTL Sdr Antenna to collect the P2000 messages.
The code i use is 50/50 copy past and self made.
The idee is that wenn a message on a certain Capcode comes in it send it tru to a MQTT broker.
This can run for monts without any problem. But after some time it is not reciving mesages.
Pi still function and code is running but no output of the multimong.
Can anyone help to find the problem ?
import time
import sys
import subprocess
import os
import re
import paho.mqtt.publish as publish
from RID_MWB_V1_2 import replace
from datetime import datetime
from dateutil import tz
from termcolor import colored
def curtime():
return time.strftime("%H:%M:%S %Y-%m-%d")
with open('error.txt','a') as file:
file.write(('#' * 20) + '\n' + curtime() + '\n')
KLADBLOK
#Topics
# V P2000/mwb/brw
# V P2000/mwb/pol
# V P2000/mwb/amb
# V P2000/mwb/stb
# V P2000/mwb/lichtkrant
# V P2000/mwb/homealarm
# V P2000/mwb/mid
#and (melding.__contains__("A1"))
Call Multimon:
multimon_ng = subprocess.Popen("rtl_fm -f 169.65M -M fm -s 22050 -p 43 | multimon-ng -a FLEX -t raw -",
stdout=subprocess.PIPE,
stderr=open('error.txt','a'),
shell=True)
time.sleep(15)
publish.single('P2000/mwb/startup', "Multimon is gestart Script loopt" , hostname=MQTT_SERVER)
time.sleep(1)
Hello, i use a Raspberry PI4 with a RTL Sdr Antenna to collect the P2000 messages. The code i use is 50/50 copy past and self made.
The idee is that wenn a message on a certain Capcode comes in it send it tru to a MQTT broker. This can run for monts without any problem. But after some time it is not reciving mesages.
Pi still function and code is running but no output of the multimong. Can anyone help to find the problem ?
import time import sys import subprocess import os import re import paho.mqtt.publish as publish from RID_MWB_V1_2 import replace from datetime import datetime from dateutil import tz from termcolor import colored
INIT
MQTT_SERVER = "10.0.184.44" groupidold = "" #########################################################################################
05-05-2020
P2000 to MQTT voor thuis. NAV nieuwe Revolution Core. Nieuwe Multimon output.
Deze versie heeft 1 flex string met variable lengte. En meerdere capcodes
#########################################################################################
Declaratie zoektermen
capcode_Steenbergen_homealarm= "001201999"
capcode_Steenbergen_lichtkrant= "001201972" capcode_NVM_lichtkrant= "001201954" capcode_Steenbergen_homealarm= "001200768" capcode_Steenbergen_proefalarm= "001201998" capcode_MWB_Ambu= ["001220499"] capcode_MWB_Brw= ["001201999"] capcode_MWB_Pol= ["001230999"] Steenbergen="Steenbergen NB" OPS_Middel="MIDDEL" capcode_MWB_STB= ["001220499","001201999","001230266"]
Definitie voor de tijd.
def curtime(): return time.strftime("%H:%M:%S %Y-%m-%d") with open('error.txt','a') as file: file.write(('#' * 20) + '\n' + curtime() + '\n')
KLADBLOK
Call Multimon:
multimon_ng = subprocess.Popen("rtl_fm -f 169.65M -M fm -s 22050 -p 43 | multimon-ng -a FLEX -t raw -", stdout=subprocess.PIPE, stderr=open('error.txt','a'), shell=True) time.sleep(15) publish.single('P2000/mwb/startup', "Multimon is gestart Script loopt" , hostname=MQTT_SERVER) time.sleep(1)
publish.single('P2000/mwb/amb', "Ambu P2000 systeem Check" , hostname=MQTT_SERVER)
time.sleep(1)
publish.single('P2000/mwb/pol', "Politie P2000 systeem Check" , hostname=MQTT_SERVER)
time.sleep(1)
publish.single('P2000/mwb/brw', "Brandweer P2000 systeem Check" , hostname=MQTT_SERVER)
time.sleep(1)
publish.single('P2000/mwb/stb', "Steenbergen P2000 systeem Check" , hostname=MQTT_SERVER)
time.sleep(1)
publish.single('P2000/mwb/nieuwvossemeer',"nieuwvossemeer P2000 systeem Check" , hostname=MQTT_SERVER)
time.sleep(1)
sys.stdout.write("Code Draait\n")
Code:
try: while True: line = multimon_ng.stdout.readline()
line = "FLEX: 2017-07-10 07:45:34 1600/2/A 11.059 [001201999] ALN P 1 BR GEBOUW Warwickstraat Steenbergen NB 201634 (inci-02)"
except KeyboardInterrupt: os.kill(multimon_ng.pid, 9)