Advertisement
noam76

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

Feb 28th, 2019
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.78 KB | None | 0 0
  1. להדליק ולכבות מספק סליידר מספרים לפי המדריך של אלירן
  2. ##
  3. ## Timer turn on/off switch by time with slider number
  4. ##
  5.  
  6. sensor: !include sensor.yaml
  7. input_boolean: !include input_boolean.yaml
  8. input_number: !include input_number.yaml
  9. automations: !include automations.yaml
  10.  
  11. #!include sensor.yaml
  12. ##################################
  13. #Display only Time & Date
  14.   - platform: time_date
  15.     display_options:
  16.     - 'time'
  17.      - 'date'
  18.      - 'time_date'
  19.      - 'date_time'
  20.      - 'time_utc'
  21.  
  22. ######### ON Slider Timer ##########
  23.   - platform: template
  24.     sensors:
  25.      timer_on_hour:
  26.       value_template: '{{ states.input_number.timer_on_hours.state | int }}'
  27.      timer_on_min:
  28.       value_template: '{{ states.input_number.timer_on_min.state | int }}'
  29.      timer_on_clock_start:
  30.       value_template: >-
  31.        {{ states.sensor.timer_on_hour.state }}:
  32.       {%- if states.sensor.timer_on_min.state|length == 1 -%}
  33.          0
  34.        {%- endif -%}
  35.          {{ states.sensor.timer_on_min.state }}
  36.      timer_on_clock_time_long:
  37.       value_template: >-
  38.        {% if states.sensor.timer_on_hour.state|length == 1 -%}
  39.          0
  40.        {%- endif -%}
  41.         {{ states.sensor.timer_on_hour.state }}:
  42.       {%- if states.sensor.timer_on_min.state|length == 1 -%}
  43.             0
  44.        {%- endif -%}
  45.          {{ states.sensor.timer_on_min.state }}
  46. ######### OFF slider Timer ############
  47.   - platform: template
  48.     sensors:
  49.      timer_off_hour:
  50.       value_template: '{{ states.input_number.timer_off_hours.state | int }}'
  51.      timer_off_min:
  52.       value_template: '{{ states.input_number.timer_off_min.state | int }}'
  53.      timer_off_clock_start:
  54.       value_template: >-
  55.        {{ states.sensor.timer_off_hour.state }}:
  56.       {%- if states.sensor.timer_off_min.state|length == 1 -%}
  57.          0
  58.        {%- endif -%}
  59.          {{ states.sensor.timer_off_min.state }}
  60.      timer_off_clock_time_long:
  61.       value_template: >-
  62.        {% if states.sensor.timer_off_hour.state|length == 1 -%}
  63.          0
  64.        {%- endif -%}
  65.         {{ states.sensor.timer_off_hour.state }}:
  66.       {%- if states.sensor.timer_off_min.state|length == 1 -%}
  67.             0
  68.        {%- endif -%}
  69.          {{ states.sensor.timer_off_min.state }}
  70.  
  71. #!include input_boolean.yaml
  72. ##################################
  73. #Timer with slider
  74.  timer_slider_time:
  75.   initial: off
  76.   icon: mdi:alarm-check
  77.  
  78. #!include input_number.yaml
  79. ##################################
  80.   timer_on_hours:
  81.    name: Hours ON
  82.    icon: mdi:clock-in
  83.    initial: 8
  84.    min: 0
  85.    max: 23
  86.    step: 1
  87.   timer_on_min:
  88.    name: Minutes ON
  89.    icon: mdi:timer
  90.    initial: 0
  91.    min: 0
  92.    max: 55
  93.    step: 5
  94.   timer_off_hours:
  95.    name: Hours OFF
  96.    icon: mdi:clock-in
  97.    initial: 8
  98.    min: 0
  99.    max: 23
  100.    step: 1
  101.   timer_off_min:
  102.    name: Minutes OFF
  103.    icon: mdi:timer
  104.    initial: 0
  105.    min: 0
  106.    max: 55
  107.    step: 5
  108.  
  109. #!include input automations. yaml
  110. ##################################
  111. - id: '1550671373910'
  112.   alias: Timer Slider ON
  113.   trigger:
  114.   - platform: template
  115.     value_template: '{{ states.sensor.time.state == states.sensor.timer_on_clock_time_long.state
  116.       }}'
  117.   condition:
  118.   - condition: state
  119.     entity_id: input_boolean.timer_slider_time
  120.     state: 'on'
  121.   action:
  122.   - entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
  123.     service: switch.turn_on
  124.   initial_state: 'on'
  125.  
  126. - id: '1550677346933'
  127.   alias: Timer Slider OFF
  128.   trigger:
  129.   - platform: template
  130.     value_template: '{{ states.sensor.time.state == states.sensor.timer_off_clock_time_long.state
  131.       }}'
  132.   condition:
  133.   - condition: state
  134.     entity_id: input_boolean.timer_slider_time
  135.     state: 'on'
  136.   action:
  137.   - entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
  138.     service: switch.turn_off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement