#########################################################################################
# @Author:      Suresh Kalavala
# @Date:        09/13/2017
# @Description: This Season sensor is used in the voice notifications to notify of Pollen 
#               levels ONLY during Spring - because I am allergic to spring pollen ;)
#               There you have it!!!
#
#               Possible Season values are: Spring, Summer, Autumn, and Winter
#########################################################################################

homeassistant:
  customize:

    ################################################
    ## Node Anchors
    ################################################

    package.node_anchors:
      customize: &customize
        package: 'season'

      hidden: &hidden
        <<: *customize
        hidden: true

    sensor.season:
      <<: *hidden

sensor:
  - platform: season
    type: astronomical

###############################################################################
#                _                        _   _                 
#     /\        | |                      | | (_)                
#    /  \  _   _| |_ ___  _ __ ___   __ _| |_ _  ___  _ __  ___ 
#   / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
#  / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
# /_/    \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
#                                                                              
###############################################################################
automation:

  - alias: Season Change Notification
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.season
    condition:
      - condition: template
        value_template: '{{ trigger.from_state.state | lower != "unknown" }}'
    action:
      - service: script.notify_me
        data_template:
            message: >
              Good bye {{ trigger.from_state.state }}, and Say Hello to {{ trigger.to_state.state }}!