diff --git a/automations/alarm.yaml b/automations/alarm.yaml new file mode 100644 index 0000000..c08aca2 --- /dev/null +++ b/automations/alarm.yaml @@ -0,0 +1,46 @@ +- alias: alarm disarm + trigger: + - platform: state + entity_id: alarm_control_panel.home_alarm + to: 'disarmed' + action: + - service: notify.telegram_fb + data_template: + title: "*Alarm DEAKTIVIERT!*" + message: "Der Alarm wurde *deaktiviert*." + - service: script.shinobi_active + +- alias: alarm pending + trigger: + - platform: state + entity_id: alarm_control_panel.home_alarm + to: 'pending' + action: + - service: notify.telegram_fb + data_template: + title: "*Alarm wird aktiviert...*" + message: "Der Alarm wird in kürze scharf geschaltet!" + +- alias: alarm away + trigger: + - platform: state + entity_id: alarm_control_panel.home_alarm + to: 'armed_away' + action: + - service: notify.telegram_fb + data_template: + title: "*Alarm SCHARF!*" + message: "Der Alarm ist im *Unterwegs*-Modus." + - service: script.shinobi_active_with_motion + +- alias: alarm night + trigger: + - platform: state + entity_id: alarm_control_panel.home_alarm + to: 'armed_night' + action: + - service: notify.telegram_fb + data_template: + title: "*Alarm SCHARF!*" + message: "Der Alarm ist im *Nacht*-Modus." + - service: script.shinobi_active_with_motion \ No newline at end of file diff --git a/configuration.yaml b/configuration.yaml index a4c644c..10bf790 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -187,6 +187,12 @@ binary_sensor: host: !secret desktop_ip count: 2 scan_interval: 15 + - platform: template + sensors: + cctv_active: + value_template: "{{ is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording') }}" + cctv_motion_detection_active: + value_template: "{{ (is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording')) and is_state('sensor.camera_motion_office', 'True') }}" weather: - platform: openweathermap @@ -214,6 +220,24 @@ input_datetime: has_date: false has_time: true +alarm_control_panel: + - platform: manual + name: Home Alarm + code: !secret alarm_code + code_arm_required: true + delay_time: 20 + pending_time: 30 + trigger_time: 120 + disarm_after_trigger: false + disarmed: + trigger_time: 0 + armed_home: + pending_time: 0 + delay_time: 0 + armed_night: + pending_time: 0 + delay_time: 0 + shell_command: ssh: 'ssh -o "StrictHostKeyChecking=no" -i {{ sshkey }} {{ host }} -l {{ user }} -p {{ port }} {{ command_or_param }}' diff --git a/lovelace-views/cctv.yaml b/lovelace-views/cctv.yaml index ead70ce..27fb8fd 100644 --- a/lovelace-views/cctv.yaml +++ b/lovelace-views/cctv.yaml @@ -4,10 +4,10 @@ cards: - type: entities show_header_toggle: false entities: - - entity: switch.cctv_active + - entity: binary_sensor.cctv_active name: Kameras aktiviert icon: mdi:power - - entity: switch.cctv_motion_detection + - entity: binary_sensor.cctv_motion_detection_active name: Aufnahmen bei Bewegung icon: mdi:motion-sensor - type: picture-glance @@ -15,7 +15,13 @@ cards: camera_image: camera.office camera_view: live entities: - - entity: switch.cctv_motion_detection + - entity: binary_sensor.cctv_motion_detection_active icon: mdi:motion-sensor - - entity: switch.cctv_active + - entity: binary_sensor.cctv_active icon: mdi:power + - type: alarm-panel + name: Alarm + entity: alarm_control_panel.home_alarm + states: + - arm_away + - arm_night \ No newline at end of file diff --git a/sensors/cctv.yaml b/sensors/cctv.yaml index fc32519..e04aad3 100644 --- a/sensors/cctv.yaml +++ b/sensors/cctv.yaml @@ -1,8 +1,9 @@ - - platform: rest - resource: !secret office_details_url - name: Camera Mode Office - value_template: '{{ value_json.mode }}' - - platform: rest - resource: !secret office_details_url - name: Camera Motion Office - value_template: '{{ value_json.details|string|regex_search("\"detector\":\"1\"", ignorecase=FALSE) }}' \ No newline at end of file +- platform: rest + resource: !secret office_details_url + name: Camera Mode Office + value_template: '{{ value_json.mode }}' + +- platform: rest + resource: !secret office_details_url + name: Camera Motion Office + value_template: '{{ value_json.details|string|regex_search("\"detector\":\"1\"", ignorecase=FALSE) }}' diff --git a/switches.yaml b/switches.yaml index d985905..4179b3f 100644 --- a/switches.yaml +++ b/switches.yaml @@ -115,7 +115,7 @@ cctv_motion_detection: friendly_name: CCTV Motion Detection - value_template: "{{ (is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording')) and is_state('sensor.camera_motion_office', 'True') }}" + value_template: "{{ states('binary_sensor.cctv_motion_detection_active') }}" turn_on: service: script.shinobi_active_with_motion turn_off: @@ -123,7 +123,7 @@ cctv_active: friendly_name: CCTV Active - value_template: "{{ is_state('sensor.camera_mode_office', 'start') or is_state('sensor.camera_mode_office', 'recording') }}" + value_template: "{{ states('binary_sensor.cctv_active') }}" turn_on: service: script.shinobi_active turn_off: