I would like to be able to query the area registry through the REST API.
I was looking for the same thing and found a Github PR for doing just that:
However it seems that PR was closed and it was recommended to use the websocket API instead. Maybe you can reopen the PR and argue for your use-case?
The dev team has indicated that they are not willing to reconsider that MR. If anyone else is interested in the feature, please vote here.
What principle exactly determines what features is available by the rest api and what not?
Iām developing a client for a device that does not support websockets.
This artificial restriction makes it impossible to use the area-feature on that device, doesnāt it?
I donāt know that the devs are going to respond here. Please vote for this request if you want it.
I agreeā¦
Yes, I could re-program everything to use websockets to get that data but why not expose that data via the REST API?
UPDATE apr-2022
Just tested websockets but the area_registry and device_registry donāt seem to be available anymore.
In that case this enhancement request should be back on the table?
Have you seen this?
const [areas, devices, entities] = await Promise.all([
info.hass.callWS({ type: "config/area_registry/list" }),
info.hass.callWS({ type: "config/device_registry/list" }),
info.hass.callWS({ type: "config/entity_registry/list" }),
]);
Hello @anoblet
That was new to me. I did take a quick look, managed to create a dashboard based on the example but then realized this is outside my area of expertise
(donāt have the time to dive into this vs. creating a python based dashboard in seconds if the right API endpoints are available).
Thanks anyway!
Just ran into this issue myself.
@anoblet do you have any idea how to use this with the official home-assistant-js-websocket
package?
It does not seem to include area_registry in the subscribeConfig
function and there still seems to be no way to get the list from the REST api which is quite frustrating.
Iām so confused as to WHY they refuse to do this? Itās really wierdā¦ seems like such a necessary and reasonable request. I want to sort my devices by room in my own UI, seems like alot of hassle having to manually write this for each device.
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.