custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
874 stars 46 forks source link

Persons doesnt have device_trackers #387

Closed xeor closed 2 years ago

xeor commented 2 years ago

In the home-assistant UI, you can set a list of device trackers on a person. Those seams to be, based on what I can find in https://github.com/home-assistant/core/blob/dev/homeassistant/components/person/__init__.py#L401-L414 not available normally.. But they are still there in the code refeered by device_trackers on a person.

How can I get to that list on a person using pyscript. I have looked around, anI d I think I need to use the hass object to get to some raw configuration about the person, but unsure how that object is structured.

In []: state.getattr('person.lars_solberg').keys()
Out[]: dict_keys(['editable', 'id', 'latitude', 'longitude', 'gps_accuracy', 'source', 'user_id', 'friendly_name'])

I imagine this is also the case for other integrations, so it would be very nice with this documented a little, at least in this little issue :)

xeor commented 2 years ago

Found this information @ hass.data['person'][1].data['lars_solberg']['device_trackers' :)