How to get a list of areas or devices in my home assistant via API

994 Views Asked by At

I have checked the home assistant documentation page for API's. I could not get and endpoint that would return a list of created areas(kitchen, living room etc) or a list of all my devices.

Is there a way to achieve this?

1

There are 1 best solutions below

0
Scott G On

You can do this via the REST /api/template endpoint:

curl -H 'Authorization: Bearer abc123' '<instance url>/api/template' -d '{"template": "{{ areas() }}"}'

Be sure to check out the REST API documentation, particularly on how to get the bearer token. You may find the templating documentation useful as well.