#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# inspired by https://community.home-assistant.io/t/epson-wf-3540-ink-level-monitoring/21813
#-------------------------------------------

##############################################################################
###  Automations - Detect when things are not right. Like any Good Watchdog.
##############################################################################

automation:
  - alias: 'Printer Ink Alert'
    id: 6ef2a695-0b76-4eb5-b67c-2ff6f74f40b8
    initial_state: 'on'
    trigger:
      - platform: numeric_state
        entity_id:
          - sensor.epson_xp_7100_series_black_ink
          - sensor.epson_xp_7100_series_cyan_ink
          - sensor.epson_xp_7100_series_magenta_ink
          - sensor.epson_xp_7100_series_yellow_ink
          - sensor.epson_xp_7100_series_photo_black_ink
        below: 15
    condition:
      condition: time
      weekday:
        - wed
    action:
      - service: script.notify_engine
        data:
          value1: "{{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }} "
          who: 'carlo'
          apns_id: 'information'
      - service: script.tweet_engine_no_image
        data:
          tweet: 'Looks like my {{ trigger.to_state.attributes.friendly_name }} is LOW. @CCostan - Get me some more (https://amzn.to/2AnpFwD)'

#-------------------------------------------