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
Troon
(Troon)
June 24, 2021, 10:08am
2
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
nickrout
(Nick Rout)
June 25, 2021, 5:53am
5
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.
nickrout
(Nick Rout)
June 25, 2021, 6:05am
7
From what? A button on the wall? A phone?
koying
(Chris B)
June 25, 2021, 6:08am
8
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.
Yes it’s what i sent, but i got a bad request on this payload
nickrout
(Nick Rout)
June 25, 2021, 6:12am
11
I know, I am just wondering why. There is often an easier way.
Troon
(Troon)
June 25, 2021, 6:14am
12
Does the fan speed service call work if you send it from HA — via Developer Tools / Services or from a script / automation?
koying
(Chris B)
June 25, 2021, 6:17am
13
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"}}
koying
(Chris B)
June 25, 2021, 6:23am
16
Ah, the url would be http://192.168.0.250:8123/api/services/vacuum/set_fan_speed
1 Like
Oh !!! You got true, i’m so confused
Thank You for your help