brianjking/homeassistant-config

Update package delivery template to use 17track sensor

brianjking opened this issue · 1 comments

Update deliveries.yaml template to use the 17track.net sensors

https://github.com/brianjking/homeassistant-config/blob/master/sensor/deliveries.yaml

Existing file contents for deliveries.yaml:

- platform: template
  sensors:
      packages_in_transit:
        friendly_name: "Packages in Transit"
        value_template: >
          {% macro in_transit(sensor) %}
            {{sensor.state|int - delivered(sensor)|int}}
          {% endmacro %}
          {% macro delivered(sensor) %}
            {% if 'delivered' in sensor.attributes %}
              {{sensor.attributes.delivered}}
            {% else %}
               0
            {% endif %}
          {% endmacro %}
          {{in_transit(states.sensor.usps_packages)|int + in_transit(states.sensor.fedex)|int}}

      deliveries_today:
        friendly_name: "Today's Deliveries"
        value_template: >
          {% macro delivered(sensor) %}
            {% if 'delivered' in sensor.attributes %}
              {{sensor.attributes.delivered}}
            {% else %}
               0
            {% endif %}
          {% endmacro %}
          {{delivered(states.sensor.usps_packages)|int + delivered(states.sensor.fedex)|int}}
  Packages:
    entities:  
    - sensor.usps_mail
    - sensor.usps_packages
    - sensor.usps
    - sensor.fedex
    - sensor.ups
    - sensor.deliveries_today
    - sensor.packages_in_transit
    - camera.usps_mail
    - sensor.usps_mail
    - sensor.usps_packages
    - camera.usps_mail_pictures
    - sensor.packages_in_transit_2
    - sensor.packages_ready_to_be_picked_up
    - sensor.packages_not_found
    - sensor.packages_ready_to_be_picked_up

17track.net specific sensors entities:

    - sensor.packages_in_transit_2
    - sensor.packages_ready_to_be_picked_up
    - sensor.packages_not_found
    - sensor.packages_ready_to_be_picked_up