MQTT to Domoticz with bash

616 Views Asked by At

How can i get the value from the file in to Svalue instead of 56.8?

mosquitto_pub -h 192.168.0.117 -t domoticz/in -m "$(sudo /home/pi/a.sh)"

code for a.sh

#!/bin/bash
FILE="/home/pi/testar.log"


echo '{"idx" :179, "svalue" : "56.8" }'

I tried to add $file

#!/bin/bash
FILE="/home/pi/testar.log"


echo '{"idx" :179, "svalue" : "$file" }'

But Domoticz-log dont fix that

2017-08-28 08:47:10.300 MQTT: Topic: domoticz/in, Message: {"idx" :179, "svalue" : "$file" }
1

There are 1 best solutions below

0
On BEST ANSWER

the problem is the case.

An if you want the content of file, use "$(< ${file} )