REST API Example

2,043 views
Skip to first unread message

Davide Nastri

unread,
Dec 12, 2015, 5:49:49 PM12/12/15
to Home Assistant Dev
Hi everyone.

I would like to turn on and off switches in Home Assistant with REST API, mainly to let it interact with my Tasker.

I read official documentation but I do not understand how I should structure my call to change a switch status.

I think I need to use POST but what would be the request structure?

All working for me, for now, is the simplest GET:

http://myip:8123/api/?api_password=mypassword

Thanks for your time and patience.

Paulus Schoutsen

unread,
Dec 14, 2015, 3:04:16 AM12/14/15
to home-assi...@googlegroups.com
Have a look here:

For domain and service put in homeassistant and turn_on.

See in the UI -> developer tools -> services + states


--
You received this message because you are subscribed to the Google Groups "Home Assistant Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to home-assistant-...@googlegroups.com.
To post to this group, send email to home-assi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/home-assistant-dev/d9033ae9-50db-4202-92d6-f367a9b95930%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
It's nice to be important but it's more important to be nice.

Fabian Affolter

unread,
Dec 14, 2015, 2:12:33 PM12/14/15
to Home Assistant Dev

I added a couple examples [1] to the REST API docs. This should get you started.

Fabian

[1] https://github.com/balloob/home-assistant.io/commit/d9c7830b2f69fe36269b57015e8757136233faf4

Andrew Jawitz

unread,
Dec 20, 2015, 9:58:33 PM12/20/15
to Home Assistant Dev
I'm looking for more or less the same exact thing only to create a simple scene controller interface that can run on my phone and Pebble Watch via PebbleTasker plugin.  I stumbled on this repo which may or may not be deprecated by now- https://github.com/balloob/home-assistant-android-tasker and by loading up the XML file I was even able to find various API Call Service tasks already set up. For example there's a task called "API Call Service" with light/turn_on under Parameter 1 (%par1). Would I be able to use this template to make service calls to trigger individual scenes?  I can see scene/turn_on is available as a service but I don't see anything about how to trigger individual scenes in the service data fields.  Could I simply just add each scenes' entity_id into Parameter 2(%par2)?

A user in an earlier thread also mentioned using the RestTask plugin which I havent tried...
Reply all
Reply to author
Forward
0 new messages