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
lagastou
(Lagastou)
March 21, 2025, 12:52pm
4
Hi Riverghost,
Like you, I wanted to display some sensors on my old LaMetric (pre-2022 model). Your example is certainly great, but unfortunately, it’s not accurate enough for my needs.
Could you please provide more information on the following:
The URL: Where did you get this URL? Besides the IP address, do we need to customize it for our individual purpose? or this URL works to anyone?
The “My_Token” entry: What do you mean by this token? Is it an API key?
Thank you for your help.
lagastou
(Lagastou)
March 29, 2025, 7:06am
5
Hello, I am replying to myself, as I finally managed to push data to my LaMetric (pre-2022 model) and the App indicator.
Actually, the post mentioned a link to the LaMetric documentation, which I had not noticed. Here is the URL:
https://lametric-documentation.readthedocs.io/en/latest/guides/first-steps/first-lametric-indicator-app.html
Follow sections 1 and 2, and you will get the URL to push data and the token.
Then, I had to disable SSL verification by adding this option: "verify_ssl: false"
As an example, here is my code:
rest_command:
lametric:
url: "https://192.168.1.17:4343/api/v1/dev/widget/update/com.lametric.9c9ce9addfcecb125312d6117/1" #change ip to your own Lemetric local IP address
method: POST
verify_ssl: false
headers:
X-Access-Token: "MmFkMzdmYmYmUxNjZhOTBjNjY1MWNmMWM0MDAwY2IyMmI0ZmIzMDA4OTAxZjM0MGRh1YzE0NjM3ZQ=="
Accept: "application/json, text/html"
Cache-Control: "no-cache"
payload: '{"frames": [{ "text": "{{ states("sensor.diskstation2_temperature") | round(1) }}°C","icon": 12519},{ "text": "{{ states("sensor.temperature_exterieure") | round(1) }}°C","icon": 2422},{ "text": "{{ states("sensor.production_solaire_cumulee_puissance") | round(2) }}kW","icon": 27283},{ "text": "{{ states("sensor.envoy_gateway_current_net_power_consumption") | round(2) }}kW","icon": 14429},{ "text": "{{ states("counter.boite_a_lettre_flap") }} et {{ states("counter.boite_a_lettre_colis") }}","icon": 2659}]}'
it is now working perfectly
LG