Skip to content

Add configuration for PIR Motion Switch device#4684

Merged
make-all merged 11 commits intomake-all:mainfrom
BigGeorgeTx:patch-1
Mar 30, 2026
Merged

Add configuration for PIR Motion Switch device#4684
make-all merged 11 commits intomake-all:mainfrom
BigGeorgeTx:patch-1

Conversation

@BigGeorgeTx
Copy link
Copy Markdown
Contributor

This PR adds support for the Tuya MFA05 PIR Motion Switch (product ID iii7gagtan21i2of).

The device exposes the following DPS via the local Tuya protocol (3.3):

  • 1: Light relay switch (boolean)
  • 103: Inching mode (string)
  • 104: LED indicator (boolean)
  • 106: Motion alarm (boolean)

Motion is represented by DP 106. DP 1 is the actual relay and can be manually toggled; it may mirror motion depending on device settings, but it is not the motion state.

DP 103 is a string-based inching mode value. The device reports opaque string values (e.g., "AQJY"), so it is exposed as a text entity rather than a select.

receives DPS 1, 103, 104, and 106 from the device.

Below is the DPS cache from the Tuya Local device debug output:

"1": true,
"103": "AQJY",
"104": true,
"106": true

The included YAML definition has been tested locally in Home Assistant with Tuya Local and works reliably.

Let me know if anything needs adjustment.

This PR adds support for the Tuya MFA05 PIR Motion Switch
(product ID iii7gagtan21i2of).

The device exposes the following DPS via the local Tuya protocol (3.3):

- 1: Light relay switch (boolean)
- 103: Inching mode (string)
- 104: LED indicator (boolean)
- 106: Motion alarm (boolean)

Motion is represented by DP 106. DP 1 is the actual relay and can be
manually toggled; it may mirror motion depending on device settings,
but it is not the motion state.

DP 103 is a string-based inching mode value. The device reports opaque string values (e.g., "AQJY"), so it is exposed as a text entity rather than a select.

receives DPS 1, 103, 104, and 106 from the device.

Below is the DPS cache from the Tuya Local device debug output:

"1": true,
"103": "AQJY",
"104": true,
"106": true

The included YAML definition has been tested locally in Home Assistant
with Tuya Local and works reliably.

Let me know if anything needs adjustment.
@make-all make-all moved this from 👀 In review to 🏗 Stalled in Tuya Local Mar 12, 2026
@make-all make-all added the needs rework Rework required before merge label Mar 14, 2026
@BigGeorgeTx
Copy link
Copy Markdown
Contributor Author

My apologies. I grabbed the wrong file when I created this. Tomorrow I will try to edit the original PR.

This is the code the is working locally:

Here is the working local version:

name: Motion PIR Wall Switch

products:

  • id: iii7gagtan21i2of

entities:

  • entity: switch
    name: Lights Power
    dps:

    • id: 1
      type: boolean
      name: switch
  • entity: text
    name: Inching Mode
    dps:

    • id: 103
      type: string
      name: value # ← fixes 'value' warning
  • entity: switch
    name: LED Indicator
    dps:

    • id: 104
      type: boolean
      name: switch # ← fixes 'switch' warning
  • entity: switch
    name: Motion Alarm
    dps:

    • id: 106
      type: boolean
      name: switch
      readonly: true

Defines the Tuya MFA05 PIR Motion Wall Switch with its properties and entities.

Replaced old code I originally uploaded with what is working for me locally.  I deleted the original file, but GitHub wouldn’t let me use the same name.  I will try committing it with a 2 and then changing the name.
Rename new file to original file name.
@make-all make-all removed the needs rework Rework required before merge label Mar 22, 2026
@make-all make-all moved this from 🏗 Stalled to 👀 In review in Tuya Local Mar 22, 2026
# 104 - LED Indicator (boolean)
# 106 - Motion Alarm (boolean, readonly)

name: Motion PIR Wall Switch
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep device names short, as they are prepended in some places in the HA UI. Motion and PIR are redundant, so pick one.

You also need to follow HA naming convention of only capitalising the first word of device and entity names (unless there are abbreviations like PIR).

name: Motion PIR Wall Switch
products:
- id: iii7gagtan21i2of
name: MFA05
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is model, not name.


entities:
- entity: switch
name: Lights Power
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it a light entity, and there is no need for a name

name: value

- entity: switch
name: LED Indicator
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard pattern here is to use a light entity, with translation_key: indicator

name: switch

- entity: switch
name: Motion Alarm (Raw)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What information is (Raw) in the name trying to convey?

This should be a binary_sensor, with class: motion (and no name needed in that case)

@github-project-automation github-project-automation bot moved this from 👀 In review to 📋 Backlog in Tuya Local Mar 24, 2026
@make-all make-all moved this from 📋 Backlog to 🏗 Stalled in Tuya Local Mar 24, 2026
Delete file that will be replaced be one with a better name and incorpating the requested changes.
Upload of yaml file from HA
Changed 'device_class' to 'class' for Motion Alarm entity.
@BigGeorgeTx
Copy link
Copy Markdown
Contributor Author

BigGeorgeTx commented Mar 29, 2026

Thanks for the feedback. I have shortened the device_name, changed the name and added the manufacturer, changed it to a light entity, and made the motion switch a binary sensor, all as requested. I have tested the revised file locally in HA and it is working. I also renamed the file to try and better align with the others.

@make-all make-all moved this from 🏗 Stalled to 👀 In review in Tuya Local Mar 29, 2026
Updated naming to follow HA naming conventions, other similar devices, and reuse of translations where possible
- added category for configuration entities

PR make-all#4684
@make-all make-all merged commit a0b9f02 into make-all:main Mar 30, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Tuya Local Mar 30, 2026
make-all added a commit that referenced this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants