Created
August 5, 2023 20:41
-
-
Save jlpouffier/44a6a5937eed0881a71c09c0dff56894 to your computer and use it in GitHub Desktop.
Home Assistant Hot Tip of the Day: Home Occupancy Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.home-assistant.io/integrations/template/ | |
template: | |
- binary_sensor: | |
- name: home_occupied | |
unique_id: home_occupied | |
state: "{{states('zone.home')|int > 0}}" | |
device_class: occupancy | |
attributes: | |
is_home_full: "{{states('zone.home')|int == expand(states.person)|list|count}}" | |
present_persons: | | |
{{ | |
expand(states.person) | |
| selectattr('state', 'eq', 'home') | |
| map(attribute='attributes.friendly_name') | |
| list | |
| sort | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment