I’m trying to trigger a Sonoff S60ZBTPF Zigbee Smart Plug with the HA REST-API . The plug is connected to home-assistant and it works well in the web interface and with automations.
I can get its status via REST:
$ curl --header --request GET "Authorization: Bearer $(cat /etc/secrets/ha-token)" --header "Content-Type: application/json" \
--url http://home-assistant.local/api/states/switch.snzb_s60tpf_no_2
{"entity_id":"switch.snzb_s60tpf_no_2","state":"off","attributes":{"friendly_name":"Liv Plug A"},"last_changed":"2026-08-28T16:39:05.912181+00:00","last_reported":"2026-08-28T16:39:05.912181+00:00","last_updated":"2026-08-28T16:39:05.912181+00:00","context":{"id":"....","parent_id":"...","user_id":null}}
But when I try to turn power on with the REST-API:
$ curl --header --request POST "Authorization: Bearer $(cat /etc/secrets/ha-token)" --header "Content-Type: application/json" \
--url http://home-assistant.local/api/states/switch.snzb_s60tpf_no_2 \
--data '{"state": "on"}'
{"entity_id":"switch.snzb_s60tpf_no_2","state":"on","attributes":{},"last_changed":"2026-08-28T16:54:54.792177+00:00","last_reported":"2026-08-28T16:54:54.792177+00:00","last_updated":"2026-08-28T16:54:54.792177+00:00","context":{"id":"....","parent_id":null,"user_id":"..."}}
the power doesn’t turn on but on the web interface, I see the status change. Again, when I’m using the slider in the web-UI, I hear the relay click and the connected consumer turns on, but not with REST.
What am I doing wrong?
Remark: I’m not filing a bug-report yet, because I assume this is intended behavior and I’m missing or misunderstanding something, since I’m pretty no to HA. But I’m open to, if that’s not the case.
con-f-use:
api/states
You are just updating the state in the state machine, which isn’t the same as calling the service that actually turns the switch on/off.
Not sure, sounds wrong - but it’s worth a try.
What would I put for <domain> and <service> as the documentation suggest (see picture) or how do I find out?
The domain is switch and the service would be turn_on, turn_off, or toggle… depending on what you are trying to do.
A yes, thanks. That seems to do the trick:
$ curl --request POST --header "Authorization: Bearer $(cat /etc/secrets/ha-token)" --header "Content-Type: application/json" \
--url http://127.0.0.1:8123/api/services/switch/turn_on \
--data '{"entity_id": "switch.snzb_s60tpf_no_2"}' |
jq .
[
{
"entity_id": "switch.snzb_s60tpf_no_2",
"state": "on",
"attributes": {
"friendly_name": "Liv Plug A"
},
"last_changed": "2026-08-28T17:22:26.379591+00:00",
"last_reported": "2026-08-28T17:22:26.379591+00:00",
"last_updated": "2026-08-28T17:22:26.379591+00:00",
"context": {
"id": "...",
"parent_id": null,
"user_id": "..."
}
}
]
You should have a solution button available now to solve this post.
I don’t think I have, but thanks for caring.
I added a category so it would be available, but that disapeared. I added the category again. Adding a solution tag also closes it, so there is a reason I ask.
Adding the proper solution tag affects how others may find this solution. Putting “solved” in the title doesn’t achieve the same effect.