HA Automation to call url with entity value

Hello,

I’m totally new, it’s my first forum post.

My HA is installed on a pi4, and I’ve got my home energy consumption monitor entity with ID “sensor.maison_123_1min” that work well.

I’ve set an ESP32 to catch request over network that switch on my LEDs differently with variable power with URL form like : http://192.168.1.149/power=150

Now, I just need to make an automation that update my LEDs each minute calling the URL like that :
http://192.168.1.149/power={sensor.maison_123_1min}

But I don’t know how to do, can someone give some help?

Thanks

rest_command:
  update_led:
    url: "http://192.168.1.149/power={{ states('sensor.maison_123_1min') }}"

Although its kind of odd to have an equals sign in the resource path like that. That might get encoded, not sure if its an issue.

Did you mean this? http://192.168.1.149?power=150

1 Like

Thanks for your reply, my URL is good because i do a substring on the GET ESP32 webserver param.

I think i tried to add a rest_command directly as an automation but i believe to understand that it must be set as a service and the call this service from automation.

I’ll try it in a couple of minutes.

1 Like

Great, i’ve edited my /config/configuration.yaml file with the rest command and i’ve selected it in automation with time patern second = 0 and he work perfectly !

My first project is done i’m so happy :smiley:

Thank you very much

1 Like