Blueprint config:
id: '1733402345842'
alias: Vaatwas info
description: ''
use_blueprint:
path: jgillula/advanced_appliance_power_monitor.yaml
input:
power_entity: sensor.vaatwas_lsc_power
start_threshold: 5
finish_threshold_delay:
hours: 0
minutes: 2
seconds: 0
on_start:
- action: input_select.select_option
metadata: {}
data:
option: Running
target:
entity_id: input_select.vaatwas_status
- action: notify.mobile_app_telefoon_ward
metadata: {}
data:
message: Vaatwas is bezig
on_stop:
- action: input_select.select_option
metadata: {}
data:
option: Complete
- action: notify.mobile_app_telefoon_ward
metadata: {}
data:
message: Vaatwas is klaar
- action: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.vaatwas_teller
start_threshold_delay:
hours: 0
minutes: 1
seconds: 0
energy_entity: sensor.vaatwas_verbruik_kwh_helper
finish_threshold: 0
Automation config:
mode: single
triggers:
- platform: numeric_state
entity_id: sensor.vaatwas_lsc_power
for:
hours: 0
minutes: 1
seconds: 0
above: 5
actions:
- variables:
start_threshold: 5
finish_threshold: 0
start_threshold_delay:
hours: 0
minutes: 1
seconds: 0
running_threshold_delay:
hours: 0
minutes: 0
seconds: 0
finish_threshold_delay:
hours: 0
minutes: 2
seconds: 0
start_time: >-
{{ as_timestamp(now()) - start_threshold_delay.hours * 3600 -
start_threshold_delay.minutes * 60 - start_threshold_delay.seconds }}
energy_entity: sensor.vaatwas_verbruik_kwh_helper
initial_energy: |
{% if energy_entity is not none %}
{{ states(energy_entity) | float }}
{% else %}
0
{% endif %}
- variables:
elapsed_time: >
{% set elapsed_timedelta = now() - as_datetime(start_time) %} {{
elapsed_timedelta.days * 86400 + elapsed_timedelta.seconds }}
elapsed_days: '{{ (elapsed_time | int) // 86400 }}'
elapsed_hours: '{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400)) // 3600 }}'
elapsed_minutes: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600)) // 60 }}
elapsed_seconds: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600) - ((elapsed_minutes|int) * 60)) }}
event_type: start
energy_used: |
{% if energy_entity is not none %}
{{ (states(energy_entity) | float) - initial_energy }}
{% else %}
0
{% endif %}
running_threshold_total_delay: >-
{{ running_threshold_delay.hours * 3600 +
running_threshold_delay.minutes * 60 + running_threshold_delay.seconds
}}
finish_threshold_total_delay: >-
{{ finish_threshold_delay.hours * 3600 + finish_threshold_delay.minutes
* 60 + finish_threshold_delay.seconds }}
- variables:
running_threshold_total_delay: >-
{{ (finish_threshold_total_delay + 1) if (running_threshold_total_delay
< finish_threshold_total_delay) else running_threshold_total_delay }}
running_threshold_delay_hours: '{{ running_threshold_total_delay // 3600 }}'
running_threshold_delay_minutes: >-
{{ (running_threshold_total_delay - running_threshold_delay_hours *
3600) // 60 }}
running_threshold_delay_seconds: >-
{{ (running_threshold_total_delay - running_threshold_delay_hours * 3600
- running_threshold_delay_minutes * 60) }}
running_threshold_delay:
hours: '{{ running_threshold_delay_hours }}'
minutes: '{{ running_threshold_delay_minutes }}'
seconds: '{{ running_threshold_delay_seconds }}'
- choose:
- conditions: '{{ true }}'
sequence:
- action: input_select.select_option
metadata: {}
data:
option: Running
target:
entity_id: input_select.vaatwas_status
- action: notify.mobile_app_telefoon_ward
metadata: {}
data:
message: Vaatwas is bezig
- repeat:
until:
- condition: template
value_template: '{{ wait.trigger.id == "stop" }}'
sequence:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.vaatwas_lsc_power
for: >-
{{ finish_threshold_delay.hours }}:{{
finish_threshold_delay.minutes }}:{{
finish_threshold_delay.seconds }}
below: 0
id: stop
- platform: state
entity_id:
- sensor.vaatwas_lsc_power
id: running
for: >-
{{ running_threshold_delay.hours }}:{{
running_threshold_delay.minutes }}:{{
running_threshold_delay.seconds }}
- variables:
event_type: '{{ wait.trigger.id }}'
energy_used: |
{% if energy_entity is not none %}
{{ (states(energy_entity) | float) - initial_energy }}
{% else %}
0
{% endif %}
- choose:
- conditions: '{{ event_type == ''running'' }}'
sequence:
- variables:
elapsed_time: >-
{% set elapsed_timedelta = now() - as_datetime(start_time)
%}{{ elapsed_timedelta.days * 86400 +
elapsed_timedelta.seconds }}
elapsed_days: '{{ (elapsed_time | int) // 86400 }}'
elapsed_hours: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400))
// 3600 }}
elapsed_minutes: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600)) // 60 }}
elapsed_seconds: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600) - ((elapsed_minutes|int) *
60)) }}
- choose:
conditions: '{{ true }}'
sequence: []
- conditions: '{{ event_type == ''stop'' }}'
sequence:
- variables:
elapsed_time: >
{% set elapsed_timedelta = now() - as_datetime(start_time
+ finish_threshold_delay.hours * 3600 +
finish_threshold_delay.minutes * 60 +
finish_threshold_delay.seconds) %} {{
elapsed_timedelta.days * 86400 + elapsed_timedelta.seconds
}}
elapsed_days: '{{ (elapsed_time | int) // 86400 }}'
elapsed_hours: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400))
// 3600 }}
elapsed_minutes: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600)) // 60 }}
elapsed_seconds: >-
{{ ((elapsed_time | int) - ((elapsed_days|int) * 86400) -
((elapsed_hours|int) * 3600) - ((elapsed_minutes|int) *
60)) }}
- choose:
- conditions: '{{ true }}'
sequence:
- action: input_select.select_option
metadata: {}
data:
option: Complete
- action: notify.mobile_app_telefoon_ward
metadata: {}
data:
message: Vaatwas is klaar
- action: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.vaatwas_teller
id: '1733402345842'
alias: Vaatwas info
description: ''
Automation info:
I have no idea where the problem could be find
Regards,
Ward