Using PIR motion sensors for presence detection

I’m new to Home Assistant and I found the documentation and cookbook quite good to get started quickly, but there is one topic that I’m wondering quite a bit about: How can I use my Z-Wave PIR motion sensors efficiently together with Home Assistant?

It seems to me that there is a built in platform for presence monitoring, that the device trackers are using as a backend. I’m surprised not to find motion sensors here. They won’t tell who is at home, but they can tell it which rooms there are someone and indicate high or low activity level. And I would find it useful to use them for presence based light control without creating automations to recreate such functionality if there is an ready-made mechanism that I can connect these motion sensors to.

My aim is to switch house modes/scenes (Home, Away, Only in the home office) based on motion in order to turn on/off light, lower the temperature, notify/warn about motion.

Can anyone point me to configurations with clever examples on using motion sensors?

Is the pir wireless?

You might have a battery consumption issue

Device trackers and PIR motion sensors are really aimed at different use cases, but could be combined to cover other use cases.

Device trackers are probably best used for setting your scene/mode (ie home or away), where as motion sensors can be used to trigger events, i.e., someone walked into the room and it is after sunset, so turn on the light.

Example Motion sensor use:

- alias: 'Rule 3 Welcome Home light in kitchen'
  trigger:
    platform: state
    entity_id: binary_sensor.stairwell_motion_sensor_4_0
    from: 'off'
    to: 'on'
  condition:
  - condition: state
    entity_id: binary_sensor.basement_motion_sensor_5_0
    state: 'on'
  - condition: sun
    after: sunset
  action:
    service: light.turn_on
    entity_id: light.kitchen_dimmer_level_9_0

Example presense detection based on bluetooth:

# Turns on Christmas Tree lights
- alias: 'Christmas Tree on'
  trigger:
  - platform: state
    entity_id: sun.sun
    state: 'above_horizon'
  - platform: state
    entity_id: group.tracked
    from: 'not_home'
    to: 'home'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: group.tracked
        state: 'home'
      - condition: state
        entity_id: input_boolean.holiday_mode
        state: 'on'
      - condition: state
        entity_id: group.tree
        state: 'off'
      - condition: time
        before: '22:30'
  action:
    service: homeassistant.turn_on
    entity_id: group.tree