Hello,
I would like to send data from Home Assistant to LaMetric in an indicator app.
I have always used this function with FHEM, but unfortunately the Home Assistant integration is very limited.
So I’m testing the command REST function, but I’m getting stuck.
As a baseline the following curl string works in a command line, but the variables for the sensor values still have to be implemented.
curl -X POST \
-H "Accept: application/json" \
-H "X-Access-Token: My_Token" \
-H "Cache-Control: no-cache" \
-k \
-d '{
"frames": [
{
"text": "Kurs",
"icon": 47
},
{
"text": "Watt",
"icon": 2708
}
]
}' \
https://192.168.2.52:4343/api/v1/dev/widget/update/My_App/2
LaMetric Doku
Is it possible to do this with the command REST function or I have to use the command line function?
Maybe someone can help me?
I tried that, but unfortunately it doesn’t work:
rest_command:
lametric_etf:
url: 'https://192.168.2.52:4343/api/v1/dev/widget/update/MyApp/2'
method: POST
headers:
authorization: "MyToken"
accept: "application/json"
payload: '{"frames": [{"text": "Kurs","icon": 47},{"text": "Watt","icon": 2708}]}'
content_type: 'application/json'
verify_ssl: true
For the test only with fix data.
At the end I will relace “Kurs” and “Watt” with sensor data.
Hello all,
after hours and hours of trial and error, YAML code and restarts of Home Assistant, I’ve solved the problem.
Maybe it’s of interest to one or the other and that’s why I’ll post my YAML code:
rest_command:
lametric:
url: "http://192.168.2.52:8080/api/v1/dev/widget/update/My_App/2"
method: POST
headers:
X-Access-Token: "My_Token"
Accept: "application/json, text/html"
Cache-Control: "no-cache"
payload: '{"frames": [{ "text": "{{ states("sensor.vanguard") }}","icon": 47},{ "text": "{{ states("sensor.tasmota") }}","icon": 2708}]}'
1 Like