Hello community,
I have a load sensor that publishes the current weight every one second to a logfile. I want to read this file and send the value via MQQT to the broker.
At first I need a rule to set a temporary variable and send the value afterwards.
if every 1 second then $loadcell.loadcell = execute "tail -1 /home/pi/hx711/loadcell.log"
How could I write a value into my variable?
The variable is declared like this:
{
"id": "loadcell",
"name": "loadcell",
"class": "VariablesDevice",
"variables": [
{
"name": "loadcell",
"expression": "$value",
"type": "string"
}
]
},
The second part is easy and works allready
if every 1 second then publish mqtt message "\{\"weight\":\{\"value\":\"$loadcell.loadcell\", \"unit\":\"g\"\}\}:retain" on topic "MyTopic/Scale"