@BrianHanifin, i just found your Topic after i created my own for this automation, but here is a better place for this:
Alexa, when is my laundry finished
With this automation i can ask my Echo: Alexa, when is my laundry finished?
She will respond:
- and ask wich kind of laundry is in to answer the minutes it needs to be finished
- or only respond that it’s already finished or that there is no laundry in
So it’s not really a Notification but ‘Actionable’ with Alexa Actions
I already use a AVM Fritz!Dect 200 for power metering to know in wich state my Washing Machine is
in with this Input Select:
input_select:
state_washingmachine:
name: Washing Machine Status
options:
- Switched Off
- Idle
- Washing
.
To change the options based on the power metering i use these automations:
- alias: 'Washing Machine - Change State Switched Off'
trigger:
platform: numeric_state
entity_id: switch.waschmaschine
value_template: "{%if states.switch.waschmaschine.attributes.current_power_w is defined %}{{state.attributes.current_power_w}}{%else%}0{%endif%}"
below: 1
action:
- service: input_select.select_option
data:
entity_id: input_select.state_washingmachine
option: 'Switched Off'
- alias: 'Washing Machine - Change State Idle'
trigger:
platform: numeric_state
entity_id: switch.waschmaschine
value_template: "{%if states.switch.waschmaschine.attributes.current_power_w is defined %}{{state.attributes.current_power_w}}{%else%}0{%endif%}"
above: 1
below: 2
for: '00:01:00'
action:
- service: input_select.select_option
data:
entity_id: input_select.state_washingmachine
option: 'Idle'
- alias: 'Washing Machine - Change State Washing'
trigger:
platform: numeric_state
entity_id: switch.waschmaschine
value_template: "{%if states.switch.waschmaschine.attributes.current_power_w is defined %}{{state.attributes.current_power_w}}{%else%}0{%endif%}"
above: 20
for: '00:01:00'
action:
- service: input_select.select_option
data:
entity_id: input_select.state_washingmachine
option: 'Washing'
Requirements
To use the following Automations you should have
Routine in Alexa App
To ask Alexa i set up a Routine with Alexa App that switch a Template Switch. I created an Input Boolean
input_boolean.switch_laundry_finished
A Routine in Alexa App can’t trigger an Input Boolean so an additional Template Switch is necessary in configuration.yaml
switch:
- platform: template
switches:
switch_laundry_finished_template:
value_template: '{{states.input_boolean.switch_laundry_finished.state}}'
turn_on:
service: input_boolean.turn_on
entity_id: input_boolean.switch_laundry_finished
turn_off:
service: input_boolean.turn_off
entity_id: input_boolean.switch_laundry_finished
Finally the Automation
The first one has a condition looking for the state ‘Washing’ and fires the actionable notification.
To make Alexa answer from that device you are talking to i use templating and the last_called state from alexa media player for each echo device so here you always have to change the entities based on your devices.
The second action turn off the template switch, so that the next turn on signal from Alexa App Routine will trigger the automation again.
- alias: 'is laundry finished ask what kind'
trigger:
platform: state
entity_id: switch.switch_laundry_finished_template
from: 'off'
to: 'on'
condition:
condition: state
entity_id: input_select.state_washingmachine
state: 'Washing'
action:
- service: script.activate_alexa_actionable_notification
data_template:
text: "I am not sure, wich kind of laundry is in?"
event_id: 'alexa_action_is_laundry_finished'
alexa_device: '{% if states.media_player.wohnzimmer.attributes.last_called == true %}media_player.wohnzimmer{% elif states.media_player.schlafzimmer.attributes.last_called == true %}media_player.schlafzimmer{% elif states.media_player.bad.attributes.last_called == true %}media_player.bad{% elif states.media_player.arbeitszimmer.attributes.last_called == true %}media_player.arbeitszimmer{% endif %}'
- service: switch.turn_off
entity_id:
- switch.switch_laundry_finished_template
If the Machine is ‘Turned Off’ this automation fires
- alias: 'is laundry finished no laundry in'
trigger:
platform: state
entity_id: switch.switch_laundry_finished_template
from: 'off'
to: 'on'
condition:
condition: state
entity_id: input_select.state_washingmachine
state: 'Switched Off'
action:
- delay:
seconds: 1
- service: notify.alexa_media
data_template:
target: >
{% if states.media_player.wohnzimmer.attributes.last_called == true %}
media_player.wohnzimmer
{% elif states.media_player.schlafzimmer.attributes.last_called == true %}
media_player.schlafzimmer
{% elif states.media_player.bad.attributes.last_called == true %}
media_player.bad
{% elif states.media_player.arbeitszimmer.attributes.last_called == true %}
media_player.arbeitszimmer
{% endif %}
data:
type: tts
message: "I am sorry, but there is no laundry in. Did you forget something?"
- service: switch.turn_off
entity_id:
- switch.switch_laundry_finished_template
And this will fire when the state is Idle and assume your laundry is finished and Alexa will tell you since when
- alias: 'is laundry finished laundry already finished'
trigger:
platform: state
entity_id: switch.switch_laundry_finished_template
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: template
value_template: "{{ as_timestamp(now()) > as_timestamp(states.automation.washing_machine_change_state_idle.attributes.last_triggered) }}"
- condition: state
entity_id: input_select.state_washingmachine
state: 'Idle'
action:
- delay:
seconds: 1
- service: notify.alexa_media
data_template:
target: >
{% if states.media_player.wohnzimmer.attributes.last_called == true %}
media_player.wohnzimmer
{% elif states.media_player.schlafzimmer.attributes.last_called == true %}
media_player.schlafzimmer
{% elif states.media_player.bad.attributes.last_called == true %}
media_player.bad
{% elif states.media_player.arbeitszimmer.attributes.last_called == true %}
media_player.arbeitszimmer
{% endif %}
data:
type: tts
message: "Laundry is finished since {{ ( (as_timestamp(now()) - as_timestamp(states.automation.washing_machine_change_state_idle.attributes.last_triggered)) / 60 ) | round(0) }} minutes"
- service: switch.turn_off
entity_id:
- switch.switch_laundry_finished_template
For each kind of laundry and Slots created https://github.com/keatontaylor/alexa-actions/wiki/AdvancedFeatures#adding-a-new-slot-type i have the following automation.
You should change the first number in the last code line, this represents the minutes these kind of laundry needs or rather how long the Washing Machine program needs to be finished.
- alias: 'Easy Care was triggered'
trigger:
platform: event
event_type: alexa_actionable_notification
event_data:
event_id: alexa_action_is_laundry_finished
condition:
condition: template
value_template: "{{ trigger.event.data.event_response == 'Easy Care' }}"
action:
- service: notify.alexa_media
data_template:
target: >
{% if states.media_player.wohnzimmer.attributes.last_called == true %}
media_player.wohnzimmer
{% elif states.media_player.schlafzimmer.attributes.last_called == true %}
media_player.schlafzimmer
{% elif states.media_player.bad.attributes.last_called == true %}
media_player.bad
{% elif states.media_player.arbeitszimmer.attributes.last_called == true %}
media_player.arbeitszimmer
{% endif %}
data:
type: tts
message: "Laundry will be finished in {{ 42 - (((as_timestamp(now()) - as_timestamp(states.automation.washing_machine_change_state_wash.attributes.last_triggered)) / 60 ) | round(0)) }} minutes"
Last Word
You should also change the text phrases Alexa speaks because i translated this with my first grade school english