- id: bathroom_shower_motion_on alias: '[Bathroom] Shower Motion On' mode: restart trigger: - platform: state entity_id: binary_sensor.bathroom_shower_sensor_motion from: 'off' to: 'on' action: - service: script.bathroom_shower_lights_on - choose: - conditions: - condition: state entity_id: media_player.bathroom state: playing - condition: numeric_state entity_id: media_player.bedroom attribute: volume_level below: 0.65 sequence: - service: media_player.volume_set data: volume_level: 0.65 target: entity_id: media_player.bathroom - id: bathroom_shower_motion_off alias: '[Bathroom] Shower Motion Off' mode: restart trigger: - platform: state entity_id: binary_sensor.bathroom_shower_sensor_motion for: '0:02:00' from: 'on' to: 'off' - platform: state entity_id: binary_sensor.bathroom_motion_occupancy for: '0:05:00' from: 'on' to: 'off' condition: - condition: state entity_id: binary_sensor.bathroom_shower_sensor_motion for: '0:02:00' state: 'off' action: - service: script.bathroom_shower_lights_off - choose: - conditions: - condition: state entity_id: media_player.bathroom state: playing sequence: - repeat: until: - condition: numeric_state entity_id: media_player.bathroom attribute: volume_level below: '0.45' sequence: - service: media_player.volume_down target: entity_id: media_player.bathroom - delay: seconds: 10 - service: media_player.volume_set data: volume_level: 0.45 target: entity_id: media_player.bathroom