In openhab 3.3.0 I use the DSMR binding for reading my smart meter and the items values are visible in the UI.
Now I want to upload some item values to pvoutput using API, see https://pvoutput.org/help/api_specification.html?highlight=api
I already created a simple bash script with can send data to my pvoutput account:
#!/bin/bash
RESULT=$(curl -d “d=20111201” -d “t=10:00” -d “v1=1000” -d “v2=150” -H “X-Pvoutput-Apikey: Your-API-Key” -H “X-Pvoutput-SystemId: Your-System-Id” https://pvoutput.org/service/r2/addstatus.jsp)
echo “$RESULT”
so far, everything works.
But now I have to replace the fixed values v1=1000 and v2=150 with my item values.
I studied a lot of examples, read the documents about exec binding, rules, actions etc. but I still don’t know how to handle this.
The item values witch I read using the binding are given with a unit (f.i. the actual power is 0.478 kW).
To insert the items as variables in the curl command the items must be numbers.
I think I need a rule to trigger if my item received an update and then use ‘executeCommandLine’ to execute my bash script. But how do I pass my item values (numbers) into the bash script?
Who can get me on the right track to fix this?