Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Screens Control V2
- description: ""
- mode: single
- triggers:
- - trigger: state
- entity_id:
- - binary_sensor.miguel_presence_occupancy
- to: "on"
- id: sit-down
- - trigger: state
- entity_id:
- - binary_sensor.miguel_presence_occupancy
- to: "off"
- id: stand-up
- conditions: []
- actions:
- - choose:
- - conditions:
- - condition: trigger
- id:
- - sit-down
- sequence:
- - action: input_boolean.turn_on
- metadata: {}
- data: {}
- target:
- entity_id: input_boolean.desk_presence_miguel
- - conditions:
- - condition: trigger
- id:
- - stand-up
- - condition: state
- entity_id: input_boolean.desk_presence_miguel
- state: "on"
- sequence:
- - variables:
- state_last_changed: >-
- {{ ((now() -
- states.input_boolean.desk_presence_miguel.last_changed).seconds)|int }}
- - choose:
- - conditions:
- - alias: state last changed time less than 1min
- condition: template
- value_template: "{{ state_last_changed < 60 }}"
- sequence:
- - action: input_boolean.turn_off
- metadata: {}
- data: {}
- target:
- entity_id: input_boolean.desk_presence_miguel
- alias: if state been on for less than 1 min switch off
- - conditions:
- - alias: bulb last changed time 1min+
- condition: template
- value_template: "{{ state_last_changed > 59 }}"
- sequence:
- - wait_for_trigger:
- - trigger: state
- entity_id:
- - >-
- binary_sensor.miguel_presence_occupancy
- to: "on"
- timeout:
- hours: 0
- minutes: 5
- seconds: 0
- milliseconds: 0
- alias: wait for 5 mins to see if comes back
- - alias: if clear after wait then turn off
- if:
- - condition: state
- entity_id: binary_sensor.miguel_presence_occupancy
- state: "off"
- then:
- - action: input_boolean.turn_off
- metadata: {}
- data: {}
- target:
- entity_id: input_boolean.desk_presence_miguel
- alias: if light has been on for 1 min+ keep on for 5 mins
Advertisement
Add Comment
Please, Sign In to add comment