Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- recorder:
- timer:
- window_up_1:
- name: "Timer"
- duration: '00:00:20'
- window_down_1:
- name: "Timer"
- duration: '00:00:20'
- input_number:
- window_position_1:
- name: "Window 1 Position"
- min: 0
- max: 20
- window_set_position_1:
- name: "Apertura Serranda"
- min: 0
- max: 100
- (di questo uso solo entità: input_number.window_set_position_1)
- cover:
- - platform: template
- covers:
- window_cover_1:
- friendly_name: "Window 1 Cover"
- position_template: "{{ (((states.input_number.window_position_1.state | int) * 100)/20 | int) }}"
- open_cover:
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power2'
- payload: 'OFF'
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power1'
- payload: 'ON'
- close_cover:
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power1'
- payload: 'OFF'
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power2'
- payload: 'ON'
- stop_cover:
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power1'
- payload: 'OFF'
- - service: mqtt.publish
- data:
- topic: 'cmnd/sonoff_1/power2'
- payload: 'OFF'
- - platform: mqtt
- state_topic: "tele/sonoff_1/STATE"
- command_topic: "cmnd/sonoff_1/Backlog"
- name: "Serranda 1"
- qos: 0
- retain: true
- payload_open: "power2 OFF;power1 ON"
- payload_close: "power1 OFF;power2 ON"
- payload_stop: "power1 OFF;power2 OFF"
- state_open: "ON"
- state_closed: "OFF"
- optimistic: false
- automations.yaml
- #########################Serranda 1 set Position##############################
- - id: '301_1'
- alias: Window 1 - MQTT Button1 OFF (up)
- trigger:
- - payload: 'OFF'
- platform: mqtt
- topic: stat/sonoff_1/POWER1
- action:
- - service: timer.cancel
- entity_id: timer.window_up_1
- - id: '302_1'
- alias: Window 1 - MQTT Button2 OFF (down)
- trigger:
- - payload: 'OFF'
- platform: mqtt
- topic: stat/sonoff_1/POWER2
- action:
- - service: timer.cancel
- entity_id: timer.window_down_1
- - id: '303_1'
- alias: Window 1 - Timer stopped
- trigger:
- - platform: event
- event_type: timer.finished
- event_data:
- entity_id: timer.window_up_1
- - platform: event
- event_type: timer.finished
- event_data:
- entity_id: timer.window_down_1
- action:
- - service: cover.stop_cover
- data:
- entity_id: cover.window_cover_1
- - id: '311_1'
- alias: Window 1 - MQTT Button1 ON (up)
- trigger:
- - payload: 'ON'
- platform: mqtt
- topic: stat/sonoff_1/POWER1
- condition:
- condition: template
- value_template: '{{ as_timestamp(now()) - as_timestamp(states.input_number.window_set_position_1.last_updated) > 3 }}'
- action:
- - service: timer.start
- data:
- duration: 00:00:20
- entity_id: timer.window_up_1
- - id: '312_1'
- alias: Window 1 - MQTT Button2 ON (down)
- trigger:
- - payload: 'ON'
- platform: mqtt
- topic: stat/sonoff_1/POWER2
- condition:
- condition: template
- value_template: '{{ as_timestamp(now()) - as_timestamp(states.input_number.window_set_position_1.last_updated) > 3 }}'
- action:
- - service: timer.start
- data:
- duration: 00:00:20
- entity_id: timer.window_down_1
- - id: '512_1'
- alias: Window 1 - Set Position UP
- trigger:
- platform: state
- entity_id: input_number.window_set_position_1
- condition:
- condition: template
- value_template: "{{ (states.input_number.window_position_1.state | int) < ((((states.input_number.window_set_position_1.state | int ) * 20 )/100) | int) }}"
- action:
- - service: timer.start
- data_template:
- entity_id: timer.window_up_1
- duration: "{{ '00:00:%02d' | format( ((states.input_number.window_position_1.state | int) - ((((states.input_number.window_set_position_1.state | int ) * 20 )/100) | int) ) | abs ) }}"
- - service: cover.open_cover
- data:
- entity_id: cover.window_cover_1
- #############################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement