Home-AssistantConfig/config/packages/epson_printer.yaml

87 lines
3.6 KiB
YAML
Executable File

#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# inspired by https://community.home-assistant.io/t/epson-wf-3540-ink-level-monitoring/21813
#-------------------------------------------
homeassistant:
customize_glob:
homebridge_hidden: True
#-------------------------------------------
# sensor:
# - platform: command_line
# name: Epson Ink Level Black
# command: /usr/bin/curl -X GET http://192.168.10.105/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_K.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100; exit }'
# unit_of_measurement: '%'
# scan_interval: 14400
#
# - platform: command_line
# name: Epson Ink Level Magenta
# command: /usr/bin/curl -X GET http://192.168.10.105/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_M.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100 }'
# unit_of_measurement: '%'
# scan_interval: 14400
#
# - platform: command_line
# name: Epson Ink Level Yellow
# command: /usr/bin/curl -X GET http://192.168.10.105/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_Y.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100 }'
# unit_of_measurement: '%'
# scan_interval: 14400
#
# - platform: command_line
# name: Epson Ink Level Cyan
# command: /usr/bin/curl -X GET http://192.168.10.105/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_C.PNG/ && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100 }'
# unit_of_measurement: '%'
# scan_interval: 14400
#
# - platform: command_line
# name: Epson Ink Level Photo Black
# command: /usr/bin/curl -X GET http://192.168.10.105/PRESENTATION/HTML/TOP/PRTINFO.HTML | awk -F"'" '/Ink_K.PNG/ {i++}i==2 && $6+0 == $6 { printf "%.0f\n", $6 / 50 * 100; exit }'
# unit_of_measurement: '%'
# scan_interval: 14400
#-------------------------------------------
group:
epson_printer:
name: Epson Printer Info
entities:
- 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
#-------------------------------------------
##############################################################################
### Automations - Detect when things are not right. Like any Good Watchdog.
##############################################################################
automation:
- alias: 'Printer Ink Alert'
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: persistent_notification.create
data_template:
title: Low Ink
message: "{{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }} "
notification_id: low-battery-alert
- service: script.notify_engine
data_template:
value1: "{{ trigger.to_state.attributes.friendly_name }} is at {{ trigger.to_state.state }} "
who: 'carlo'
- service: script.tweet_engine
data:
tweet: 'Looks like my {{ trigger.to_state.attributes.friendly_name }} is LOW. @CCostan - Get me some more (https://amzn.to/2AnpFwD)'
#-------------------------------------------