Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created January 11, 2021 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/c43d5bf828c5f18d8ec22d9c1538fd16 to your computer and use it in GitHub Desktop.
Save bessarabov/c43d5bf828c5f18d8ec22d9c1538fd16 to your computer and use it in GitHub Desktop.
default_config:
input_number:
working_hours:
initial: 0
min: 0
max: 5
step: 0.01
tmp:
initial: 0
min: 0
max: 100
step: 0.01
mode: box
input_boolean:
action:
automation:
- trigger:
platform: state
entity_id: input_number.working_hours
condition:
condition: template
value_template: "{{ (trigger.to_state.state | float) - (states('input_number.tmp') | float) >= 1 }}"
action:
- service: input_number.set_value
data:
entity_id: input_number.tmp
value: "{{ trigger.to_state.state }}"
- service: input_boolean.turn_on
entity_id: input_boolean.action
- delay:
milliseconds: 500
- service: input_boolean.turn_off
entity_id: input_boolean.action
- trigger:
platform: state
entity_id: input_number.working_hours
condition:
condition: template
value_template: "{{ (trigger.to_state.state | float) < 0.01 }}"
action:
- service: input_number.set_value
data:
entity_id: input_number.tmp
value: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment