Restful API to command_open autogate/garage

Hi, i am new here. Need some advise.

I have a remote RPI just use GPIO to control some lights and autogate. From local RPI, I have successfully turn on/off my switches with curl example from https://home-assistant.io/developers/rest_api/

$ curl -X POST -H “x-ha-access: my_PASSWORD”
-H “Content-Type: application/json”
-d ‘{“entity_id”: “switch.christmas_lights”}’
http://remoteIP:8123/api/services/switch/turn_on

I wish to do the same with above command for cover type like autogate or garage door. Can this be done ? and what will be the services call i should use ? Sample below;

$ curl -X POST -H “x-ha-access: my_PASSWORD”
-H “Content-Type: application/json”
-d ‘{“entity_id”: “cover.autogate”}’
http://remoteIP:8123/api/services/cover/XXXX

Thanks for any feedback.

cheers, CY

The cover service supports close_cover and open_cover (among other service calls), so you should call http://remoteIP:8123/api/services/cover/close_cover or http://remoteIP:8123/api/services/cover/open_cover respectively with the entity_id of your cover component.

1 Like

Hi m0wlheld,

It works, Thank you so much.

Cheers.
CY

it works.

curl -X POST -H "Content-Type: application/json" http://localhost:5000/api/services/cover/close_cover -d '{"entity_id": "cover.cover_kitchen"}'

however, where in the official API docs is this URL specified (/api/services/cover/close_cover)?

It’s not in these two pages, and I didn’t find it anywhere else in the official API doc.

In your first link, any valid service can be called thus:

That close_cover service is listed in the cover documentation: