@mekaneck I also came to that conclusion that a trigger sensor is the answer. I cant find really good examples/docs on how to create/use them and the ones I have I’m not sure are working as they should. Some examples I found and using but I’m not 100% up to speed on how to mod to make them work. I’m still trying to get my head around Templates… the ‘language’ is not like JS or VB/S
Ideally we’d be storing values into variables we could act upon, for each Entity in the Group…
- Name — %group.groupname_entityname_name%
- State — %group.groupname_entityname_state%
- Last_Change — %group.groupname_entityname_last_change%
This one is working. Creates a Logbook.
- trigger:
- platform: event
event_type: zwave_js_notification
event_data:
device_id: lock.front_entry_deadbolt
label: Access Control
sensor:
- name: "Front Door Lock Event"
state: "{{now() | as_local }}"
unique_id: front_door_lock_event
attributes:
log: >
{% set log = this.attributes.get('log', []) %}
{% set new = [{
"event": trigger.event.data.event_label,
"user": trigger.event.data.parameters.userId,
"time": (trigger.event.time_fired | as_local).isoformat() }] %}
{{ (new + log)[:30] }}
This one is not working for me, its not creating the sensor.unavailable_entities entity at all…
- trigger:
- platform: time_pattern
minutes: "/1"
event_data:
device_id: sensor.unavailable_entities
sensor:
- name: Unavailable Entities
icon: mdi:help-circle-outline
state: "{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | rejectattr('domain', '==', 'button') | rejectattr('entity_id', 'search', '_device_temperature$') | rejectattr('domain', 'in', ['device_tracker', 'person']) | rejectattr('entity_id', 'search', '_charger_type$') | map(attribute='entity_id') | reject('==', 'sensor.unavailable_entities') | list | length }}"
unit_of_measurement: entities
state_class: measurement
attributes:
unavailable: "{{ states | selectattr('state', 'in', ['unavailable']) | rejectattr('domain', '==', 'button') | rejectattr('entity_id', 'search', '_device_temperature$') | rejectattr('domain', 'in', ['device_tracker', 'person']) | rejectattr('entity_id', 'search', '_charger_type$') | map(attribute='entity_id') | reject('==', 'sensor.unavailable_entities') | list }}"
unknown: "{{ states | selectattr('state', 'in', ['unknown']) | rejectattr('domain', '==', 'button') | rejectattr('entity_id', 'search', '_device_temperature$') | rejectattr('domain', 'in', ['device_tracker', 'person']) | rejectattr('entity_id', 'search', '_charger_type$') | map(attribute='entity_id') | reject('==', 'sensor.unavailable_entities') | list }}"
none: "{{ states | selectattr('state', 'in', ['none']) | rejectattr('domain', '==', 'button') | rejectattr('entity_id', 'search', '_device_temperature$') | rejectattr('domain', 'in', ['device_tracker', 'person']) | rejectattr('entity_id', 'search', '_charger_type$') | map(attribute='entity_id') | reject('==', 'sensor.unavailable_entities') | list }}"