Skip to content

Tuya Zigbee mmWave Sensor

kkossev edited this page Jun 13, 2024 · 14 revisions

last edited 2024-05-20

Why a new driver?

As announced earlier, the size of the "Tuya Multi-Sensor 4 In 1" driver became too large, and it is impossible to add new devices to it. All the support for the mmWave sensors is now moved to this new drver.

Any improvements and new models will be added to this new driver only. The old 4-in-1 code is in the process of stripping down to support only the basic 'motion active' / 'motion inactive' events without any extra features. I must do this to free up code space for adding new Tuya PIR motion sensor models into the 4-in-1 driver. If someone accidentally updates the old 4-in-1 driver, there will be a warning and link to instructions on transitioning to the new mmWave sensors driver.**

Installation as a new driver

Please use the community Hubitat Package Manager (HPM) to install the new driver - search for 'Tuya Zigbee mmWave Sensor'. Once installed using HPM, please update to the latest development branch version manually.

MatchUp in HPM

If you have already installed this driver manually, do a 'MatchUp' in HPM. In case of problems, see this link.

Updating the driver

To update to the latest developments branch version, follow the procedure described here.

Driver structure

To easily handle a dozen different Tuya mmWave sensors, all devices are described as static data structures called 'Device Profile.' When a detailed documentation (WIP) is available sometime in the future, it may become possible that the adding of new 'presence' sensors be done by experienced Hubitat users, with little or no knowledge of Groovy... (dreaming)

This is a rather complex driver, including several libraries that are shared with many other drivers that I wrote. To avoid the DLL hell, the driver is distributed as a single Groovy file, with all the libraries included.

Supported mmWave sensors

The currently supported mmWave sensors list is available in the second post in the Hubitat Community forum thread.

Configuration

  • If the driver was installed prior to pairing the new mmWave device, the configuration will be automatic.
  • If the driver was manually changed (upgrading from the 4-in-1 driver), the configuration should be automatic as well.
  • In case you want to start fresh:
  1. Select 'LOAD ALL DEFAULTS' from the Configure command drop-down menu.
  2. Click on the 'Configure' button

image

If the device is supported, it will be recognized automatically. This can be verified by checking the 'device profile' (after refreshing the web page!)

image

If the device profile is shown as 'UNKNOWN' - the fingerprint of your mmWave sensor is currently not in the driver. Please check the Troubleshooting section below for hints on how to proceed.

Current States

The 'Current States' in the device web page will show different attributes, depending on the particular type of your device.

image

These are the common attributes that are used with all types of devices:

  • Status - an informative text message that will stay for 60 seconds on the HE device web page and then will be reset to 'clear'

  • healthStatus - online / offline

  • illuminance - the illuminance in lux (if supported by the device)

  • motion - the motion state (wrongly advertised as a 'presence') reported by the mmWave sensor

  • distance - if enabled, the distance to the moving object, as reported by the sensor. Caution: if the distance is not used in any automation rules in HE (RM5, WebCoRE..) it is advised to keep the distance reporting switched off (this is the default setting)

  • rtt - the Round-Trip Time measured when the ping() button is clicked. If there is no communication to the device, this attribute will show 'timeout'

Commands

The following commands are available for the HE device web page :

image

  • 'Configure': It is normally not necessary to configure anything if the driver successfully recognizes the device automatically. The following functions are available :
    • 'Configure the device' - this function is invoked and is most effective when the device is paired to the HE hub. Some Tuya devices will ignore the 'Tuya Magic' spells if the configuration commands are not sent immediately after the device joins the Zigbee coordinator. In other words, 'Configure' does nothing with Tuya mmWave sensors.
    • 'Reset Statistics' - resets the State Variables 'stats' data. Note, that you can automate the statistics reset using an RM5 rule - custom command 'Configure' with a string parameter 'resetStats'
    • 'Delete All Preferences' - removes all Preferences. Useful when changing between different drivers.
    • 'Delete All Current States' - removes all Current States. Useful when changing between different drivers.
    • 'Delete All Scheduled Jobs' - unscheduled all scheduled jobs. Useful when changing between different drivers.
    • 'Delete All State Variables' -removes all state variables. Useful when changing between different drivers.
    • 'Delete All Child Devices' - removes all child devices (eventually created by another driver).
    • 'LOAD ALL DEFAULTS' - performs all of the above.
  • Ping - sends a simple Zigbee command to the device and measures the time between sending the command and receiving the answer - the Round-Trip Time (RTT). The time is measured in milliseconds. If the device is offline (or is a sleepy device that does not answer Zigbee commands), then the RTT attribute will show timeout!. The maximum time that the driver waits for an answer is 10 seconds.
  • 'Refresh' - sends a set of 'read parameters' commands to the device. What parameters will be refreshed is device specific. Note, that if the actual device parameters differ from what is configured in the Preferences section, the preferences will be updated with the actual parameters values!
  • 'Send Command'- sends a command to the device, different for each model. Click on the button without a parameter to see a list of the possible commands in the live logs tab.
  • 'Set Motion' - 'digitally' sets the motion attribute to active or inactive. Select the action from the dropdown menu first, then click on the button above.
  • 'Set Par' - dynamically sets a parameter (preference). For details see this Wiki Page.

State Variables

The State Variables are intended for internal driver use. Often, checking these internal variables values help in the troubleshooting process:

  • deviceType : mmWaveSensor - hardcoded for this driver.

  • deviceProfile : TS0601_TUYA_RADAR - this is the DeviceProfile name, as determined automatically by the driver or as set (forced) manually from the Advanced Settings preference.

  • lastTx : {cmdTime=1715099000199, pingTime=1715099000187} - cmdTime: the time when any command was sent from this driver to the device (in Unix timestamp format); pingTime: the time when the last ping command was sent.

  • lastRx : {checkInTime=1715090444481, illumTime=1715090425435} - checkInTime: the time (in Unix format) when the last Tuya check-in messages was received; illumTime: the time when the illuminance was last reported.

  • stats : {cfgCtr=1, pingsMax=122, rxCtr=4089, pingsMin=76, pingsAvg=91, txCtr=15, pingsOK=3, pingsFail=0, illumCtr=115} - cfgCtr: how many times the devices was configured, pingsMax: the maximum ping response time in milliseconds; rxCtr: the total number of the received Zigbee messages; pingsMin: the minimum ping response time; pingsAvg: the rolling average ping response time in milliseconds; txCtr: the total number of the sent Zigbee messages; pingsOK: the number of the successful pings; pingsFail: the number of the failed pings (timeouts); illumCtr: the number of the illuminance (lux) reports.

  • driverVersion : 3.1.2 2024/05/06 10:59 AM (TS0601 _TZE204_ztc6ggyl) (C-8 Pro 2.3.9.118) - driver version, compile date and time, Zigbee model and manufacturer, Hubitat hub model, Hubitat platform cersion.

  • health : {checkCtr3=0, offlineCtr=0} - checkCtr3: internal temporary variable; offlineCtr: how many times the device has felt offline.

  • motionStarted : 2024-05-07 16:59:56.886 - the time of the last motion active event.

  • states: {isRefresh=false, isDigital=false, isPing=false} - variables for internal use.

Preferences

The Preferences section will vary depending on the mmWave DeviceProfile - the different devices have different parameters.The screenshot below is taken from the most popular 5.8 Ghz ZY-M1 radar:

image

  • Info - 'For more info, click on this link to visit the WiKi page' will open a new tab in the browser opening this WiKi page.

  • Enable descriptionText logging - enabled by default.

  • Enable debug logging - disabled by default. When flipped, the debug logging will automatically switch off after 24 hours. CAUTION! Some radars are very chatty.. enable the debug logs only when really needed or asked by developer!

  • Lux threshold - sets the minimum illuminance change that will be sent as an event.

  • Illuminance Correction Coefficient - illuminance correction - the reported value will be multiplied by this coefficient.

  • Ignore distance reports - default disabled. The distance reports are sent

  • Radar sensitivity, Detection delay, Fading time, Minimim detection distance, Maximum detection distance - device specific settings.

  • Device Profile

  • Advanced Options

  • Healthcheck Method

  • Healthcheck Interval

  • Enable trace logging

  • Status attribute for Devices/Rooms

Troubleshooting

  • healthStatus online/offline : (link)

Adding new mmWave sensor models/manufacturers

... to be continued ...


back to https://github.com/kkossev/Hubitat/wiki