Open rb2k opened 5 years ago
The addon currently uses this combination to send each line to mqtt:
/usr/local/bin/rtl_433 -F json -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET | while read line [...] echo $line | /usr/bin/mosquitto_pub [...]
This works but causes a fork/exec on every single line that comes in.
My local script is heavily hacked modified, but basically I changed the script a bit to use this methodology:
mkfifo /tmp/messages.pool
function start_tailing() { cat 0<> /tmp/messages | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_TOPIC } start_tailing &
echo $line > /tmp/messages.pool
That way we only fork/exec the mosquitto_pub process once rather than on every single line that comes in.
What do you think about that approach?
I guess one problem I should mention: The custom channels disappear and the model name and id data ends up just in the payload.
The addon currently uses this combination to send each line to mqtt:
This works but causes a fork/exec on every single line that comes in.
My local script is heavily hacked modified, but basically I changed the script a bit to use this methodology:
That way we only fork/exec the mosquitto_pub process once rather than on every single line that comes in.
What do you think about that approach?