# https://www.home-assistant.io/integrations/notify
notify:
  - name: telegram
    platform: telegram
    api_key: !secret telegram_token
    chat_id: !secret telegram_georgi_chat_id

automation:
  - alias: Notification · Phone battery low
    trigger:
      platform: template
      value_template: "{{ states('sensor.carbon_battery_level') | int < 10 }}"
    condition:
      condition: state
      entity_id: sensor.carbon_battery_state
      state: "Not Charging"
    action:
      - service: script.say
        data_template:
          title: "❕*Notification Module*"
          message: >-

            {{
              [
                "Hey, just wanted to let you know your phone needs charging!",
                "Hey, your phone is running low on battery, put it on the charger!"
              ] | random
            }}
      - service: notify.telegram
        data_template:
          title: "⚠️ *Notification module · Low Battery"
          message: >-

            {{
              [
                "Hey, just wanted to let you know your phone needs charging!",
                "Hey, your phone is running low on battery, put it on the charger!"
              ] | random
            }}


  - alias: Notification · Door opened
    trigger:
      platform: state
      entity_id: binary_sensor.front_door_contact
      to: "on"
      for:
        minutes: 2
    action:
      - service: script.say
        data_template:
          title: "⚠️ *Notification Module · Front Door*"
          message: >-

            {{
              [
                "Hey, the front door is opened. Are you home?!",
                "Hey, the front door has been opened for 2 minutes!"
              ] | random
            }}
