Struggling to sort out http command script

Hi,

I’ve been helped a lot along the way, and I’m to a point that I can actually control my servo through a http command.

I have the following:

  moveto_35: "curl -X GET http://192.168.1.241/control?cmd=Servo,1,2,35"
  moveto_0: "curl -X GET http://192.168.1.241/control?cmd=Servo,1,2,0"

And I need to try and get that to work by moveto_35 then a 0.5 second delay, and then moveto_0 all with the press of a toggle button (So I can see if the servo is toggled on or off)

I have no idea how to plug this in to my config on hass.io.

switch:
  - platform: ???what would go here for a http command???
    name: "Receiver servo"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

I’ve got that, but I have no idea where to add a deay or the Http commands

Would anyone please lend a hand?

Cheers in advance.

Take a look at:

How would I incorporate the whole delay and return back to position 0 into the code, as to avoid needing to turn it on manually and then back off manually?

Here are my conf switches https://i.imgur.com/mgdSraB.png but my hass.io won’t reload now. I doubt its right.

Set it up as a script that calls those commands. Just do something like

  sequence:
    - service: shell_command.cmd1
    - delay: 00:00:01
    - service: shell_command.cmd2

I realize that is pseudo code and a 1 second but that will do it for you.

I put that and obviously changed the shell commands to my own, and it stops my hass.io from running. Why do I keep getting things so wrong?

For command line I use as switch that can turn on and off.
for http command that don’t have on and off I use as weblink.

Finally got the code to work! I just can’t seem to get it delay and return back to its 0 state now :frowning:

1 Like