Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing some template conditions with state conditions #36

Open
wants to merge 1 commit into
base: release/v3.0.0-dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions appliance-status-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ action:
state: "on"
- condition: template
value_template: "{% if appliance_overload_state_enabled %}{{ states(appliance_suspended_sensor) | float <= 0.0 }}{% else %}true{% endif %}"
- condition: template
value_template: "{{ states(appliance_socket) == 'on' }}"
- condition: state
entity_id: !input appliance_socket
state: 'on'
- condition: numeric_state
entity_id: !input "appliance_power_sensor"
below: !input "appliance_finishing_power_threshold"
Expand Down Expand Up @@ -612,8 +613,9 @@ action:
# NOTE: "unplugged" state handling logic #
##################################################
- conditions:
- condition: template
value_template: "{{ states(appliance_socket) == 'off' }}"
- condition: state
entity_id: !input appliance_socket
state: 'off'
- condition: not
conditions:
- condition: template
Expand Down Expand Up @@ -708,8 +710,9 @@ action:
# IF (and)
- conditions:
# the socket is on
- condition: template
value_template: "{{ states(appliance_socket) == 'on' }}"
- condition: state
entity_id: !input appliance_socket
state: 'on'
# the power consumption > appliance_starting_power_threshold
- condition: numeric_state
entity_id: !input "appliance_power_sensor"
Expand Down Expand Up @@ -933,16 +936,18 @@ action:
- condition: or
conditions:
# The socket is on
- condition: template
value_template: "{{ states(appliance_socket) == 'on' }}"
- condition: state
entity_id: !input appliance_socket
state: 'on'
- condition: and
conditions:
# The option that forces the state machine to enter idle is on
- condition: template
value_template: "{{ appliance_job_completed_when_socket_is_off }}"
# The socket is off
- condition: template
value_template: "{{ states(appliance_socket) == 'off' }}"
- condition: state
entity_id: !input appliance_socket
state: 'off'
sequence:
# ***** LOG SECTION *****
- service: system_log.write
Expand Down Expand Up @@ -970,8 +975,9 @@ action:
value_template: >
{{ appliance_job_completed_when_socket_is_off }}
# The socket is on
- condition: template
value_template: "{{ states(appliance_socket) == 'off' }}"
- condition: state
entity_id: !input appliance_socket
state: 'off'

# If the state machine isn't already in the job_completed state
- condition: not
Expand Down