diff --git a/automations/smoke_sensor.yaml b/automations/smoke_sensor.yaml index db7b1ad..44aa311 100644 --- a/automations/smoke_sensor.yaml +++ b/automations/smoke_sensor.yaml @@ -4,29 +4,33 @@ id: 8ce59ed4-f7dd-47a5-a1ab-ada15310fc2d trigger: - platform: state - entity_id: binary_sensor.rauchmelder_buro_christian_smoke_detected + entity_id: + - binary_sensor.rauchmelder_buro_christian_smoke_detected + - binary_sensor.rauchmelder_buro_christian_smoke_alarm_test + - binary_sensor.feueralarm_dummy to: - - 'off' - 'on' - - platform: state - entity_id: binary_sensor.rauchmelder_buro_christian_smoke_alarm_test - to: - - 'off' - - 'on' action: -# - variables: -# trigger_data: "{{ trigger.to_state.state }}" - - service: notify.dev_telegram + - variables: + param_entity: "{{trigger.to_state.entity_id}}" + param_test_alert: "{{states('binary_sensor.group_smoke_sensors_test_alert')}}" + - service: system_log.write data: - message: > - rauchmelder_buro_christian_smoke_detected changed - {{ trigger.entity_id }} - from {{ trigger.from_state.state }} to {{ trigger.to_state.state }} - starting "smoke_sensor_script"... + level: info + message: "Automation Feuer erkannt!! | Entity: {{param_entity}} | Test-Alert: {{param_test_alert}} Starte Skript für Feueralarm..." + # - service: notify.dev_telegram + # data: + # message: > + # rauchmelder_buro_christian_smoke_detected changed + # {{ trigger.entity_id }} + # from {{ trigger.from_state.state }} to {{ trigger.to_state.state }} + # starting "smoke_sensor_script"... - service: script.smoke_sensor_script data: - trigger_param_state: "{{ trigger.to_state.state }}" - trigger_param_entity_id: "{{trigger.entity_id}}" - trigger_param: trigger.to_state \ No newline at end of file + param_state: "{{trigger.to_state.state}}" + param_entity_id: "{{param_entity}}" + param_test_alert: "{{param_test_alert}}" + +mode: single \ No newline at end of file diff --git a/configuration.yaml b/configuration.yaml index fc2107a..4cbb381 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -12,8 +12,12 @@ tts: - platform: google_translate +ios: # https://www.justiot.de/smart-home/anleitung-push-nachrichten-mit-home-assistant-unter-ios/ -logger: +logger: # https://www.home-assistant.io/integrations/logger/ default: info logs: - waste_collection_schedule: debug \ No newline at end of file + waste_collection_schedule: debug + homeassistant.components.script: debug + homeassistant.components.automation: debug + pyfritzhome.fritzhome: warning \ No newline at end of file diff --git a/entities/notifiers/iphones.yaml b/entities/notifiers/iphones.yaml new file mode 100644 index 0000000..48fe146 --- /dev/null +++ b/entities/notifiers/iphones.yaml @@ -0,0 +1,5 @@ +# https://companion.home-assistant.io/docs/notifications/notifications-basic/ +name: iPhones +platform: group +services: + - service: mobile_app_christians_iphone_14 \ No newline at end of file diff --git a/integrations/notify.yaml b/integrations/notify.yaml index 87b95fa..2b3d9f6 100644 --- a/integrations/notify.yaml +++ b/integrations/notify.yaml @@ -1,3 +1,3 @@ # https://www.home-assistant.io/integrations/notify/ -# +# https://companion.home-assistant.io/docs/notifications/notifications-basic/ notify: !include_dir_list ../entities/notifiers \ No newline at end of file diff --git a/integrations/templates.yaml b/integrations/templates.yaml new file mode 100644 index 0000000..2991ec5 --- /dev/null +++ b/integrations/templates.yaml @@ -0,0 +1,11 @@ +--- +# The script integration allows users to specify a sequence of actions to be +# executed by Home Assistant when turned on. +# +# This loads up my custom tempates. +# +# https://www.home-assistant.io/integrations/template/ +# + +template: !include ../templates.yaml +template split: !include_dir_named ../templates diff --git a/scripts/smoke_sensor_script.yaml b/scripts/smoke_sensor_script.yaml index 2754fd6..2749b5a 100644 --- a/scripts/smoke_sensor_script.yaml +++ b/scripts/smoke_sensor_script.yaml @@ -1,16 +1,38 @@ description: "Racumelder Ereignisse bearbeiten" fields: # https://www.home-assistant.io/integrations/script/#passing-variables-to-scripts - trigger_param_entity_id: # https://www.home-assistant.io/integrations/script/#fields - description: "entity_id des meldenden Gerätes" - example: "binary_sensor.rauchmelder_buro_christian_smoke_detected" - required: "true" - trigger_param_state: - description: "Status des Ereignisses" - example: "on" - required: "true" - default: "off" + param_entity_id: # https://www.home-assistant.io/integrations/script/#fields + description: "entity_id des meldenden Gerätes" + example: "binary_sensor.rauchmelder_buro_christian_smoke_detected" + required: "true" + param_test_alert: + description: "probealarm ja/nein" + required: "true" + param_state: + description: "Status des Ereignisses" + example: "on" + required: "true" + default: "off" sequence: + - service: system_log.write + data: + level: info + message: "Skript Feueralarm für Entity '{{param_entity_id}}' gestartet. (State: {{param_state}}) | Probealarm: {{param_test_alert}} Starte Aktionen..." + + # send critical notifications https://companion.home-assistant.io/docs/notifications/critical-notifications + - service: notify.iPHONES + data: + title: "FEUERALARM" + message: "Feueralarm für '{{param_entity_id}}'" + data: + push: + sound: + name: "default" + critical: 1 + volume: 1.0 + - service: notify.dev_telegram data: message: > - todo: {{ trigger_param_state }}, {{ trigger_param_entity_id }} + Feueralarm für Entity '{{param_entity_id}}'!!! (State: {{param_state}}) | Probealarm: {{param_test_alert}} + + diff --git a/templates.yaml b/templates.yaml new file mode 100644 index 0000000..d619c73 --- /dev/null +++ b/templates.yaml @@ -0,0 +1,11 @@ +- sensor: + +- binary_sensor: + # simuliert einen nicht Hardware-Rouchmelder, der einfach über dem Dummy-Schalter aktiviert werden kann + - name: Feueralarm_Dummy + state: > + {% if states("input_boolean.switch_fire_alert_dummy")|lower == "on" %} + On + {% else %} + Off + {% endif %} \ No newline at end of file