RESTful with more parameters

Hi everybody !
I need your helper i’m completly stuck with RESTful API to invok à set_fan_speed with my robot vacuum.
It’s working well with service without any attributes, like turn_on, turn_off, but i’m not able to set when i have to send some more parameters

I’ve try this :

curl -X POST -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "vacuum.neatsvor_x600_xx_xx_xx_xx_xx_xx", "fan_speed": "Quiet"}' \
  http://192.168.0.250:8123/api/services/vacuum/vacuum.set_fan_speed

And everytime i got an error n° 400 : BadRequest…
I think my attributes fan_speed cause trouble, but i’m not sure, how i have to send it, and documentation dosen’t really help me.

I’ve try this as well : (without success)

curl -X POST -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
 -H "Content-Type: application/json" \
 -d '{"entity_id": "vacuum.neatsvor_x600_xx_xx_xx_xx_xx_xx", "data": {"fan_speed": "Quiet"}}' \
 http://192.168.0.250:8123/api/services/vacuum/vacuum.set_fan_speed

Does anyone have an idea ??
Thank YOU :slightly_smiling_face:

I’m confused: are you trying to set the fan speed by sending a command from HA to HA via the API? Can’t you call the service directly?

I’m trying to set the fan speed from an URL call

No one have an idea ? :roll_eyes:

why? seems a weird thing to do.

maybe i’m new with home assitant.
Do you have a better idea for me? i just want to set this vacuum speed from outside my Home Assitant.

From what? A button on the wall? A phone?

The payload should be

{"entity_id": "vacuum.neatsvor_x600_xx_xx_xx_xx_xx_xx", "fan_speed": "Quiet"}

I think, i.e. what you would put in the service call from the developer tools.

It’s about

Yes it’s what i sent, but i got a bad request on this payload :man_shrugging:

I know, I am just wondering why. There is often an easier way.

Does the fan speed service call work if you send it from HA — via Developer Tools / Services or from a script / automation?

Exactly. Unlikely the fan speed would with a capital, for instance.

Yes from Developer Tools / Service it’s work perfectly and set the parameters

When i go to YAML mode i got this

service: vacuum.set_fan_speed
target:
  entity_id: vacuum.neatsvor_x600_xx_xx_xx_xx_xx_xx
data:
  fan_speed: Quiet

Maybe the “data” section in my payload must be provided ?

But with this it’s not working

{"entity_id": "vacuum.neatsvor_x600_xx_xx_xx_xx_xx_xx", "data": {"fan_speed": "Quiet"}}

Ah, the url would be http://192.168.0.250:8123/api/services/vacuum/set_fan_speed

1 Like

Beat me to it!

1 Like

Oh !!! You got true, i’m so confused :flushed:
Thank You for your help