Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MOES Motion Sensor Smart Switch #2087

Merged
merged 6 commits into from
Jul 27, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions custom_components/tuya_local/devices/moes_motionsensor_switch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Example DPS Status
# {"dps": { "1": false, "14": "memory", "15": "relay", "43": false, "44": "on",
# "45": "default", "46": true, "47": "on", "48": "high", "49": 3600, "101": 0,
# "102": 0}
# Additional DPS 44 "Illuminance State" and 47 "Motion State". I couldn't
# figure out what those did, device debugger appears to indicate that these
# were set exactly once (to "on") when the switch was powered on and does NOT
# seem to trigger or respond when Illuminance or Motion trigger is met, but
# maybe I just don't know how to check that well. A final DPS shows up only in
# the Tuya Cloud API: 103 "Timer". There are "timers" in the Smart Life App for
# this device but I couldn't figure out how they work.
# Illuminance Switch: Enables/disables illuminance threshold for motion
# activation
# Motion Switch: Enables/disables motion-triggered switch
# Motion Auto-Off Delay: Time in seconds after which to turn off light if
# triggered by motion
# Appointment Time: Time of day in minutes when motion switch stops activating,
# 0 for always
# Target Time: Time of day in minutes when motion switch can activate, 0 for
# always
name: MOES Motion Sensor Smart Switch
products:
- id: vd5jgg8vgdbaqerq
make-all marked this conversation as resolved.
Show resolved Hide resolved
primary_entity:
entity: switch
dps:
- id: 1
name: switch
type: boolean
make-all marked this conversation as resolved.
Show resolved Hide resolved
secondary_entities:
- entity: select
category: config
name: Restore power state
Copy link
Owner

Choose a reason for hiding this comment

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

This common config option is usually given the name "Initial state" with options "On", "Off" and "Last state". Following that naming will help when these common controls get translated in future.

dps:
- id: 14
name: option
type: string
mapping:
- dps_val: memory
value: Remember Last Status
- dps_val: "on"
value: "On"
- dps_val: "off"
value: "Off"
- entity: select
name: Indicator Light
category: config
dps:
- id: 15
name: option
type: string
mapping:
- dps_val: none
value: Indicator LED off
- dps_val: relay
value: Indicate switch on/off
- entity: switch
name: Illuminance Switch
dps:
- id: 43
name: switch
type: boolean
- entity: select
name: Illuminance Threshold
category: config
dps:
- id: 45
name: option
type: string
mapping:
- dps_val: default
value: Default Threshold
- dps_val: now
value: Current Illuminance
- entity: switch
name: Motion Switch
dps:
- id: 46
name: switch
type: boolean
- entity: select
name: Motion Sensitivity
category: config
dps:
- id: 48
name: option
type: string
mapping:
- dps_val: "low"
value: "Low"
- dps_val: "middle"
value: "Medium"
- dps_val: "high"
value: "High"
- entity: number
name: Motion Auto-Off Delay
category: config
dps:
- id: 49
name: value
type: integer
unit: s
range:
min: 5
max: 3600
- entity: number
name: Appointment Time
Copy link
Owner

Choose a reason for hiding this comment

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

More obvious naming is needed for these two times. I would never guess that "Appointment" is the end of allowed hours, and "Target" is the beginning. Maybe "Sensing start time" and "Sensing end time" would be better.
I would also add the following to make the display in hours rather than minutes, so for example 7pm shows as "19.0" rather than "1140". 7:30 will show as "19.5", which isn't ideal, but I think still better than "1170".

          mapping:
            - scale: 60

category: config
dps:
- id: 101
name: value
type: integer
unit: min
range:
min: 0
max: 1440
- entity: number
name: Target Time
category: config
dps:
- id: 102
name: value
type: integer
unit: min
range:
min: 0
max: 1440