{% set place_state = states(place_sensor_id) if place_sensor_id in states else 'unknown' %}
{% set place_state = states(place_sensor_id) if place_sensor_id in states else 'unknown' %}
{% set location_label = place_state if place_state not in ['unknown','unavailable','','none'] else person_state %}
{% set location_label = place_state if place_state not in ['unknown','unavailable','','none'] else person_state %}
{% set location_label = 'Away' if location_label in ['unknown','unavailable','','none'] else location_label %}
{% set location_label = 'Away' if location_label in ['unknown','unavailable','','none'] else location_label %}
{% set location_label = 'Away' if name == 'Paige' and 'Dorm' in location_label else location_label %}
{% set at_bear_stone = person_state == 'home' %}
{% set at_bear_stone = person_state == 'home' %}
{% set at_dorm = 'Dorm' in location_label %}
{% set location_key = location_label | lower %}
{% set at_personal_home = (name == 'Paige' and location_key == 'paige home') or (name == 'Justin' and location_key == 'justin dorm') %}
{% set last_changed = as_timestamp(person.last_changed) %}
{% set last_changed = as_timestamp(person.last_changed) %}
{% set seconds = (as_timestamp(now()) - last_changed) | int(0) if last_changed else 0 %}
{% set seconds = (as_timestamp(now()) - last_changed) | int(0) if last_changed else 0 %}
{% set hours = (seconds // 3600) | int %}
{% set hours = (seconds // 3600) | int %}
@ -311,12 +311,12 @@
{{name }}:driving{% if driving_label %} near {{ driving_label }}{% endif %}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{{name }}:driving{% if driving_label %} near {{ driving_label }}{% endif %}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{% elif at_bear_stone %}
{% elif at_bear_stone %}
{{name }}:at Bear Stone home{% if seconds >= 60 %} for {{ duration }}{% endif %}
{{name }}:at Bear Stone home{% if seconds >= 60 %} for {{ duration }}{% endif %}
{% elif at_dorm %}
{% elif at_personal_home %}
{{name }}:away at {{ location_label }}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{{name }}:home at {{ location_label }}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{% elif location_label == 'Away' %}
{% elif location_label == 'Away' %}
{{name }}:away{% if seconds >= 60 %} for {{ duration }}{% endif %}
{{name }}:location unavailable{% if seconds >= 60 %} for {{ duration }}{% endif %}
{% else %}
{% else %}
{{name }}:away at {{ location_label }}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{{name }}:at {{ location_label }}{% if seconds >= 60 %} for {{ duration }}{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{% endmacro %}
@ -362,9 +362,11 @@
) %}
) %}
[Current date time:{{month }} {{ day }}, {{ year }} {{ time }}]
[Current date time:{{month }} {{ day }}, {{ year }} {{ time }}]
[Presence rule:Bear Stone home means a resident's person state is exactly `home`.
[Presence and location rule:
Justin Dorm is an away-from-Bear-Stone location, not home for this house.
- Bear Stone home means a resident's person state is exactly `home`.
Do not welcome or address residents at dorm zones as being home here.]
- When a presence update is useful, name each resident's known location instead of saying only that they are away.
- Paige at Paige Home and Justin at Justin Dorm are each home at their own home. Do not describe either as away, and do not welcome them as being at Bear Stone.
- Other named places are off-site locations. Use "location unavailable" only when no current location label exists.]
[LLM speech contract:
[LLM speech contract:
- Write a useful spoken household announcement, not a sensor report.
- Write a useful spoken household announcement, not a sensor report.