Created
September 6, 2021 19:39
-
-
Save zubir2k/eaa6467ecfa9e3f8bdc97ae2fcec6174 to your computer and use it in GitHub Desktop.
Washing Completion Notification based on value from Power Monitoring Plug.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Washing Machine Notification | |
############################### | |
## Description: | |
## 1. Based on power monitoring plug (measuring in Watt & Amp) | |
## 2. State is determined by power monitoring value (further analysis is required; recommended 3 cycle washing) | |
## 3. Adjust the Watt & Amp value in the template sensor according to your analysis result | |
## 4. Notification is triggered based on final value (when washing is completed state) | |
## 5. Weather forecast is using OpenWeatherMap integration. Can also use others. | |
## configuration.yaml ## | |
######################## | |
notify: | |
- platform: file | |
filename: /config/reports/washing_machine.csv # use this file to study your machine behavior. | |
name: Washing Machine CSV | |
timestamp: false | |
sensor: | |
- platform: template | |
sensors: | |
washing_machine_state: | |
friendly_name: "Washing Machine State" | |
icon_template: mdi:washing-machine | |
value_template: >- | |
{% if states('sensor.washing_machine_power') | float >= 1 and states('sensor.washing_machine_current') | float >= 0.01 %} | |
Washing | |
{% elif states('sensor.washing_machine_power') | float >= 49 <= 51 and states('sensor.washing_machine_current') | float >= 0.25 <= 0.27 %} | |
Washing Completed | |
{% elif states('sensor.washing_machine_power') | float == 0 and states('sensor.washing_machine_current') | float == 0 %} | |
Idle | |
{%- else %} | |
Unavailable | |
{%- endif %} | |
## automation.yaml ## | |
##################### | |
# Machine condition may varies. My situation here upon washing completion, it didnt give a consistent value, | |
# So I had to rely on Idle state (all value become zero) for 2 mins duration and assume that washing is done. | |
# Adjust the trigger according to your analysis results. | |
alias: Washing Machine Alert | |
description: '' | |
trigger: | |
- platform: state | |
entity_id: sensor.washing_machine_state | |
to: Idle | |
for: '00:02:00' | |
condition: [] | |
action: | |
- service: tts.google_say | |
data: | |
message: >- | |
Washing is completed. You may dry your washing now. Today weather | |
forecast is {{ states.sensor.openweathermap_forecast_condition.state }}. | |
language: en | |
entity_id: media_player.all_devices | |
- service: notify.telegram | |
data: | |
title: 🥼 *Washing is Completed* | |
message: >- | |
Today Weather Forecast: {{ | |
states.sensor.openweathermap_forecast_condition.state }}{{ '\n' }} | |
Temperature: {{ states.sensor.openweathermap_forecast_temperature.state | |
}} °C{{ '\n' }} Humidity: {{ states.sensor.openweathermap_humidity.state | |
}}% | |
- service: notify.washing_machine_csv | |
data: | |
message: >- | |
Washing Machine|{{ now().strftime("%Y-%m-%d|%H:%M:%S") }}|Wash | |
Completed Triggered|{{ states.sensor.washing_machine_power.state | float(2) }}|{{ | |
states.sensor.washing_machine_current.state | float(2) }}|{{ | |
states.sensor.washing_machine_voltage.state | float(2) }} | |
mode: single | |
## This automation stores washing machine watt value into csv for analysis. | |
alias: Washing Machine Analysis | |
description: '' | |
trigger: | |
- platform: state | |
entity_id: sensor.washing_machine_power | |
condition: [] | |
action: | |
- service: notify.washing_machine_csv | |
data: | |
message: >- | |
Washing Machine|{{ now().strftime("%Y-%m-%d|%H:%M:%S") }}|{{ | |
states.sensor.washing_machine_state.state }}|{{ | |
states.sensor.washing_machine_power.state | float(2) }}|{{ | |
states.sensor.washing_machine_current.state | float(2) }}|{{ | |
states.sensor.washing_machine_voltage.state | float(2) }} | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment