Home Assistant and Alexa TTS when laundry is ready

I have just started to use Node Red and has finally got text to speech working with Alexa. It is awsome. I just wantet to share an example. When done you will have Alexa notify you when the laundry is ready. I have used the following hardware:

  • RPI with Aeotec Z Wave Stick
  • Amazon Echo connected to an US account
  • Fibaro Z Wave switch

And software:

  • Home Assistant
  • Alexa TTS component (3rd party)
  • Node Red (installed within HA)

Start by installing the Alexa TTS. Visit here to read the full instructions. https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639

In short you will just have to download this file. Put it in config directory under a folder named custom_components/media_player.

Add this to your configuration.yaml

media_player:
  - platform: alexa
    email: “your amazon email”
    password: “your amazon password”
    url: “amazon.com”

I have found this to be the hard part. Some use ” and some use US accounts. Sometimes I have had to restart it. If everything works you should see it in HA on the startpage. Also make sure Alexa is online and has played something in the last 15 minutes.

You will also have to create a value_template. You can read more about this here. https://www.home-assistant.io/components/sensor.template/ The purpose of this is to be able to get the power consumtion attribute and be able to tell if the switch has been dropping power and the machine is done.

 

Add this to sensors.yaml (in my case)

      washer_w:
        friendly_name: 'Washer power [W]'
        value_template: '{{ states.switch.fibaro1_switch.attributes["power_consumption"] }}'
        unit_of_measurement: 'W'

      washer_w_lav:
        friendly_name: 'Washer power < 1.8 w'
        value_template: '{{ states.sensor.washer_w.state | float < 1.8 }}'

 

I suppose you have Node Red up and running. I have added a flow like this.

  • Washer status has Entity ID sensor.washer_w_lav
  • Switch is True or False
  • Was just false? is like below:
if(msg.data !== null && msg.data.old_state !== null) {
if(msg.data.old_state.state === "False") {
return msg
}
}
return null;
  • Reset is set to True
  • Wait 2 mins is just a wait.
  • TTS Ready has domain media_player, service alexa_tts and data {“entity_id”: “media_player.my_echo_plus”, “message”: “The laundry is ready!”}

Done. You will now be notified when laudry is done!

My github and config: https://github.com/planet4/HomeAssistant