Micke Hedqvist
Micke Hedqvist

Reputation: 27

MQTT to Domoticz with bash

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" }

Upvotes: 0

Views: 629

Answers (1)

thelastworm
thelastworm

Reputation: 597

the problem is the case.

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

Upvotes: 0

Related Questions