-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Area and Device registries #505
Comments
Thanks for this. Can you kindly explain more on what you mean? Regards |
Devices is the physical representation of one or more entities in home assistant. Would be nice to be able to have helper functions that can be used with areas and devices |
areas has been merged 3 days ago. i think that when people are actually working with them, there will be suggestions on how to use and what kind of helper functions could be usefull. thats about the time to work on implementing it. |
I agree with Rene - when it's clear what we can add that will help in this area we can look into it. |
There is nothing wrong with MVP support. First implementation would purely be to be able to resolve from registries; areas -> devices -> entities. |
i dont know what MVP support means, but i am sure Andrew is willing to look at a PR from you if you think it is that important. |
Minimum viable product, something to start with to evaluate further use cases |
ah, ok. thanks for explaining. I think that in case from something as new as this in HA, its always wise to let it go on HA for a while. at this moment we are preparing AD for beta release for AD 4.0 and then its not wise to add something new from HA, that they didnt even release (and from experience its in general not wise to support something new from HA when its not at least 2 releases old) ;) but like Andrew said, he will add it at some point and he marked it as enhancement. |
These are really simple registries, create, read, update, delete. No notifications or anything since they're outside the state machine. They all share the same design as entity registry and would probably not be changed due to their simple nature. There has been no breaking changes in device registry since it was created, and I don't expect it to be with areas either. Areas will be out with 0.87 so it is nearly released ;) |
Nice to see there is already a request for it. I would like to use areas to represent rooms and I have just searched for a way to lookup to which area/room a motion sensor belongs to than query other devices in that area/room (lights, media_player, ...) and react accordingly. This would be much nicer than maintaining groups with all devices for all rooms. Cycling through entities and do some magic is very powerfull and convenient in appdaemon - thanks for this! I would love to see area support and just wanted to signal, that there is a demand an use-cases for that :) |
whats the advantage from an area called livingroom over a group called livingroom? i have groups like that since 2 years, i like to know what advantage it would give to change to areas? |
Areas are connected to devices so one benefit is that you tie all entities belonging to a device to an area. This will simplify contextual automations like turn on all lights in an area |
maybe this is a wrong example, because it was already simple to automate turn on all lights in a group. so i am still wondering: maybe an example what i can do with area that i couldnt do with group? |
Take a look here: home-assistant/architecture#94 This one is why home assistant added areas |
It's now the recommended way of sorting devices into "rooms". I have an app that goes through all entities and finds the ones that have a |
Can you explain what you would need AppDaemon to actually do for you? |
a function that returns AREA for given ENTITY_ID |
but how do you see if an entity belongs to an area? i dont think so. i can hardly find anything back in the docs on how to configure areas, or anything else about it. (could be my lack of searching) |
The entity id belongs to a device which belongs to a group. That is how it is resolved. You configure it mainly through the frontend. |
nice that its configured through the frontend, but if there is no real connection we can hardly implement it. if i cant find any docs on how its used or setup, what services can be used with it, etc. how are we supposed to add support for it? you asked for support for it in AD, and i know you were part of the development. |
The different paths for Areas and Devices (including how to list them) can be found under the config component It is not only about using services, but they are also containers for different entities that should not need additional mapping logic in apps, in many ways replacing the need for groups. You can resolve all lights that belong to an area or get all lux values from sensors of an area. |
i asked for docs about them and how to implement them in an outside program (like AD) (or any kind of docs) and or how they are registered in the API. and i already did understand that its another way of grouping. (nice and confusing for newbies in my eyes) for people like me that run HA for over 2 years i see no advantage. on this point i am not even able to use it in the latest HA. (but thats probably because my devices are configured in yaml and not through the frontend) |
Maybe this is better then? Most are simple endpoints that just allow a couple of different actions https://developers.home-assistant.io/docs/en/device_registry_index.html |
no. it explain how to use it in HA development. how can i know what devices belong to an area when i only have a browser? we need to be able to import a list with all existing areas and devices and what they contain in AD, so we need to know where that info is. |
Currently the only thing you can do is assign devices to areas. |
@Burningstone91 sure you can, in the same way the frontend does. It is all there. |
@Kane610 Interesting. If I go to the area registry I only see the areas I have configured, however I don't see any of the entities that I assigned to the area. I also don't see any service calls to e.g. add/remove devices from an area. Could you please enlighten me? |
Is support for Areas on the roadmap? They have been in HomeAssistant for almost a year now and I've hit a wall where things get really "hackey" without support for areas. Although my time is limited I'm happy to help implement where I can. UPDATE: Looks like I'm asking the right question in the wrong place. There's currently no way to determine what area an entity belongs to via the HA API. |
@LunkwillAndFook thats why this is still open. Areas are nothing more then a group that isnt called a group, but an area. |
Info from @frenck gathered on AD discord. |
I'm happy to take this on - the REST API I just tried to add to HASS was kicked back for being "the old way of doing things" now that everything has to be via the (bluntly harder to use) Websocket. So, before I try and take on adding this to AppDaemon and suffer another disappointing "no thanks" - is there a particular place or practice I should follow for this code? I've only ever used AppDaemon with HA, but I know it aims to support other channels - and Area Registry is very HA specific. Do we need an abstract architecture first?.... |
because of that i think it should be in the hass plugin but im no dev (anymore) so i would wait for a goahead before you create a PR. |
FWIW, I've done this in JS-land for another project. Looking at AppDaemon's code, it would be best for this to be done in the plugin - otherwise you'd need to setup another Websocket to HomeAssistant. Here's my JS snippet: async findRelatedEntities(entity: HassEntity): Promise<string[]> {
const response1: any = await this.api.sendMessagePromise({ type: 'search/related', item_type: 'entity', item_id: entity.entity_id });
const relatedDeviceIds = response1['device'];
if (!relatedDeviceIds) return [];
const response2: any = await this.api.sendMessagePromise({ type: 'search/related', item_type: 'device', item_id: relatedDeviceIds[0] });
return response2['entity'] || [];
} |
I created a pull request that will give access to these registries, as well as all data retrievable over the websocket api: #1583 |
Nice! |
#1584 should completely close this issue when merged. |
Thank you @zanfur for taking this on and for everyone else who responded to and gave input on this request. |
To continue with being on par with Home assistants API there should be support in Appdaemon for the Area and Device registries.
The text was updated successfully, but these errors were encountered: