#intents:


WhatIsTheCurrentStatus:
  speech:
    type: plain
    text: >
      Outside it's {{states.sensor.dark_sky_summary.state}} and {{states.sensor.dark_sky_temperature.state|round}} degrees in Grayson.
      Today will be {{states.sensor.dark_sky_hourly_summary.state|replace(".", "")}},
      with a high of {{states.sensor.dark_sky_daily_high_temperature.state|round}} degrees.
      {%- if is_state('sensor.pws_alerts', '0') -%}
        There are no active weather alerts.
      {%- else -%}
        There are {{states.sensor.pws_alerts.state}} active weather alerts.
      {% endif %}
      {%- if is_state('sun.sun', 'above_horizon') -%}
        The sun will set at {{ ((as_timestamp(states.sun.sun.attributes.next_setting)) | timestamp_local) [11:16] }}
      {% else %}
        The sun will rise at {{ ((as_timestamp(states.sun.sun.attributes.next_rising)) | timestamp_local) [11:16] }}
      {% endif %}

IsTheHouseSecure:
  speech:
    type: plain
    text: >
      {%- if is_state('binary_sensor.zone_3', 'on') -%}
        Zone 3 is currently open.
      {%- else -%}
        Zone 3 is closed
      {% endif %}
      {%- if is_state('cover.garage_door', 'open') -%}
        The Garage Door is currently open.
      {%- else -%}
        The Garage Door is closed
      {% endif %}
      {%- if is_state('input_boolean.house_secured', 'on') -%}
        Anchorage House is actively monitoring.
      {%- else -%}
        Anchorage House is not being monitoring.
      {% endif %}

GarageStatus:
  speech:
    type: plain
    text: >
      {%- if is_state('sensor.garage_door_contact', 'open') -%}
        The Garage is open
      {%- else -%}
        The Garage is closed
      {% endif %}

CloseTheGarage:
  action:
    service: script.turn_on
    data_template:
      entity_id: script.close_garage
  speech:
    type: plain
    text: !include alexa_confirm.yaml

OpenTheGarage:
  action:
    service: script.turn_on
    data_template:
      entity_id: script.open_garage
  speech:
    type: plain
    text: !include alexa_confirm.yaml
    
JeffETRHome:
  speech:
    type: plain
    text: >
      {%- if is_state('device_tracker.owntracks_jeffreystonesiphone', 'home') -%}
        It appears Jeff is home
      {%- else -%}        
        Jeff will be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}}
      {% endif %}

KatETRHome:
  speech:
    type: plain
    text: >
      {%- if is_state('device_tracker.katherinestonesiphone', 'home') -%}
        It appears Katherine is home
      {%- else -%}        
        Katherine will be home in {{states.sensor.kat_ett_home.attributes.duration_in_traffic}}
      {% endif %}

WhereIsJeff:
  speech:
    type: plain
    text: >
      {%- if is_state('device_tracker.owntracks_jeffreystonesiphone', 'home') -%}
        Jeff is here somewhere. Where was the last place you saw him?
      {%- else -%}
        {%- if is_state('sensor.jeffrey_location', 'moving') -%}
          Jeff is currently inbetween stops and could be home in {{states.sensor.jeff_ett_home.attributes.duration_in_traffic}}
        {%- else -%}
          Jeff is at {{ states("sensor.jeffrey_location") }}
        {% endif %}
      {% endif %}

WhereIsKat:
  speech:
    type: plain
    text: >
      {%- if is_state('device_tracker.katherinestonesiphone', 'home') -%}
        Katherine is here.
      {%- else -%}
        {%- if is_state('device_tracker.katherinestonesiphone', 'not_home') -%}
          Katherine is currently inbetween stops and could be home in {{states.sensor.kat_ett_home.attributes.duration_in_traffic}}
        {%- else -%}
          Katherine is at {{ states.device_tracker.katherinestonesiphone.state }}
        {% endif %}
      {% endif %}