#Switch command wont run from script

6 messages · Page 1 of 1 (latest)

final marsh
#

I have a scrpt which is shutting down a linux pc, which thanks fot some help is now working.

however, at the end of the script I have a second section where i switch off thesmart plug. Im using this command in the script;

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer abcdthekeyishere" -d '{"entity_id": "switch.autodarts_plug", "state": "off"}' http://192.168.4.57:8123/api/services/switch/turn_off

The command doesnt work in the script or from trminal, it just throws a 400 error.

The entitle id is correct...and the switch for the device works perfect from the dashboard. Does anyone know what might be wrong with the command?

gaunt stream
#

Why not just use the switch.turn_off action?

final marsh
#

For this scenario that won't work, I need to run it from this particular script as part of a sequence

gaunt stream
#

Why not?

#

Also, it seems like this is going to be heavily dependent on the actual switch given you seen to be making a call to a random api that controls it. So that would be useful information to share - manufacturer, model api details etc

final marsh
#

What im looking for help with is how to turn a working dashboard elent of a switch-off into a terminal command.

The device is a tapo smart plug, which works perfectly from the dashboard. Its the tapo110 model. The entity id is switch.autodarts_plug

If anyone knows a way that a command can be run from terminal that would set switch.autodarts_plug to a state of off, it would be awesome.