noam76 icon

הדלקה וכיבוי slider

noam76 | PRO | 02/28/19 05:14:37 AM UTC | 0 ⭐ | 667 👁️ | Never ⏰ | []
YAML |

3.78 KB

|

None

|

0 👍

/

0 👎

להדליק ולכבות מספק סליידר מספרים לפי המדריך של אלירן
##
## Timer turn on/off switch by time with slider number
##
 
sensor: !include sensor.yaml
input_boolean: !include input_boolean.yaml
input_number: !include input_number.yaml
automations: !include automations.yaml
 
#!include sensor.yaml
##################################
#Display only Time & Date
  - platform: time_date
    display_options:
     - 'time'
     - 'date'
     - 'time_date'
     - 'date_time'
     - 'time_utc'
 
######### ON Slider Timer ##########
  - platform: template
    sensors:
     timer_on_hour:
      value_template: '{{ states.input_number.timer_on_hours.state | int }}'
     timer_on_min:
      value_template: '{{ states.input_number.timer_on_min.state | int }}'
     timer_on_clock_start:
      value_template: >-
       {{ states.sensor.timer_on_hour.state }}:
       {%- if states.sensor.timer_on_min.state|length == 1 -%}
         0
       {%- endif -%}
         {{ states.sensor.timer_on_min.state }}
     timer_on_clock_time_long:
      value_template: >-
       {% if states.sensor.timer_on_hour.state|length == 1 -%}
         0
       {%- endif -%}
        {{ states.sensor.timer_on_hour.state }}:
       {%- if states.sensor.timer_on_min.state|length == 1 -%}
            0
       {%- endif -%}
         {{ states.sensor.timer_on_min.state }}
######### OFF slider Timer ############
  - platform: template
    sensors:
     timer_off_hour:
      value_template: '{{ states.input_number.timer_off_hours.state | int }}'
     timer_off_min:
      value_template: '{{ states.input_number.timer_off_min.state | int }}'
     timer_off_clock_start:
      value_template: >-
       {{ states.sensor.timer_off_hour.state }}:
       {%- if states.sensor.timer_off_min.state|length == 1 -%}
         0
       {%- endif -%}
         {{ states.sensor.timer_off_min.state }}
     timer_off_clock_time_long:
      value_template: >-
       {% if states.sensor.timer_off_hour.state|length == 1 -%}
         0
       {%- endif -%}
        {{ states.sensor.timer_off_hour.state }}:
       {%- if states.sensor.timer_off_min.state|length == 1 -%}
            0
       {%- endif -%}
         {{ states.sensor.timer_off_min.state }}
 
#!include input_boolean.yaml
##################################
#Timer with slider
 timer_slider_time:
  initial: off
  icon: mdi:alarm-check
 
#!include input_number.yaml
##################################
  timer_on_hours:
   name: Hours ON
   icon: mdi:clock-in
   initial: 8
   min: 0
   max: 23
   step: 1
  timer_on_min:
   name: Minutes ON
   icon: mdi:timer
   initial: 0
   min: 0
   max: 55
   step: 5
  timer_off_hours:
   name: Hours OFF
   icon: mdi:clock-in
   initial: 8
   min: 0
   max: 23
   step: 1
  timer_off_min:
   name: Minutes OFF
   icon: mdi:timer
   initial: 0
   min: 0
   max: 55
   step: 5
 
#!include input automations. yaml
##################################
- id: '1550671373910'
  alias: Timer Slider ON
  trigger:
  - platform: template
    value_template: '{{ states.sensor.time.state == states.sensor.timer_on_clock_time_long.state
      }}'
  condition:
  - condition: state
    entity_id: input_boolean.timer_slider_time
    state: 'on'
  action:
  - entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
    service: switch.turn_on
  initial_state: 'on'
 
- id: '1550677346933'
  alias: Timer Slider OFF
  trigger:
  - platform: template
    value_template: '{{ states.sensor.time.state == states.sensor.timer_off_clock_time_long.state
      }}'
  condition:
  - condition: state
    entity_id: input_boolean.timer_slider_time
    state: 'on'
  action:
  - entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
    service: switch.turn_off

Comments