Leaving home wall switch - Here is my idea

The simplest way to do this is to create a group with all of the device trackers like this:

From my groups.yaml file:

  People:
    - device_tracker.my-iphone
    - device_tracker.moms_iphone
    - device_tracker.sons-iphone
    - device_tracker.daughters-iphone

My automation using said group:

- alias: 'Christmas Tree off'
  trigger:
  - platform: time
    at: '23:45:00'
  - platform: state
    entity_id: group.people
    from: 'home'
    to: 'not_home'
  condition:
    condition: state
    entity_id: input_boolean.holiday_mode
    state: 'on'
  action:
    service: homeassistant.turn_off
    entity_id: group.tree

Here’s a config that I had tested over several months and it worked fine. You have to understand that the bayesian sensor is only as good as the data points that it consumes, so you must accept trial and error when tuning it over time. The more sensors you add, the more reliable the absence detection will work. If one of the sensor fails (due to wrong information), another sensor is likely to kick in so that the result remains the same. Think about other factors than merely your phone when finding criteria for absence/presence.

binary_sensor:
  - platform: bayesian
    name: 'house_not_occupied'
    prior: 0.4  # 40% chance that house is not occupied (12h out of 24h a day) + home office days
    probability_threshold: 0.88
    observations:
          # We are not in the house -> very likely there's no motion recorded by motion and door/window sensors
      - entity_id: 'sensor.no_house_activity'
        prob_given_true: 0.8 # 80% chance that if we're out of the house there's no motion recorded in the house
        prob_given_false: 0.1 # 20% chance that if we're NOT out of the house there is no motion recorded in the house
        platform: 'state'
        to_state: 'True'
      - entity_id: 'group.family_devices'
        prob_given_true: 0.95  # 95% chance that if we're out of the house there's no family device connected
        prob_given_false: 0.2 # 20% chance that if we're NOT out of the house the devices are not connected
        platform: 'state'
        to_state: 'off'
          # We are not in the house -> very likely the NB is not connected to LAN
      - entity_id: 'device_tracker.lenovo_notebook'
        prob_given_true: 1.0 # 100% chance that if we're out of the house the NB is not connected to LAN
        prob_given_false: 0.6 # 60% chance that if we're NOT out of the house the NB is not connected to LAN
        platform: 'state'
        to_state: 'not_home'
          # We are not in the house -> very likely the Phililps TV is not running
      - entity_id: 'device_tracker.philipstv'
        prob_given_true: 1.0 # 100% chance that if we're out of the house the TV is not running
        prob_given_false: 0.85 # 60% chance that if we're NOT out of the house the TV is not running
        platform: 'state'
        to_state: 'not_home'