From a5058b00f6668d2e3c32fb7198c5e14db873b5ea Mon Sep 17 00:00:00 2001 From: dmatik Date: Mon, 6 Nov 2023 07:34:17 +0200 Subject: [PATCH] update red alert automations --- homeassistant/config/automations.yaml | 266 +++++++++++++++++- .../redalert/binary_sensors_redalert.yaml | 61 ++++ 2 files changed, 326 insertions(+), 1 deletion(-) diff --git a/homeassistant/config/automations.yaml b/homeassistant/config/automations.yaml index 9857d3ce..8f3686bf 100644 --- a/homeassistant/config/automations.yaml +++ b/homeassistant/config/automations.yaml @@ -552,7 +552,7 @@ to: 'off' for: hours: 0 - minutes: 5 + minutes: 10 seconds: 0 from: 'on' condition: [] @@ -924,3 +924,267 @@ no_motion_wait: 10 light_target: entity_id: light.kitchen_led_strip +- id: '1699248159943' + alias: Red Alert Shtulim + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_shtulim + to: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + שתולים + + ' + data: + tag: redalert-shtulim + - service: notify.mobile_app_galitphone + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + שתולים + + ' + data: + tag: redalert-shtulim + enabled: true + mode: single +- id: '1699248227759' + alias: Red Alert Shtulim Clear + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_shtulim + to: 'off' + for: + hours: 0 + minutes: 10 + seconds: 0 + from: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + message: clear_notification + data: + tag: redalert-shtulim + - service: notify.mobile_app_galitphone + data: + message: clear_notification + data: + tag: redalert-shtulim + mode: single +- id: '1699248446778' + alias: Red Alert Hatsor + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_hatsor + to: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + חצור + + ' + data: + tag: redalert-hatsor + - service: notify.mobile_app_galitphone + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + חצור + + ' + data: + tag: redalert-hatsor + enabled: true + mode: single +- id: '1699248492044' + alias: Red Alert Hatsor Clear + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_hatsor + to: 'off' + for: + hours: 0 + minutes: 10 + seconds: 0 + from: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + message: clear_notification + data: + tag: redalert-hatsor + - service: notify.mobile_app_galitphone + data: + message: clear_notification + data: + tag: redalert-hatsor + mode: single +- id: '1699248553557' + alias: Red Alert Bitsron + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_bitsron + to: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + ביצרון + + ' + data: + tag: redalert-bitsron + - service: notify.mobile_app_galitphone + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + ביצרון + + ' + data: + tag: redalert-bitsron + enabled: true + mode: single +- id: '1699248594979' + alias: Red Alert Bitsron Clear + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_bitsron + to: 'off' + for: + hours: 0 + minutes: 10 + seconds: 0 + from: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + message: clear_notification + data: + tag: redalert-bitsron + - service: notify.mobile_app_galitphone + data: + message: clear_notification + data: + tag: redalert-bitsron + mode: single +- id: '1699248658108' + alias: Red Alert Ashdod + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_ashdod + to: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + אשדוד + + ' + data: + tag: redalert-ashdod + - service: notify.mobile_app_galitphone + data: + title: '{{ state_attr("sensor.redalert", "current")["title"] }}' + message: '{% if state_attr("sensor.redalert", "current")["desc"] != "" -%} + + {{state_attr("sensor.redalert", "current")["desc"]}} + + {%- endif %} + + אשדוד + + ' + data: + tag: redalert-ashdod + enabled: true + mode: single +- id: '1699248701741' + alias: Red Alert Ashdod Clear + description: '' + trigger: + - platform: state + entity_id: + - binary_sensor.redalert_ashdod + to: 'off' + for: + hours: 0 + minutes: 10 + seconds: 0 + from: 'on' + condition: [] + action: + - service: notify.mobile_app_iphonedima + data: + message: clear_notification + data: + tag: redalert-ashdod + - service: notify.mobile_app_galitphone + data: + message: clear_notification + data: + tag: redalert-ashdod + mode: single diff --git a/homeassistant/config/packages/redalert/binary_sensors_redalert.yaml b/homeassistant/config/packages/redalert/binary_sensors_redalert.yaml index 0a0dcdad..c47ca6ec 100644 --- a/homeassistant/config/packages/redalert/binary_sensors_redalert.yaml +++ b/homeassistant/config/packages/redalert/binary_sensors_redalert.yaml @@ -44,6 +44,67 @@ binary_sensor: 'גן יבנה' in state_attr('sensor.redalert', 'current')['data'] }} + +############################################################################ +# # +# Redalert Bitsron # +# # +############################################################################ + + redalert_bitsron: + friendly_name: "Redalert Bitsron" + value_template: >- + {{ state_attr('sensor.redalert', 'alert') == true and + 'ביצרון' in state_attr('sensor.redalert', 'current')['data'] }} + + + +############################################################################ +# # +# Redalert Shtulim # +# # +############################################################################ + + redalert_shtulim: + friendly_name: "Redalert Shtulim" + value_template: >- + {{ state_attr('sensor.redalert', 'alert') == true and + 'שתולים' in state_attr('sensor.redalert', 'current')['data'] }} + + + +############################################################################ +# # +# Redalert Hatsor # +# # +############################################################################ + + redalert_hatsor: + friendly_name: "Redalert Hatsor" + value_template: >- + {{ state_attr('sensor.redalert', 'alert') == true and + 'חצור' in state_attr('sensor.redalert', 'current')['data'] }} + + + +############################################################################ +# # +# Redalert Ashdod # +# # +############################################################################ + + redalert_ashdod: + friendly_name: "Redalert Ashdod" + value_template: >- + {{ state_attr('sensor.redalert', 'alert') == true and + ('אשדוד - א,ב,ד,ה' in state_attr('sensor.redalert', 'current')['data'] or + 'אשדוד - איזור תעשייה צפוני' in state_attr('sensor.redalert', 'current')['data'] or + 'אשדוד - ג,ו,ז' in state_attr('sensor.redalert', 'current')['data'] or + 'אשדוד - ח,ט,י,יג,יד,טז' in state_attr('sensor.redalert', 'current')['data'] or + 'אשדוד -יא,יב,טו,יז,מרינה,סיט' in state_attr('sensor.redalert', 'current')['data'] ) }} + + + ############################################################################ # # # Redalert Test #