Add configuration for PIR Motion Switch device#4684
Conversation
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.
|
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:
entities:
|
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.
Removing blank lines
Delete old file with bad code
Rename new file to original file name.
| # 104 - LED Indicator (boolean) | ||
| # 106 - Motion Alarm (boolean, readonly) | ||
|
|
||
| name: Motion PIR Wall Switch |
There was a problem hiding this comment.
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 |
|
|
||
| entities: | ||
| - entity: switch | ||
| name: Lights Power |
There was a problem hiding this comment.
Make it a light entity, and there is no need for a name
| name: value | ||
|
|
||
| - entity: switch | ||
| name: LED Indicator |
There was a problem hiding this comment.
Standard pattern here is to use a light entity, with translation_key: indicator
| name: switch | ||
|
|
||
| - entity: switch | ||
| name: Motion Alarm (Raw) |
There was a problem hiding this comment.
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)
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.
|
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. |
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
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):
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.