pdf-icon

Unit TMOS PIR Home Assistant Integration

This tutorial shows how to use the Unit TMOS PIR presence sensor with an AtomS3R controller and integrate it into Home Assistant to monitor human presence and motion status in real time.

1. Preparation

  1. Hardware
  • 1 x Unit TMOS PIR
  • 1 x AtomS3R
  • 1 x HY2.0-4P Grove Cable (20cm)
  • 1 x Home Assistant host (server, mini PC, NAS, etc.)
  1. Software & versions

2. Create Device

  1. Open ESPHome Dashboard. If the initial wizard appears, click CONTINUE.

  1. Click the green + button in the bottom right to create a new device.

  1. Click New Device Setup to enter the device creation wizard.

  1. Enter a device name and click NEXT.

  1. Select the device type and click ESP32S3.

  1. Click SKIP to skip the encryption key setup.

  1. Click EDIT to open the YAML editor and customize the device configuration.

3. Device Configuration

3.1 External components

Add an External Components block in the YAML file to load the STHS34PF80 sensor driver.

external_components:
  - source: github://m5stack/esphome-yaml/components
    components: sths34pf80
    refresh: 0s

3.2 I2C bus configuration

Add the I2C component to configure the communication pins between Unit TMOS PIR and AtomS3R.

i2c:
  sda: GPIO2
  scl: GPIO1
  scan: true
Info
PORT.A on AtomS3R corresponds to SDA: GPIO2 and SCL: GPIO1. If you use a different port, please adjust the pins accordingly.

3.3 Sensor configuration

Add the Sensor component to enable presence and motion detection.

sensor:
  - platform: sths34pf80
    pres_flag:
      name: "TMOS Presence Detected"
    mot_flag:
      name: "TMOS Motion Detected"
    presence_threshold: 200   
    presence_hysteresis: 50  
    motion_hysteresis: 50     
    odr: 8          
    update_interval: 1s 

Main parameter description:

Parameter Value Description
presence_threshold 200 Presence detection threshold. Higher values make the sensor less sensitive.
presence_hysteresis 50 Hysteresis for presence detection to avoid frequent toggling.
motion_hysteresis 50 Hysteresis for motion detection.
odr 8 Output data rate (Hz). Supported values: 0.25 / 0.5 / 1 / 2 / 4 / 8 / 15 / 30.
update_interval 1s Sensor state update interval in Home Assistant.

4. Build and Flash Firmware

4.1 Build firmware

  1. After editing the YAML configuration, click SAVE in the top right, then click INSTALL.

  1. In the popup dialog, select Manual Download.

  1. Wait for the firmware to compile, then click Download and choose Factory format (Previously Modern) to save the firmware file locally.

Info
For a complete example configuration, see Unit TMOS. The first build may take some time depending on the performance of your Home Assistant host and network conditions.

4.2 Flash firmware

  1. Connect AtomS3R to your computer using a USB Type-C cable. Open ESPHome Web and click CONNECT.

  1. In the serial port selection dialog, select the correct port.

  1. Click INSTALL.

  1. Select the firmware file downloaded in step 3 and start flashing.

Warning
After flashing is complete, you must reset the device; otherwise the firmware may not start correctly.

5. Start Using in Home Assistant

  1. In Home Assistant, go to Settings > Devices & Services to open the integration management page.

  1. In the Discovered section, find the Unit TMOS PIR device, click CONFIGURE, and follow the wizard to complete the setup.

  1. After the device is added, you will see two sensor entities on the device page: pres_flag (presence detection) and mot_flag (motion detection), along with their real-time states.

  1. Finally, add these sensor entities to a dashboard so you can monitor human presence and motion status in real time.

On This Page