How to Fix Tuya PIR Motion Sensor Status Updating Problem in Home Assistant?

This article shows you how to temporarily fix the Tuya PIR status problem in Home Assistant. When you’re using some ZigBee PIR Motion sensor, it may occurs to you that Home assistant can not update the PIR sensor’s status correctly. In my case, the PIR status will stay “is detected” unless the Tuya integration is reload or reboot of the Home assistant.

Regardless which version of your Home assistant is, the problem exists and it seems some of PIR motion sensors are not fully supported in Home assistant though they can be integrated. Previously I thought I could solve this by upgrading the Home assistant version, now I’m running the latest version (2024.4.2), the problem still persists.

To temporarily fix the problem, you may try to create a new automation for each PIR sensors, the specific automation should set the PIR sensor’s status automatically in every minute after motion is detected.

To create this automation, it’s mandatory to use and enable python script in your Home assistant.

Firstly, edit the configuration.yaml file and adding “python_script:” to it. Then, you need to install hass_py-set_state manually or through HACS, the script and tutorial can be found here: https://github.com/xannor/hass_py_set_state

The next, restart your home assistant, therefore those changes can take effect. After the restart, you’re ready to create the automation.

The automation example shows below:

Automation to set PIR sensor entity state

The YAML code:

alias: Masterbed PIR Reset
description: ""
trigger:
- platform: time_pattern
minutes: "*"
condition:
- condition: state
entity_id: binary_sensor.masterbed_pir_motion
state: "on"
action:
- service: python_script.set_state
data_template:
entity_id: binary_sensor.masterbed_pir_motion
state: "off"
mode: single

Comments

Write Comment