pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

Generate promote for AI conversation agent

Open itispip opened this issue 1 year ago • 1 comments

With HA added Open AI, Google Gen AI as conversation agent, user now use Template in promote box to list out all rooms, device, entity for AI. Is that possible to be done by PyScript?

itispip avatar Jun 30 '24 17:06 itispip

Without the examples I can only show you how to list all HA devices:

from homeassistant.helpers import device_registry
from homeassistant.helpers.device_registry import DeviceEntry
from typing import List

registry = device_registry.async_get(hass)
devices: List[DeviceEntry] = registry.devices.values()

The devices object is filled like so: https://github.com/home-assistant/core/blob/2024.6.4/homeassistant/helpers/device_registry.py#L977 The DeviceEntry object is described here: https://github.com/home-assistant/core/blob/2024.6.4/homeassistant/helpers/device_registry.py#L977

ALERTua avatar Jun 30 '24 17:06 ALERTua