diff --git a/blueprints/automation/awtrix_indicator.yaml b/blueprints/automation/awtrix_indicator.yaml index 782cafc..2215903 100644 --- a/blueprints/automation/awtrix_indicator.yaml +++ b/blueprints/automation/awtrix_indicator.yaml @@ -43,6 +43,14 @@ blueprint: selector: boolean: default: false + show_current_meeting: + name: Display current meeting countdown + description: >- + Show how much time reamining in current meeting + selector: + boolean: + default: false + next_meeting_time_color: name: Next Meeting - Time Color description: Select the color for the time text for next-meeting notifications @@ -266,9 +274,23 @@ blueprint: mode: slider default: 0 + min_suffix: + name: Min Suffix + description: What shoudl we use to show Mins. Prepend a space if you want a space between number and text. + selector: + text: + default: " m" + hour_suffix: + name: Hour Suffix + description: What shoudl we use to show Hours. Prepend a space if you want a space between number and text. + selector: + text: + default: " hr" + mode: queued variables: show_next_meeting: !input show_next_meeting + show_current_meeting: !input show_current_meeting color_active: !input color_active color_1_min_warning: !input color_1_min_warning @@ -288,10 +310,13 @@ variables: next_meeting_time_color: !input next_meeting_time_color next_meeting_text_color: !input next_meeting_text_color next_meeting_separator_color: !input next_meeting_separator_color + min_suffix: !input min_suffix + hour_suffix: !input hour_suffix calendar: !input calendar cal_state: "{{states(calendar)}}" + device_ids: !input awtrix light_suffix: !input indicator lights: >- {%- set ns = namespace(lights=[]) %} @@ -300,7 +325,7 @@ variables: {% set ns.lights = ns.lights + [light] %} {% endfor %} {{ ns.lights}} - device_ids: !input awtrix + devices_topics: >- {%- macro get_device_topic(device_id) %} {{- states((device_entities(device_id) | select('search','device_topic') | list)[0]) }} @@ -313,8 +338,7 @@ variables: {%- endfor %} {{ ns.devices | reject('match','unavailable') | list}} - next_meeting_base_topic: jeef_next_meeting - + next_meeting_base_topic: "{{calendar | replace('.','_') ~ '_next_meeting' }}" next_meeting_topics: >- {{devices_topics | regex_replace(find='indicator.', replace='custom/' ~ next_meeting_base_topic, ignorecase=False) }} sound_topics: >- @@ -359,7 +383,7 @@ trigger: id: 0_min action: - - service: calendar.list_events + - service: calendar.get_events data: duration: hours: 8 @@ -492,7 +516,7 @@ action: } {%- endmacro %} {%- set ns = namespace(parsed_events=[]) %} - {%- for event in cal_events.events %} + {%- for event in cal_events[calendar].events %} {%- set e_dict = event_to_dict(event) %} {%- set ns.parsed_events = ns.parsed_events + [ (e_dict | from_json )] %} @@ -500,7 +524,7 @@ action: {{ns.parsed_events | sort(attribute='start_ts')}} locations: >- {%- set ns = namespace(locations=[]) %} - {%- for event in cal_events.events %} + {%- for event in cal_events[calendar].events %} {% set loc = {"locations": ((event.location | replace('\n', ' ')) | to_json) } %} {%- set ns.locations = ns.locations + [loc] + [loc] %} {%- endfor -%} @@ -551,9 +575,9 @@ action: {%- set min = (next_events[0].start_min | float) -%} {%- set hr = (min / 60) | float | round(1) -%} {%- if min > 60 -%} - {{hr | replace('.0','')}} hr + {{hr | replace('.0','')}}{{hour_suffix}} {%- else -%} - {{min | replace('.0','')}} min + {{min | replace('.0','')}}{{min_suffix}} {%- endif -%} {%- endif -%} next_events_payload: >- @@ -596,6 +620,8 @@ action: {% endmacro -%} {{ get_color_blink(event_payload)}} + sound_payload_dev: >- + {{trigger.id}} sound_payload: >- {%- if trigger.id != 'temporal' %} {{sound_dict[trigger.id]}} @@ -644,10 +670,14 @@ action: payload: >- {{sound_payload}} - - service: mqtt.publish - data: - qos: 0 - topic: dev-test - payload: >- - {%- set idx = trigger.id %} - {{sound_dict[idx]}} {{sound_dict}} + - if: + - condition: template + value_template: "{{trigger.id != 'temporal'}}" + then: + - service: mqtt.publish + data: + qos: 0 + topic: dev-test + payload: >- + {%- set idx = trigger.id %} + {{sound_dict[idx]}} {{sound_dict}}