I love the idea of everything in my home being able to communicate with each other. Thanks to Home Assistant I already have a lot of things talking to each other.
This is going to solve a massive first world problem. Or maybe it won’t. I’ll let you decide. The latest trend is for every device in your home to be connected to the internet. ‘The internet of things’. I can’t (or don’t want to) replace the dishwasher in my apartment (I’m a renter). I need to use other tools that will allow me to monitor the state of my dishwasher, and then use that information to tell me when the dishes are clean, so I don’t forget to empty it.
I don’t want to fork out thousands of dollars for a washing machine that can connect to a smart phone app, that will most likely be abandoned at some point in the future. Looking at you, Samsung.
Ingredients
I’ll be using the following hardware and software for this. Feel free to replace it with whatever works best for you. You may not have Z-wave, so any power monitor and contact sensor should work, as long as the end results match up.
- Home Automation Software – I’ll be using Home Assistant, but other Home Automation software can be used as well, just check your poison of choice documentation.
- Z-wave Power Monitor / Switch – I’ll be using the Aeotec Smart Switch
- Z-wave Door/Window Sensor – I’ll be using a Fibaro FGK101
Monitoring The State
The first step is to decide how you’ll be monitoring the state of the machine. I like to use z-wave power switches, as you can easily tell when a machine is in use by how much power it is drawing. If no power is being used by the washing machine or dishwasher, then they’re off and not in use. The good thing using the Aeotec Smart Switch is it comes built-in with power level monitoring, and can easily be connected to a Z-wave Flood Sensor, so that if a flood is detected power is immediately cut.
I want to be alerted when either my washing machine or dishwasher have completed their cycle, but only if they haven’t already been emptied. There’s no point in sending myself or my fiancé an alert when we have already taken out the washing or put away the dishes.
DISHWASHER
First up the dishwasher. Once running, the dishwasher will draw power. Once finished, it will remain in a “standby” state until you open the dishwasher and turn it off. This means I can purely use the power level to determine if the dishwasher has been emptied or not. Once the dishwasher is finished, as long as someone opens the dishwasher and turns off the power, I’ll be able to see the power drop to zero, and mark the dishwasher as dirty again.
WASHING MACHINE
Unfortunately my washing machine is a bit smarter. Once the washing machine has finished, it will “beep” to let anyone within earshot know that the cycle is complete. After a couple of minutes, it will then turn itself off so it doesn’t waste standby power. This throws a slight spanner into the works, as I now won’t be able to tell if the washing machine is full and ready to have clothes taken out of it.
For the washing machine, I’ll use a combination of the power monitor and a Fibaro Door/Window Sensor. Once the washing machine has stopped running, I won’t reset the washing machine until the door has been opened, as detected by the door sensor.
Obligatory Caution
Before using a smart switch or plugin energy monitor on a high energy device (such as a washing machine/dryer/dishwasher), always check how much power your machine will draw from your smart switch/energy monitor.
See my notes at the end of this post for more details.
Defining the Stages
It can be a bit tricky using power levels alone to detect where in the cycle your machine is up-to. During the spin cycle, the power level may drop for several minutes and then pickup again. You don’t want to be alerted each time this happens.
To solve this, I’ll be using Home Assistant’s input_select component. This will allow me to define several states that the machines could be in. First, let’s define them.
DISHWASHER
Dirty | The default state of the dishwasher. Dishes will be packed into the dishwasher until it is full and turned on. |
---|---|
Running | The dishwasher is turned on and cleaning the dishes. |
Drying | The power level has dropped, and the dishwasher can now be considered to be “drying” the dishes. |
Clean | The power level has dropped for a few consistent minutes, and is now drawing “standby” power. Once power returns to 0, we’ll return back to the “Dirty” state. |
WASHING MACHINE
Idle | The default state of the washing machine. The washing machine is off and clothes have been unpacked. |
---|---|
Running | The washing machine is turned on and cleaning the clothes. |
Finishing | The power level has dropped, and the washing machine will be finishing soon. |
Clean | The power level has dropped for a few consistent minutes. Once the door opens, we’ll return back to the “Idle” state. |
The Latest In Your Inbox
Enter your email address below to receive my latest blog posts and videos about Home Automation in your Inbox
Transitioning Between Stages
Because power levels can go up and down, we need to make sure our system transitions between each stage correctly. That’s where the power of using a dropdown comes in. Let’s define some rules for how our machines may change states.
Why is this important? We don’t want to get spammed when the power goes up and down. Using the flow above, we can use delays to ensure that the machine is in the right state. Let’s say the Washing Machine is ‘Running’, and the power level drops. Once the power level drops, we’ll move it into the ‘Finishing’ stage. Once in the ‘Finishing’ stage, we’ll wait a certain amount of time before moving into the ‘Clean’ state and sending our notifications. However, if the power level increases again (such as the spin cycle starting again), then we’ll go back to the ‘Running’ stage, so the process can repeat.
The same logic applies for the dishwasher.
So how can we achieve this in Home Assistant? First we need to setup our input_select dropdowns.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
input_select: dishwasher_status: name: Dishwasher Status options: - Dirty - Running - Drying - Clean initial: Dirty washing_machine_status: name: Washing Machine Status options: - Idle - Running - Finishing - Clean initial: Idle |
This will create two dropdown elements in Home Assistant that look like these:
Adding the Logic
Now that we have each phase of the machine cycles setup in Home Assistant, it’s time to automate the transitions between each stage. As I’m using a z-wave smart switch, we can use their power levels for this. Home Assistant makes these available to us as additional sensors. We’re looking for the power sensors.
Once you’ve found the entity that is tracking power consumption, lets add some automations to Home Assistant to move through the stages according to the diagram above.
First, the dishwasher is the easiest, as we will only be looking at the power levels.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# When we detect power being drawn from the dishwasher, # mark the dishwasher as using power - alias: Set dishwasher active when power detected trigger: - platform: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_16_8 above: 10 condition: condition: or conditions: - condition: state entity_id: input_select.dishwasher_status state: Dirty - condition: state entity_id: input_select.dishwasher_status state: Clean - condition: state entity_id: input_select.dishwasher_status state: Drying action: - service: input_select.select_option data: entity_id: input_select.dishwasher_status option: Running # When the power level drops below 10, and the Dishwasher is set to # the 'Running' state, mark the Dishwasher as Finished - alias: Set dishwasher drying when power drops trigger: - platform: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_16_8 below: 10 condition: condition: and conditions: - condition: state entity_id: input_select.dishwasher_status state: Running action: - service: input_select.select_option data: entity_id: input_select.dishwasher_status option: Drying # Once the dishwasher status has been 'Drying' for 30 minutes, mark the # dishwasher as clean - alias: Set dishwasher clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Drying for: minutes: 15 condition: condition: and conditions: - condition: state entity_id: input_select.dishwasher_status state: Drying action: - service: input_select.select_option data: entity_id: input_select.dishwasher_status option: Clean # When the power drops and the dishwasher is Clean or Drying, someone has # turned the Dishwasher off and emptied it. We should do this when the state # of the Dishwasher is clean or Finishing, just incase someone opens the # Dishwasher before the 30 minute timeout has been reached. - alias: Set Dishwasher dirty when power off trigger: - platform: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_16_8 below: 1 condition: condition: and conditions: - condition: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_16_8 below: 1 - condition: or conditions: - condition: state entity_id: input_select.dishwasher_status state: Clean - condition: state entity_id: input_select.dishwasher_status state: Drying action: - service: input_select.select_option data: entity_id: input_select.dishwasher_status option: Dirty |
These automations will change the input_select component to the value according to where the dishwasher is up to. Once someone turns the dishwasher off, the power will drop below 1 (aka zero) and the dishwasher will be marked as clean.
The washing machine uses some similar logic. Which you can see below. However, we’ll wait for the door to open before we change the status, as it will turn itself off after a timeout.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# When power is detected, and the washing machine is not in # the Running state, change the status of the washing machine # to Running. # The status check will ensure we don't try to put the state # to Running each time the power level changes, and we're already # in the Running state. - alias: Set washing machine active when power detected trigger: - platform: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_25_4 above: 10 condition: condition: or conditions: - condition: state entity_id: sensor.washing_machine_status state: Idle - condition: state entity_id: sensor.washing_machine_status state: Clean - condition: state entity_id: sensor.washing_machine_status state: Finishing action: - service: input_select.select_option data: entity_id: input_select.washing_machine_status option: Running # When the power drops, move the state of the washing machine to # Finishing. - alias: Set washing machine finished when power drops trigger: - platform: numeric_state entity_id: sensor.aeotec_smart_energy_switch_power_25_4 below: 6 condition: condition: and conditions: - condition: state entity_id: input_select.washing_machine_status state: Running action: - service: input_select.select_option data: entity_id: input_select.washing_machine_status option: Finishing # Wait 8 minutes for us to be in the Finishing state before we # decide the washing machine has finished. This way, if the # washing machine is in between cycles and the power drops, we # won't mark the washing machine cycle as finished too early. - alias: Set washing machine clean after timeout trigger: - platform: state entity_id: input_select.washing_machine_status to: Finishing for: minutes: 8 condition: condition: and conditions: - condition: state entity_id: input_select.washing_machine_status state: Finishing action: - service: input_select.select_option data: entity_id: input_select.washing_machine_status option: Clean # When we open the washing machine door, reset the status back to # idle, so we don't spam people that the washing machine has # finished, and someone has already emptied it - alias: Set washing machine dirty when door opens trigger: # I've setup a template sensor to change make the binary_sensor report open and closed # instead of 1 and 0 - platform: state entity_id: input_select.washingmachine_door_status to: 'Open' condition: condition: and conditions: - condition: state entity_id: input_select.washing_machine_status state: Clean action: - service: input_select.select_option data: entity_id: input_select.washing_machine_status option: Idle |
Sending The Alerts
So now the fun part, we have Home Assistant reporting each stage of the washing machine/dishwasher cycle. It’s time to add some alerts around these. A simple alert when the dishwasher is clean looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
- alias: Send alert when dishwasher is clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Clean condition: condition: and conditions: - condition: state entity_id: input_select.dishwasher_status state: Clean action: - service: notify.phil data: message: 'The Dishwasher has finished and is ready to be emptied!' title: 'Dishwasher Update' |
That will send an alert to my phone via Pushbullet when the dishwasher has finished. However, that’s not always ideal.
- If I turn on the dishwasher then go out, I will receive an alert on my phone when I am out, and forget about the dishes.
- If I turn on the dishwasher at night before bed, I’ll get an alert when I’m asleep.
- This will only send an alert to me. What if I am out, but my fiancé is home, it would be better to send her the alert so she can empty the dishwasher.
Making The Alert Smarter
So let’s see if we can make this notification more smart. Home Assistant will know who’s home and what time it is, so let’s update the automation to include the following rules:
- Don’t send an alert if it is after 10:30pm, or before 8:30am.
- Don’t send an alert unless someone is home. No point alerting us if no one is home to unpack the dishwasher.
- If the dishwasher is clean, and the time ticks past 8:30am, and people are home, alert them the dishwasher is ready.
- Only send an alert to the people who are home. Don’t bother anyone who isn’t at home.
- If the dishwasher is clean, and someone arrives home, send everyone who is home an alert, but only if the alert wasn’t sent in the last thirty minutes.
Let’s go ahead and make some adjustments to that notification above. First let’s apply rule 1 and 2.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
- alias: Send alert when dishwasher is clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Clean condition: condition: and conditions: - condition: time before: '22:30:00' after: '08:29:00' - condition: state entity_id: group.people state: 'home' - condition: state entity_id: input_select.dishwasher_status state: Clean action: - service: notify.phil data: message: 'The Dishwasher has finished and is ready to be emptied!' title: 'Dishwasher Update' |
We can easily add a time trigger now so that I get an alert at 8:30am if the dishwasher is clean.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
- alias: Send alert when dishwasher is clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Clean - platform: time after: '08:30:00' condition: condition: and conditions: - condition: time before: '22:30:00' after: '08:29:00' - condition: state entity_id: group.people state: 'home' - condition: state entity_id: input_select.dishwasher_status state: Clean action: - service: notify.phil data: message: 'The Dishwasher has finished and is ready to be emptied!' title: 'Dishwasher Update' |
Now the fun part, rule 4. In Home Assistant, we can use a Notify Group to dictate who will get the alert. I’ll setup three groups. One which will send an alert just to me, one which will send an alert just to my fiancé, and finally one which will send both of us an alert. Let’s go ahead, and change the action part of our alert now.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
- alias: Send alert when dishwasher is clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Clean - platform: time after: '08:30:00' condition: condition: and conditions: - condition: time before: '22:30:00' after: '08:29:00' - condition: state entity_id: group.people state: 'home' - condition: state entity_id: input_select.dishwasher_status state: Clean action: - service_template: > {% if (is_state('device_tracker.phil', 'home')) and (is_state('device_tracker.helen', 'home')) %} notify.phil_and_helen {% elif is_state('device_tracker.phil', 'home') %} notify.phil {% elif is_state('device_tracker.helen', 'home') %} notify.helen {% endif %} data: message: 'The Dishwasher has finished and is ready to be emptied!' title: 'Dishwasher Update' |
Finally rule 5. We’ll use another for delay, of 10 minutes. This makes sure we’ve been home for a few minutes to put things down before we’re reminded to empty the dishwasher. It also gives the other person time to come inside from collecting the mail, or chatting up a storm with the neighbours, before the alert is sent.
We’ll use a template condition, to make sure that the alert isn’t sent multiple times. This is important. If my device is marked as home first then two minutes later my fiancé is marked as home, in ten minutes and twelve minutes the alert will be sent to both of us! Which might get annoying, very quickly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
- alias: Send alert when dishwasher is clean trigger: - platform: state entity_id: input_select.dishwasher_status to: Clean - platform: time after: '08:30:00' - platform: state entity_id: sensor.helen_status to: 'Home' for: minutes: 10 - platform: state entity_id: sensor.phil_status to: 'Home' for: minutes: 10 condition: condition: and conditions: - condition: time before: '22:30:00' after: '08:29:00' - condition: state entity_id: group.people state: 'home' - condition: state entity_id: input_select.dishwasher_status state: Clean # Don't send this alert if it was last triggered less than 30 minutes ago (1,800 seconds) - condition: template value_template: > {% if states.automation.send_alert_when_dishwasher_is_clean.last_triggered is not none %} {% if as_timestamp(now()) | int - as_timestamp(states.automation.send_alert_when_dishwasher_is_clean.attributes.last_triggered) | int > 3600 %} true {% else %} false {% endif %} {% else %} false {% endif %} action: - service_template: > {% if (is_state('device_tracker.phil', 'home')) and (is_state('device_tracker.helen', 'home')) %} notify.phil_and_helen {% elif is_state('device_tracker.phil', 'home') %} notify.phil {% elif is_state('device_tracker.helen', 'home') %} notify.helen {% endif %} data: message: 'The Dishwasher has finished and is ready to be emptied!' title: 'Dishwasher Update' |
The same logic can then be applied to our washing machine alert.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
- alias: Send alert when washing machine is finished trigger: - platform: state entity_id: sensor.washing_machine_status to: Clean for: minutes: 1 - platform: state entity_id: device_tracker.helen to: 'home' for: minutes: 2 - platform: state entity_id: device_tracker.phil to: 'home' for: minutes: 2 - platform: time after: '08:45:00' condition: condition: and conditions: - condition: time before: '22:30:00' after: '08:30:00' - condition: state entity_id: group.people state: 'home' - condition: state entity_id: input_select.washing_machine_status state: Clean - condition: template value_template: > {% if states.automation.send_alert_when_washing_machine_is_finished.last_triggered is not none %} {% if as_timestamp(now()) | int - as_timestamp(states.automation.send_alert_when_washing_machine_is_finished.attributes.last_triggered) | int > 1800 %} true {% else %} false {% endif %} {% else %} false {% endif %} action: - service_template: > {% if (is_state('device_tracker.phil', 'home')) and (is_state('device_tracker.helen', 'home')) %} notify.phil_and_helen {% elif is_state('device_tracker.phil', 'home') %} notify.phil {% elif is_state('device_tracker.helen', 'home') %} notify.helen {% endif %} data: message: 'Hey, the washing machine has finished and is ready to be emptied' title: 'Washing Machine' |
Home Assistant Nuances
If you’re using Home Assistant, there’s a few things you can do to make things look more user-friendly on the front-end, and a couple of things to watch out for.
Z-WAVE POLLING
In order for your z-wave power modules to report updated power levels, you may need to adjust your polling settings. I have mine set as following.
1 2 3 4 5 6 7 8 |
zwave: device_config: sensor.aeotec_smart_energy_switch_power_25_4: polling_intensity: 1 sensor.aeotec_smart_energy_switch_power_16_8: polling_intensity: 1 |
REPORTING OPEN CLOSED STATUS
I’m using a Template Sensor to make the door status easier to use. If you prefer to use the same, here’s how I do it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
sensor: - platform: template sensors: washingmachine_door_status: value_template: '{% if states.binary_sensor.fibaro_system_fgk10x_door_opening_sensor_sensor_27_0 %} {% if states.binary_sensor.fibaro_system_fgk10x_door_opening_sensor_sensor_27_0.state == "on" %} Open {% else %} Closed {% endif %} {% else %} n/a {% endif %}' friendly_name: 'Washing Machine Door' |
1 2 3 4 |
sensor.washingmachine_door_status: icon: mdi:glassdoor |
HOW IT LOOKS
The dropdown menu for the status can get a bit clunky, so I’m also using two more Template Sensors to display a read-only view of the status on the Home Assistant webpage.
1 2 3 4 5 6 7 8 9 10 11 |
sensor: - platform: template sensors: washing_machine_status: value_template: '{{ states.input_select.washing_machine_status.state}}' friendly_name: 'Washing Machine Status' dishwasher_status: value_template: '{{ states.input_select.dishwasher_status.state}}' friendly_name: 'Dishwasher Status' |
1 2 3 4 5 6 |
sensor.washing_machine_status: icon: mdi:washing-machine sensor.dishwasher_status: icon: mdi:washing-machine |
Using groups, Here’s how Home Assistant renders these cards.
Smart Switches and Power Usage
Devices with spinning parts (ie dishwashers and washing machines) may draw a high amount of power. Luckily for me, I have modern appliances which don’t draw too much power.
Before you plug your washing machine or dishwasher into a smart switch, always check the maximum power draw supported by your smart switch.
In my case, I am using an Aeotec Smart Switch 6 for my washing machine. According to the specs, the Australian version can handle up-to 10 amps of power usage (the US version can handle 15 amps at 120 volts). Looking at my washing machine manual, the maximum power is used when “washing and heating”, which is rated at 2,000 watts. Using a simple online calculator, the maximum amps drawn from my washing machine is 8.69 amps, which is just under the 10 amps supported by the smart switch.
My washing machine is a newer model, with an energy star rating. If your washing machine is older, it may draw more power than a smart switch can handle. You may risk burning out the smart switch, or under-powering your machine and causing damage.
Wrapping Up
Using some smart switches, and door/window sensors we’ve now integrated two commonly used household appliances into our smart home. I haven’t had to fork out thousands for the latest appliances with a smart phone app, and even better my home automation controller, Home Assistant is responsible for watching everything.
Using the information already known by Home Assistant, notifications are sent only when required and in a way that don’t spam our phones every-time something happens.
There’s a heap more applications you can use for smart switches, or door/window sensors. What cool automations have you created with these? I’d love to hear them.
Pingback: Making ‘dumb’ Dishwashers and Washing Machines Smart: Alerts When the Dishes and Clothes Are Cleaned | Ackbarr's Tech Journal()
Pingback: Wi-Fi Smart Plug with Energy Monitoring for Home Assistant()