homeassistant/archive/packages/irritation-old-extras.yaml.off

166 lines
6.0 KiB
Plaintext
Raw Normal View History

# - Day
# - Every Other Day
# - Every Third Day
# - Every Week
# values:
# - 3
# - 6
# - 12
# - 24
# - 48
# - 72
# - 168
# sensor:
# - platform: template # Derived values
# sensors:
# irrigation_zone_1_schedule_delta: # computes delta based on choice
# entity_id: input_select.irrigation_zone_1_schedule_repeatin
# unit_of_measurement: 'hours'
# value_template: >
# {% for option in state_attr("input_select.irrigation_zone_1_schedule_repeatin", "options") -%}
# {% if is_state("input_select.irrigation_zone_1_schedule_repeatin", option) -%}
# {{ state_attr("input_select.irrigation_zone_1_schedule_repeatin", 'values')[loop.index - 1] }}
# {%- endif %}
# {%- endfor %}
# format the next timestamp for humans
# irrigation_zone_1_schedule_next:
# friendly_name: Next run to start at
# entity_id: variable.irrigation_zone_1_schedule_next_timestamp
# value_template: '{{ states.variable.irrigation_zone_1_schedule_next.state | int | timestamp_custom("%A, %d %h %H:%M") }}'
# irrigation_zone_1_schedule_countdown:
# friendly_name: Countdown to next run
# entity_id: variable.irrigation_zone_1_schedule_countdown
# # value_template: '{{ states.variable.irrigation_zone_1_schedule_countdown.state | int | timestamp_custom("%A, %d %h %H:%M") }}'
# value_template: >-
# {% set time = states.variable.irrigation_zone_1_schedule_countdown.state | int %}
# {% set minutes = ((time % 3600) / 60) | int %}
# {% set hours = ((time % 86400) / 3600) | int %}
# {% set days = (time / 86400) | int %}
# {{time}} seconds is {{ days }}:{{ hours }}:{{minutes}} (D:H:M)
# switch:
# - platform: mqtt
# name: "Scheduler Test Solenoid"
# state_topic: "status/irrigation/zone_1"
# command_topic: "set/irrigation/zone_1"
# payload_on: "ON"
# payload_off: "OFF"
# qos: 0
# retain: true
# script:
# enable_irrigation_zone_1_schedule:
# sequence:
# - event: ENABLE_SCHEDULE
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_schedule_countdown
# value_template: '{{ states.variable.irrigation_zone_1_schedule_next_timestamp.state | int - as_timestamp(now()) }}'
# value_template: "{{ as_timestamp(now()) }}"
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_schedule_dummy_device
# value: 'ON'
# - service: automation.turn_on
# entity_id: automation.irrigation_zone_1_schedule_countdown
# - service: automation.turn_on
# data:
# entity_id: automation.irrigation_zone_1_timer_zero_trigger
# disable_irrigation_zone_1_schedule:
# sequence:
# - service: automation.turn_off
# data:
# entity_id: automation.irrigation_zone_1_schedule_countdown
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_schedule_countdown
# value: 0
# automation:
# - alias: irrigation_zone_1_schedule_countdown
# initial_state: false
# trigger:
# platform: time_pattern
# seconds: '/1'
# action:
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_schedule_countdown
# value_template: '{{ [((variable.state | int) - 1), 0] | max }}'
# - alias: irrigation_zone_1_schedule_changed
# # initial_state: false
# trigger:
# platform: state
# action:
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_schedule_countdown
# value_template: '{{ states.variable.irrigation_zone_1_schedule_next_timestamp.state | int - as_timestamp(now()) }}'
# - service: automation.turn_off
# data:
# entity_id: automation.irrigation_zone_1_timer_zero_trigger
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_timer_device
# value: 'OFF'
#
#
# - alias: irrigation_zone_1_timer_zero_trigger
# initial_state: false
# trigger:
# platform: numeric_state
# entity_id: variable.irrigation_zone_1_timer_countdown
# below: 1
# action:
# - service: automation.turn_off
# entity_id: automation.irrigation_zone_1_timer_countdown
# - service: variable.set_variable
# data:
# variable: irrigation_zone_1_timer_device
# value: 'OFF'
# #
# return corresponding value from input_select option of same name
# irrigation_zone_1_schedule_delta:
# entity_id: input_select.irrigation_zone_1_schedule_repeatin
# value_template: >
# {% for option in state_attr("input_select.irrigation_zone_1_schedule_repeatin", "options") -%}
# {% if is_state("input_select.irrigation_zone_1_schedule_repeatin", option) -%}
# {{ state_attr("input_select.irrigation_zone_1_schedule_repeatin", 'values')[loop.index - 1] }}
# {%- endif %}
# {%- endfor %}
# irrigation_zone_1_schedule_base_timestamp:
# entity_id: input_datetime.irrigation_zone_1_schedule_base
# value_template: >
# {{
# as_timestamp(now())
# - ( now().second + now().minute | int * 60 + now().hour | int * 3600 )
# + state_attr('input_datetime.irrigation_zone_1_schedule_base','hour')|int * 3600
# + state_attr('input_datetime.irrigation_zone_1_schedule_base','minute') * 60
# }}
# value_template: "{{ (state_attr('input_datetime.irrigation_zone_1_schedule_base','hour')|int * 3600 + state_attr('input_datetime.irrigation_zone_1_schedule_base','minute')|int * 60) | timestamp_custom('%A, %d %h %H:%M') }}"
# value_template: >
# "{{ (state_attr('input_datetime.irrigation_zone_1_schedule_base','hour')|int * 3600 +
# state_attr('input_datetime.irrigation_zone_1_schedule_base','minute')|int * 60 +
# as_timestamp(now()))
# | timestamp_custom("%A, %d %h %H:%M") }}"
# value_template: "{{ states(input_datetime.irrigation_zone_1_schedule_base) }}"
# {{ as_timestamp(now()) + as_timestamp(states.input_datetime.irrigation_zone_1_schedule_base) }}
# {{ as_timestamp(now()) + as_timestamp(states.input_datetime.irrigation_zone_1_schedule_base) }}