Continuing the discussion from Reading sensor value with using a variable name :
I am trying to send a URL to an Arduino R4 Wifi to display on its matrix.the value of my Solaredge home battery.
In the configuration.yaml I added the lines:
rest_command:
rest_cmd_matrix:
url: "http://192.168.178.x/accu=sensor.{{ states.solaredge_i1_b1_state_of_energy.state }}"
So far no luck. The return value is always “http://192.168.178.x/accu=0 ”
koying
(Chris B)
February 6, 2025, 12:47pm
2
states.*sensor*.solaredge...
url: “http://192.168.178.134/accu=sensor. {{ states.sensor .solaredge_i1_b1_state_of_energy.state }}” does not work.
Are you sure about the asterisks? Shown here as italics.
koying
(Chris B)
February 6, 2025, 2:03pm
4
The asterisks were just for emphasis
No, you definitely don’t want them
Sorry, my mistake, The syntax is still a puzzle to me.
Now the command is:
url: "http://192.168.178.134/accu=sensor.{{ states.sensor.solaredge_i1_b1_state_of_energy.state }}"
But the variable still returns 0. Too many ‘sensors’?
koying
(Chris B)
February 6, 2025, 2:12pm
6
PieterB-home:
Too many ‘sensors’?
IDK. What does the Arduino actually expect?
Hellis81
(Hellis81)
February 6, 2025, 2:14pm
7
You probably need to remove the sensor.
before the template.
Not sure what it does but it will send a string value. Not sure the receiver likes that
Very straightforward, e.g.
url: http://192.168.178.134/accu=25
results in ‘25%’ on the matrix.
Hellis81
(Hellis81)
February 6, 2025, 2:16pm
9
Yeah… so the sensor.
shouldn’t be there
1 Like
Solved with:
url: "http://192.168.178.134/accu={{ states.sensor.solaredge_i1_b1_state_of_energy }}"
This provides the proper sensor value