1
0

Switch to presence sensor

This commit is contained in:
Przemek Grondek 2023-04-22 20:03:39 +02:00
parent efee6df844
commit 8e93e14df1
8 changed files with 183 additions and 82 deletions

View File

@ -34,7 +34,7 @@
condition: condition:
- condition: numeric_state - condition: numeric_state
entity_id: sensor.office_illuminance entity_id: sensor.office_illuminance
below: '170' below: '200'
action: action:
- service: script.hallway_lights_on - service: script.hallway_lights_on

View File

@ -2,19 +2,22 @@
alias: '[Kitchen] Lights On' alias: '[Kitchen] Lights On'
mode: single mode: single
trigger: trigger:
# - platform: state
# entity_id: binary_sensor.kitchen_motion_sensor
# from: 'off'
# to: 'on'
# - platform: state
# entity_id: binary_sensor.kitchen_tabletop_motion_detection
# to: 'on'
- platform: state - platform: state
entity_id: binary_sensor.kitchen_motion_sensor entity_id: binary_sensor.presence_sensor_fp2_kitchen
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_tabletop_motion_detection
to: 'on' to: 'on'
action: action:
- choose: - choose:
- conditions: - conditions:
- condition: numeric_state - condition: numeric_state
entity_id: sensor.office_illuminance entity_id: sensor.office_illuminance
below: '170' below: '200'
sequence: sequence:
- service: script.kitchen_lights_on - service: script.kitchen_lights_on
@ -23,30 +26,33 @@
mode: restart mode: restart
trigger: trigger:
- platform: state - platform: state
entity_id: binary_sensor.kitchen_motion_sensor entity_id: binary_sensor.presence_sensor_fp2_kitchen
for: '0:02:00'
from: 'on'
to: 'off' to: 'off'
- platform: state # - platform: state
entity_id: binary_sensor.kitchen_sink_motion_sensor # entity_id: binary_sensor.kitchen_motion_sensor
to: 'off' # for: '0:02:00'
for: '0:02:00' # from: 'on'
- platform: state # to: 'off'
entity_id: binary_sensor.kitchen_tabletop_motion_detection # - platform: state
to: 'off' # entity_id: binary_sensor.kitchen_sink_motion_sensor
for: '0:02:00' # to: 'off'
condition: # for: '0:02:00'
- condition: state # - platform: state
entity_id: binary_sensor.kitchen_motion_sensor # entity_id: binary_sensor.kitchen_tabletop_motion_detection
state: 'off' # to: 'off'
for: '0:02:00' # for: '0:02:00'
- condition: state # condition:
entity_id: binary_sensor.kitchen_sink_motion_sensor # - condition: state
state: 'off' # entity_id: binary_sensor.kitchen_motion_sensor
for: '0:02:00' # state: 'off'
- condition: state # for: '0:02:00'
entity_id: binary_sensor.kitchen_tabletop_motion_detection # - condition: state
state: 'off' # entity_id: binary_sensor.kitchen_sink_motion_sensor
for: '0:02:00' # state: 'off'
# for: '0:02:00'
# - condition: state
# entity_id: binary_sensor.kitchen_tabletop_motion_detection
# state: 'off'
# for: '0:02:00'
action: action:
- service: script.kitchen_lights_off - service: script.kitchen_lights_off

View File

@ -23,56 +23,7 @@
type: remote_button_alt_short_press type: remote_button_alt_short_press
subtype: button_2 subtype: button_2
action: action:
- choose: - service: script.living_room_lights_toggle
- conditions:
- condition: state
entity_id: light.couch_lights
state: 'on'
sequence:
- service: light.turn_off
entity_id: light.couch_lights
- conditions:
- condition: state
entity_id: light.couch_lights
state: 'off'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.couch_lights
data:
brightness_pct: 100
kelvin: 2000
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
sequence:
- service: light.turn_on
entity_id: light.couch_lights
data:
brightness_pct: 100
kelvin: 3200
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_on
entity_id: light.couch_lights
data:
brightness_pct: 5
kelvin: 2700
- id: living-room-button-3 # Middle left - id: living-room-button-3 # Middle left
alias: '[Living Room] Button 3 - AndroidTV' alias: '[Living Room] Button 3 - AndroidTV'

View File

@ -0,0 +1,25 @@
- id: living-room-lights-on
alias: '[Living Room] Lights On'
mode: single
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_couch
to: 'on'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.office_illuminance
below: '200'
sequence:
- service: script.living_room_lights_on
- id: living-room-lights-off
alias: '[Living Room] Lights Off'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_couch
to: 'off'
action:
- service: script.living_room_lights_off

View File

@ -26,7 +26,7 @@
trigger: trigger:
- platform: numeric_state - platform: numeric_state
entity_id: sensor.office_illuminance entity_id: sensor.office_illuminance
below: '170' below: '200'
for: for:
hours: 0 hours: 0
minutes: 5 minutes: 5
@ -43,6 +43,9 @@
- condition: state - condition: state
entity_id: device_tracker.amdn4684 entity_id: device_tracker.amdn4684
state: 'home' state: 'home'
- condition: state
entity_id: binary_sensor.presence_sensor_fp2_office
state: 'on'
- condition: state - condition: state
entity_id: input_select.home_mode entity_id: input_select.home_mode
state: Day state: Day

View File

@ -0,0 +1,25 @@
- id: office-lights-on
alias: '[Office] Lights On'
mode: single
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_office
to: 'on'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.office_illuminance
below: '200'
sequence:
- service: script.office_lights_on
- id: office-lights-off
alias: '[Office] Lights Off'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_office
to: 'off'
action:
- service: script.office_lights_off

View File

@ -0,0 +1,25 @@
- id: table-lights-on
alias: '[Table] Lights On'
mode: single
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_table
to: 'on'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.office_illuminance
below: '200'
sequence:
- service: script.table_lights_on
- id: table-lights-off
alias: '[Table] Lights Off'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.presence_sensor_fp2_table
to: 'off'
action:
- service: script.table_lights_off

View File

@ -0,0 +1,66 @@
living_room_lights_toggle:
alias: '[Living Room] Lights toggle'
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.table_lamp_lights
state: 'on'
sequence:
living_room_ice: script.table_lights_off
- conditions:
- condition: state
entity_id: light.table_lamp_lights
state: 'off'
sequence:
living_room_ice: script.table_lights_on
living_room_lights_on:
alias: '[Living Room] Lights on'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Day
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.couch_lights
data:
brightness_pct: 100
kelvin: 2000
- conditions:
- condition: state
entity_id: input_boolean.sleep_mode
state: 'off'
sequence:
- service: light.turn_on
entity_id: light.couch_lights
data:
brightness_pct: 100
kelvin: 3200
- conditions:
- condition: state
entity_id: input_select.home_mode
state: Night
sequence:
- service: light.turn_on
data:
brightness_pct: 40
hs_color:
- 360
- 100
target:
entity_id: light.couch_lights
living_room_lights_off:
alias: '[Living Room] Lights off'
sequence:
- service: light.turn_off
entity_id: light.couch_lights