Hi there, I’m trying to automate aspects of my washing machine in my shared house. I have a TP-Link HS110 socket on the washing machine so I can monitor power consumption and a Flic2 button on the machine for us to select whose washing it is going in.
What I want to happen is the person selected receives a message when their washing is done.
Do you think that this would be best utilised with a mixture of automations and scripts or just an automation?
excuse me being a Noob Timo but I’m trying to wrap my head around the first automation…
I can see a way of doing this with 3 automations (one for each user) based on the Flic button press however I can’t see how to do if/or type choices within the automations.
Here’s the code I have for the two automations (atm just trying to get it to ping me when washing is done). The first automation runs fine and the second one does message me when I click “run action” however it doesn’t seem to want to trigger the second automation for some reason. Any chance you can help me fix it please?
Automation 1:
alias: Ed washing on
description: ''
trigger:
platform: event
event_type: flic_click
event_data:
button_name: flic_80e4da786aa8
click_type: single
condition: []
action:
- service: automation.turn_on
target:
entity_id: automation.notify_when_the_washing_machine_cycle_is_complete```
Automation 2:
```- id: 55f349bf8c744924ad5391087c7307e7
alias: notify when the washing machine cycle is complete
trigger:
- platform: numeric_state
entity_id: sensor.washingmachine_watts
above: '2'
below: '2'
action:
- service: notify.mobile_app_nokia_3_2
data:
title: The washing machine has finished.
message: It's ready to be emptied```
```sensor:
washingmachine_watts:
friendly_name_template: "{{ states.switch.washingmachine.name}} Washing Machine Current <1.5 watts"
value_template: '{{ states.switch.washingmachine.attributes["Current consumption"] | replace(" W", "") | float <1.5 }}'```
I think 2 is too low. Also, it is better to add for: to anticipate mini power consumption spikes.
Edit: smart meters supposedly does not measure itself. I don’t know why because sometimes I get 1W readings without anything plugged. (Thanks Septillon, probably need to calibrate mine).
It would be a pretty dumb meter if it would measure that.
But having said that, <2W might be to low depending on the washing machine and the accuracy of the meter.
And what sensor do you use? Most make a separate entity for consumption. The sensor you made does not report Watt but simply true or false depending on it it’s below 1,5W.
Create an input_text to store the phone name of the person who is using the washing machine.
input_text.notify_wash
Create an automation that is triggered by the Flic2 button (similar to the automation you already have) and sets the input_text to the phone name of the person corresponding to the button action. I don’t know how many buttons that gadget has but the example below handles three (easily expanded to whatever quantity you need).
The automation you are using to monitor the end of the washing cycle can notify the correct person by simply using the value in the input_text.
action:
- service: "notify.{{ states('input_text.notify_wash') }}"
data:
title: "The washing machine has finished."
message: "It's ready to be emptied."
You could do all in one automation. But you will need some kind of memory to store the machine started. You could keep one automation running all the time until it finishes but that would break if you restart HA in the mean time (or even reload the automations). That also would not make it easy to store who to notify.
So like @123 I would use a helper. But because it’s a finite set of options I would use a input_select rather than a input_text. But the idea is pretty much the same.
I also would have used a chooser rather than a template because I like the UI. But that is pure preference.
FWIW, that was my initial choice until I realized there was no requirement to manually (and conveniently) change the wash person via the UI (which an input_select would provide).
Even if there was such a requirement, I would imagine it would be to display the person’s name and not the cryptic name of their phone for notification purposes. As a result there would be two conversions required, the first from the button_name to the corresponding wash person’s name for display in the input_select and the second from the input_select’s value to the corresponding phone identifier for notification.
True, but you do that now as well So there is no real change accept moving the second convention to the second automation.
And yeah, there is indeed no real need, input_text will work fine. But I think having a input_select would make debugging a little bit easier (when you do want to set it manually). But yeah, with a input_text it is possible to do it in a single conversion at the cost of losing a display name (that displays the name rather then the phone id.
I think you may have misunderstood what I meant by conversion. There’s no second conversion because the template uses the input_text’s value verbatim:
"notify.{{ states('input_text.notify_wash') }}"
If there was a second conversion, it would be converting from the person’s name (i.e. the input_select’s value) to the person’s notification entity (using an if-else chain or a dictionary lookup). That second conversion wouldn’t be needed if the input_select contained the notification entities instead of the person’s name (then it could be used verbatim). However, that makes the input_select less friendly for use in the UI which defeats the purpose of using an input_select in the first place.
I used trigger.id simply to avoid the long-winded use of trigger.event.event_data.blabla. I don’t see how using one or the other constitutes a “conversion” because it’s simply data provided directly by the trigger object. That loose definition of “conversion” implies all triggers perform a “conversion” from one thing to another (which effectively makes it moot as a “conversion”).