Zigbee Bed occupancy sensor

its a binary_sensor so
if I long press the my bedroom light
it toggle the bedside lamps

 - id: 'hold Master light Both On'
  alias: hold Master light Both On
  initial_state: true
  trigger:
  - entity_id: sensor.master_light
    platform: state
    to: 'HOLD'
  condition:
  - condition: state
    entity_id: binary_sensor.in_bed_her_side
    state: 'off'
  - condition: state
    entity_id: binary_sensor.in_bed_his_side
    state: 'off'
  action:
  - data:
      entity_id: light.her_side , light.his_side
    service: light.toggle

and if one of us are in bed

- id: 'hold Master light His Side'
  alias: hold Master light Both His Side
  initial_state: true
  trigger:
  - entity_id: sensor.master_light
    platform: state
    to: 'HOLD'
  condition:
  - condition: state
    entity_id: binary_sensor.in_bed_her_side
    state: 'on'
  - condition: state
    entity_id: binary_sensor.in_bed_his_side
    state: 'off'
  action:
  - data:
      entity_id: light.his_side
    service: light.toggle

and its mate

- id: 'hold Master light Her Side'
  alias: hold Master light Both Her Side
  initial_state: true
  trigger:
  - entity_id: sensor.master_light
    platform: state
    to: 'HOLD'
  condition:
  - condition: state
    entity_id: binary_sensor.in_bed_her_side
    state: 'off'
  - condition: state
    entity_id: binary_sensor.in_bed_his_side
    state: 'on'
  action:
  - data:
      entity_id: light.her_side
    service: light.toggle
1 Like