AppDaemon / appdaemon

:page_facing_up: Python Apps for Home Automation
Other
840 stars 417 forks source link

Get all entities under an area such as floor or room in Home Assistant #2012

Closed AivarasAukselis closed 4 months ago

AivarasAukselis commented 4 months ago

Is there an existing feature request for this?

Your feature request

I would like to get all entities under an area such as room or floor in home assistant. get_status does not seem to have this functionality and documentation does not have information on this.

AivarasAukselis commented 4 months ago

I found a way to do it. For others that come looking later it can be done with the help of the templates:

all_items = self.render_template("{{area_entities('living_room') | reject('is_hidden_entity') | list}}")

for entity_id in all_items:
  item = self.get_state(entity_id, attribute="all")
  self.log(item)