Testing new USPS HACS integration...looking good
This commit is contained in:
parent
cb0e4bcb99
commit
056e9b7d27
|
@ -26,11 +26,89 @@ sensor:
|
|||
state_topic: 'house/usps/packages'
|
||||
value_template: "{{ value }}"
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
mail_deliveries_message:
|
||||
friendly_name: "Deliveries Summary"
|
||||
entity_id:
|
||||
- sensor.mail_usps_mail
|
||||
- sensor.mail_usps_delivering
|
||||
- sensor.mail_fedex_delivering
|
||||
- sensor.mail_ups_delivering
|
||||
value_template: >
|
||||
{# Deliveries Sentence #}
|
||||
{% macro deliveries_sentence() -%}
|
||||
{%- if states("sensor.mail_usps_mail")|int == 0 -%}
|
||||
No
|
||||
{%- else -%}
|
||||
{{states("sensor.mail_usps_mail")|int}}
|
||||
{%- endif -%}
|
||||
{{' '}}
|
||||
{%- if states("sensor.mail_usps_mail")|int <= 1 -%}
|
||||
piece of mail
|
||||
{%- else -%}
|
||||
pieces of mail
|
||||
{%- endif -%}
|
||||
{{' '}}will be delivered.{{' '}}
|
||||
{%- if states("sensor.mail_usps_delivering")|int == 0 -%}
|
||||
No
|
||||
{%- else -%}
|
||||
{{states("sensor.mail_usps_delivering")|int}}
|
||||
{%- endif -%}
|
||||
{{' '}}
|
||||
{%- if states("sensor.mail_usps_delivering")|int == 1 -%}
|
||||
USPS package is
|
||||
{%- else -%}
|
||||
USPS packages are
|
||||
{%- endif -%}
|
||||
{{' '}}in transit.{{' '}}
|
||||
{%- if states("sensor.mail_fedex_delivering")|int == 0 -%}
|
||||
No
|
||||
{%- else -%}
|
||||
{{states("sensor.mail_fedex_delivering")|int}}
|
||||
{%- endif -%}
|
||||
{{' '}}
|
||||
{%- if states("sensor.mail_fedex_delivering")|int == 1 -%}
|
||||
FedEx package is
|
||||
{%- else -%}
|
||||
Fedex packages are
|
||||
{%- endif -%}
|
||||
{{' '}}in transit.{{' '}}
|
||||
{%- if states("sensor.mail_ups_delivering")|int == 0 -%}
|
||||
No
|
||||
{%- else -%}
|
||||
{{states("sensor.mail_ups_delivering")|int}}
|
||||
{%- endif -%}
|
||||
{{' '}}
|
||||
{%- if states("sensor.mail_ups_delivering")|int == 1 -%}
|
||||
UPS package is
|
||||
{%- else -%}
|
||||
UPS packages are
|
||||
{%- endif -%}
|
||||
{{' '}}in transit.{{' '}}
|
||||
{%- if states("sensor.mail_amazon_packages")|int == 0 -%}
|
||||
No
|
||||
{%- else -%}
|
||||
{{states("sensor.mail_amazon_packages")|int}}
|
||||
{%- endif -%}
|
||||
{{' '}}
|
||||
{%- if states("sensor.mail_amazon_packages")|int == 1 -%}
|
||||
Amazon package is
|
||||
{%- else -%}
|
||||
Amazon packages are
|
||||
{%- endif -%}
|
||||
{{' '}}in transit.{{' '}}
|
||||
{%- endmacro %}
|
||||
{{deliveries_sentence()}}
|
||||
|
||||
camera:
|
||||
- platform: generic
|
||||
name: USPS Mail Pictures
|
||||
still_image_url: !secret usps_camera_url
|
||||
|
||||
- platform: local_file
|
||||
file_path: /config/images/mail_today.gif
|
||||
name: mail_usps
|
||||
|
||||
automation:
|
||||
|
||||
|
@ -115,3 +193,48 @@ automation:
|
|||
{%- endif -%}
|
||||
call_interuption: 1
|
||||
|
||||
- alias: "Mail Notif - Mail Delieveries"
|
||||
initial_state: 'on'
|
||||
trigger:
|
||||
- platform: time
|
||||
at: '10:00:00'
|
||||
#Trigger if mail or packages get updated
|
||||
# - platform: state
|
||||
# entity_id: sensor.mail_usps_mail
|
||||
# - platform: state
|
||||
# entity_id: sensor.mail_usps_delivering
|
||||
#send only if mail or packages are more than 0
|
||||
condition:
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ states('sensor.mail_usps_mail') | int > 0 }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('sensor.mail_usps_delivering') | int > 0 }}"
|
||||
action:
|
||||
- service: script.text_notify
|
||||
data_template:
|
||||
who: "jeff"
|
||||
title: "Delivering Today"
|
||||
message: "{{ states('sensor.mail_deliveries_message')}}"
|
||||
- service: script.ah_report
|
||||
data_template:
|
||||
usps: >-
|
||||
{%- if states.sensor.mail_usps_mail.state | int == 1 -%}
|
||||
{{ [
|
||||
"USPS is delivering",
|
||||
"The postal service will be leaving",
|
||||
"The nice lady in the mail truck is bringing us ",
|
||||
"I have scanned the incoming mail,and there is"
|
||||
] | random }}
|
||||
{{ states.sensor.mail_usps_mail.state }} piece of mail today.
|
||||
{%- else -%}
|
||||
{{ [
|
||||
"USPS is delivering",
|
||||
"The postal service will be leaving",
|
||||
"The nice lady in the mail truck is bringing us ",
|
||||
"I have scanned the incoming mail, and determined there are"
|
||||
] | random }}
|
||||
{{ states.sensor.mail_usps_mail.state }} pieces of mail today.
|
||||
{%- endif -%}
|
||||
call_interuption: 1
|
Loading…
Reference in New Issue