hacs-hubitat icon indicating copy to clipboard operation
hacs-hubitat copied to clipboard

Ability to Set Motion on Presence Sensor Not Available

Open ajtatum opened this issue 4 months ago • 1 comments

I don't think this is a bug, but a feature request (or info on how to accomplish it). I have a Tuya TS0225_LINPTECH 24Ghz Human Presence Detector and it normally works great, except for when the window is open, as then it fails to turn off the lights because the blinds move a tab. I want to create an automation for when I put a window sensor in that works in tandem with the door sensor so that the lights turn off after the door is open for a period of time when the window is open.

However, I also need to clear the presence sensor's motion state so that it doesn't read "active" anymore.

The driver that I'm using allows for me to set the motion status in Hubitat. On the Hubitat forums, someone suggested that via Hubitat I could create an automation that runs the command setMotion('clear') on the device; but when I try to send that command via Home Assistant, I get the error, "Failed to perform the action hubitat.send_command. Unknown error".

Below is the JSON of the device and I was curious if it would be possible to create a switch for the device that would essentially toggle on/off the device's motion state, and then could be used in an automation in Home Assistant.

Would that be possible/feasible? If so, I'd greatly appreciate it. If you need more information, please let me know!

Thanks, AJ

{
    "id": "22",
    "name": "Tuya TS0225_LINPTECH 24Ghz Human Presence Detector",
    "label": "Bathroom Presence Sensor",
    "type": "Tuya Zigbee mmWave Sensor",
    "room": "Basement Bathroom",
    "attributes": [
        {
            "name": "motionDetectionSensitivity",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "fadingTime",
            "currentValue": "5",
            "dataType": "DECIMAL"
        },
        {
            "name": "healthStatus",
            "currentValue": "online",
            "dataType": "ENUM",
            "values": [
                "unknown",
                "offline",
                "online"
            ]
        },
        {
            "name": "radarStatus",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "checking",
                "check_success",
                "check_failure",
                "others",
                "comm_fault",
                "radar_fault"
            ]
        },
        {
            "name": "motion",
            "currentValue": "inactive",
            "dataType": "ENUM",
            "values": [
                "inactive",
                "active"
            ]
        },
        {
            "name": "smallMotionDetectionSensitivity",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "rtt",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "distance",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "humanMotionState",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "none",
                "moving",
                "small_move",
                "stationary",
                "static",
                "presence",
                "peaceful",
                "large_move"
            ]
        },
        {
            "name": "motionDetectionMode",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "0 - onlyPIR",
                "1 - PIRandRadar",
                "2 - onlyRadar"
            ]
        },
        {
            "name": "illumState",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "dark",
                "light",
                "unknown"
            ]
        },
        {
            "name": "keepTime",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "10 seconds",
                "30 seconds",
                "60 seconds",
                "120 seconds"
            ]
        },
        {
            "name": "detectionDelay",
            "currentValue": null,
            "dataType": "DECIMAL"
        },
        {
            "name": "WARNING",
            "currentValue": null,
            "dataType": "STRING"
        },
        {
            "name": "unacknowledgedTime",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "staticDetectionSensitivity",
            "currentValue": 3,
            "dataType": "NUMBER"
        },
        {
            "name": "batteryVoltage",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "illuminance",
            "currentValue": 38,
            "dataType": "NUMBER"
        },
        {
            "name": "batteryVoltage",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "occupiedTime",
            "currentValue": 0,
            "dataType": "NUMBER"
        },
        {
            "name": "powerSource",
            "currentValue": "dc",
            "dataType": "ENUM",
            "values": [
                "battery",
                "dc",
                "mains",
                "unknown"
            ]
        },
        {
            "name": "radarAlarmMode",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "0 - arm",
                "1 - off",
                "2 - alarm",
                "3 - doorbell"
            ]
        },
        {
            "name": "checkInterval",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "staticDetectionDistance",
            "currentValue": null,
            "dataType": "DECIMAL"
        },
        {
            "name": "Status",
            "currentValue": "clear",
            "dataType": "STRING"
        },
        {
            "name": "battery",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "maximumDistance",
            "currentValue": "2.25",
            "dataType": "DECIMAL"
        },
        {
            "name": "absenceTime",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "radarAlarmVolume",
            "currentValue": null,
            "dataType": "ENUM",
            "values": [
                "0 - low",
                "1 - medium",
                "2 - high",
                "3 - mute"
            ]
        },
        {
            "name": "minimumDistance",
            "currentValue": null,
            "dataType": "DECIMAL"
        },
        {
            "name": "healthStatus",
            "currentValue": "online",
            "dataType": "ENUM",
            "values": [
                "offline",
                "online"
            ]
        },
        {
            "name": "lastBattery",
            "currentValue": null,
            "dataType": "DATE"
        },
        {
            "name": "motionDetectionDistance",
            "currentValue": "unknown",
            "dataType": "DECIMAL"
        },
        {
            "name": "ledIndicator",
            "currentValue": null,
            "dataType": "NUMBER"
        },
        {
            "name": "radarSensitivity",
            "currentValue": 3,
            "dataType": "NUMBER"
        }
    ],
    "capabilities": [
        "MotionSensor",
        {
            "attributes": [
                {
                    "name": "motion",
                    "dataType": null
                }
            ]
        },
        "Configuration",
        "PowerSource",
        {
            "attributes": [
                {
                    "name": "powerSource",
                    "dataType": null
                }
            ]
        },
        "Refresh",
        "Battery",
        {
            "attributes": [
                {
                    "name": "battery",
                    "dataType": null
                }
            ]
        },
        "IlluminanceMeasurement",
        {
            "attributes": [
                {
                    "name": "illuminance",
                    "dataType": null
                }
            ]
        },
        "HealthCheck",
        {
            "attributes": [
                {
                    "name": "checkInterval",
                    "dataType": null
                }
            ]
        }
    ],
    "commands": [
        "configure",
        "configure",
        "ping",
        "refresh",
        "sendCommand",
        "setMotion",
        "setPar"
    ]
}

ajtatum avatar Sep 29 '24 18:09 ajtatum