From 8a0dec55ebf945ae7228e2bd74aa409b19081ec2 Mon Sep 17 00:00:00 2001 From: janbajc Date: Tue, 9 Sep 2025 11:28:37 +0200 Subject: [PATCH 1/6] Add shelly wave motion driver --- .../SmartThings/zwave-sensor/fingerprints.yml | 6 +- .../profiles/shelly-wave-motion.yml | 58 +++++++++++++++++ drivers/SmartThings/zwave-sensor/src/init.lua | 3 +- .../zwave-sensor/src/preferences.lua | 15 ++++- .../src/shelly-wave-motion/init.lua | 64 +++++++++++++++++++ 5 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml create mode 100644 drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua diff --git a/drivers/SmartThings/zwave-sensor/fingerprints.yml b/drivers/SmartThings/zwave-sensor/fingerprints.yml index 7a26909ecb..727f02a2d6 100644 --- a/drivers/SmartThings/zwave-sensor/fingerprints.yml +++ b/drivers/SmartThings/zwave-sensor/fingerprints.yml @@ -542,12 +542,12 @@ zwaveManufacturer: productType: 0x0000 productId: 0x0001 deviceProfileName: base-water - - id: 1120/256/130 + - id: shelly/wave/motion deviceLabel: Shelly Wave Motion manufacturerId: 0x0460 - productId: 0x0082 productType: 0x0100 - deviceProfileName: motion-battery-illuminance + productId: 0x0082 + deviceProfileName: shelly-wave-motion zwaveGeneric: - id: "GenericSensorAlarm" deviceLabel: Z-Wave Sensor diff --git a/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml b/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml new file mode 100644 index 0000000000..afb9b5574c --- /dev/null +++ b/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml @@ -0,0 +1,58 @@ +name: shelly-wave-motion +components: +- id: main + capabilities: + - id: motionSensor + version: 1 + - id: illuminanceMeasurement + version: 1 + config: + values: + - key: "illuminance.value" + range: [0, 10000] + - id: battery + version: 1 + - id: refresh + version: 1 + categories: + - name: ContactSensor +preferences: + - name: "ledOpnClsChangeStat" + title: "P157: open/close change status" + description: "This parameter enables open/close status change by LED indicator." + required: false + preferenceType: enumeration + definition: + options: + 0 : "LED ind.disabled" + 1 : "LED ind.enabled" + default: 0 + - name: "sensitivity" + title: "P158: sensitivity" + description: "Senitivity" + required: false + preferenceType: enumeration + definition: + options: + 0 : "low sensitivity" + 1 : "moderate sensitivity" + 2 : "high sensitivity" + default: 0 + - name: "blindTime" + title: "P159: Motion Blind time" + description: "Blind time in seconds after last detected motion" + required: false + preferenceType: integer + definition: + minimum: 2 + maximum : 8 + default: 5 + - name: "motionNotdetRepT" + title: "P160:Motion not detect.rep.time" + description: "Time after last detected motion for device to send motion not detected" + required: false + preferenceType: integer + definition: + minimum: 1 + maximum : 32767 + default: 30 \ No newline at end of file diff --git a/drivers/SmartThings/zwave-sensor/src/init.lua b/drivers/SmartThings/zwave-sensor/src/init.lua index 8ad801de9e..1210ef2ac7 100644 --- a/drivers/SmartThings/zwave-sensor/src/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/init.lua @@ -152,7 +152,8 @@ local driver_template = { lazy_load_if_possible("v1-contact-event"), lazy_load_if_possible("timed-tamper-clear"), lazy_load_if_possible("wakeup-no-poll"), - lazy_load_if_possible("apiv6_bugfix") + lazy_load_if_possible("apiv6_bugfix"), + lazy_load_if_possible("shelly-wave-motion") }, lifecycle_handlers = { added = added_handler, diff --git a/drivers/SmartThings/zwave-sensor/src/preferences.lua b/drivers/SmartThings/zwave-sensor/src/preferences.lua index 48ee75d78e..4921a996bf 100644 --- a/drivers/SmartThings/zwave-sensor/src/preferences.lua +++ b/drivers/SmartThings/zwave-sensor/src/preferences.lua @@ -148,7 +148,20 @@ local devices = { ledLowBrightness = {parameter_number = 82, size = 2}, ledHighBrightness = {parameter_number = 83, size = 2} } - } + }, + SHELLY_WAVE_MOTION_SENSOR = { + MATCHING_MATRIX = { + mfrs = 0x0460, + product_types = 0x0100, + product_ids = {0x0082} + }, + PARAMETERS = { + ledOpnClsChangeStat = {parameter_number = 157, size = 1}, + sensitivity = {parameter_number = 158, size = 1}, + blindTime = {parameter_number = 159, size = 2}, + motionNotdetRepT = {parameter_number = 160, size = 2}, + }, + }, } local preferences = {} diff --git a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua new file mode 100644 index 0000000000..1e24366763 --- /dev/null +++ b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua @@ -0,0 +1,64 @@ +-- Copyright 2022 SmartThings +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +local capabilities = require "st.capabilities" +-- @type st.zwave.CommandClass +local cc = require "st.zwave.CommandClass" +-- @type st.zwave.CommandClass.Notification +local Configuration = (require "st.zwave.CommandClass.Configuration")({version=4}) +-- @type st.zwave.CommandClass.Alarm +local Alarm = (require "st.zwave.CommandClass.Alarm")({ version = 1 }) +-- @type st.zwave.CommandClass.Association +local Notification = (require "st.zwave.CommandClass.Notification")({ version = 3 }) +-- @type st.zwave.CommandClass.SensorMultilevel +local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({ version = 5 }) +-- @type st.utils +local utils = require "st.utils" + +local WAVE_MOTION_SENSOR_FINGERPRINTS = { + { manufacturerId = 0x0460, prod = 0x0100, productId = 0x0082 } -- Shelly Wave Motion +} + +local function notification_report_handler(self, device, cmd) + local event + if cmd.args.notification_type == Notification.notification_type.HOME_SECURITY then + if cmd.args.event == Notification.event.home_security.STATE_IDLE then + device:emit_event(capabilities.motionSensor.motion.inactive()) + elseif cmd.args.event == Notification.event.home_security.MOTION_DETECTION then + event = capabilities.motionSensor.motion.active() + end + end + + if event ~= nil then + device:emit_event(event) + end +end + +local function sensor_multilevel_report_handler(self, device, cmd) + if cmd.args.sensor_type == SensorMultilevel.sensor_type.LUMINANCE then + device:emit_event(capabilities.illuminanceMeasurement.illuminance({value = cmd.args.sensor_value, unit = "lux"})) + end +end + +local wave_motion_sensor = { + zwave_handlers = { + [cc.NOTIFICATION] = { + [Notification.REPORT] = notification_report_handler + }, + [cc.SENSOR_MULTILEVEL] = { + [SensorMultilevel.REPORT] = sensor_multilevel_report_handler + }, + }, +} +return wave_motion_sensor \ No newline at end of file From 8b6be5d03d44c00289f3aba80f1fd0f64398776a Mon Sep 17 00:00:00 2001 From: janbajc Date: Tue, 9 Sep 2025 11:32:50 +0200 Subject: [PATCH 2/6] Trigger CLA check From 8e69815d91d98378d5da1e92b5e4db4c838f0461 Mon Sep 17 00:00:00 2001 From: janbajc Date: Tue, 9 Sep 2025 12:24:50 +0200 Subject: [PATCH 3/6] Update copyright year --- .../SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua index 1e24366763..08ff22be2c 100644 --- a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua @@ -1,4 +1,4 @@ --- Copyright 2022 SmartThings +-- Copyright 2025 SmartThings -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. From 85f2acfa9330bbbd8fbf9ad4c0790fda0ce2f5d4 Mon Sep 17 00:00:00 2001 From: janbajc <63789839+janbajc@users.noreply.github.com> Date: Mon, 15 Sep 2025 07:16:45 +0200 Subject: [PATCH 4/6] Update drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml Co-authored-by: Steven Green --- .../SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml b/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml index afb9b5574c..5bbeab8ee5 100644 --- a/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml +++ b/drivers/SmartThings/zwave-sensor/profiles/shelly-wave-motion.yml @@ -29,7 +29,8 @@ preferences: default: 0 - name: "sensitivity" title: "P158: sensitivity" - description: "Senitivity" + description: "Sensitivity" + required: false preferenceType: enumeration definition: From 4541c1163f101ad65c526b01e908b5dabab568af Mon Sep 17 00:00:00 2001 From: janbajc Date: Tue, 16 Sep 2025 13:06:06 +0200 Subject: [PATCH 5/6] Remove unnecessary handlers --- .../src/shelly-wave-motion/init.lua | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua index 08ff22be2c..73749f15d5 100644 --- a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua @@ -30,27 +30,6 @@ local WAVE_MOTION_SENSOR_FINGERPRINTS = { { manufacturerId = 0x0460, prod = 0x0100, productId = 0x0082 } -- Shelly Wave Motion } -local function notification_report_handler(self, device, cmd) - local event - if cmd.args.notification_type == Notification.notification_type.HOME_SECURITY then - if cmd.args.event == Notification.event.home_security.STATE_IDLE then - device:emit_event(capabilities.motionSensor.motion.inactive()) - elseif cmd.args.event == Notification.event.home_security.MOTION_DETECTION then - event = capabilities.motionSensor.motion.active() - end - end - - if event ~= nil then - device:emit_event(event) - end -end - -local function sensor_multilevel_report_handler(self, device, cmd) - if cmd.args.sensor_type == SensorMultilevel.sensor_type.LUMINANCE then - device:emit_event(capabilities.illuminanceMeasurement.illuminance({value = cmd.args.sensor_value, unit = "lux"})) - end -end - local wave_motion_sensor = { zwave_handlers = { [cc.NOTIFICATION] = { From be963bc463e203ab6ae7298bfa64a26f29eb5e43 Mon Sep 17 00:00:00 2001 From: janbajc <63789839+janbajc@users.noreply.github.com> Date: Wed, 17 Sep 2025 07:49:08 +0200 Subject: [PATCH 6/6] Delete drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua --- .../src/shelly-wave-motion/init.lua | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua diff --git a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua b/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua deleted file mode 100644 index 73749f15d5..0000000000 --- a/drivers/SmartThings/zwave-sensor/src/shelly-wave-motion/init.lua +++ /dev/null @@ -1,43 +0,0 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. - -local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass -local cc = require "st.zwave.CommandClass" --- @type st.zwave.CommandClass.Notification -local Configuration = (require "st.zwave.CommandClass.Configuration")({version=4}) --- @type st.zwave.CommandClass.Alarm -local Alarm = (require "st.zwave.CommandClass.Alarm")({ version = 1 }) --- @type st.zwave.CommandClass.Association -local Notification = (require "st.zwave.CommandClass.Notification")({ version = 3 }) --- @type st.zwave.CommandClass.SensorMultilevel -local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({ version = 5 }) --- @type st.utils -local utils = require "st.utils" - -local WAVE_MOTION_SENSOR_FINGERPRINTS = { - { manufacturerId = 0x0460, prod = 0x0100, productId = 0x0082 } -- Shelly Wave Motion -} - -local wave_motion_sensor = { - zwave_handlers = { - [cc.NOTIFICATION] = { - [Notification.REPORT] = notification_report_handler - }, - [cc.SENSOR_MULTILEVEL] = { - [SensorMultilevel.REPORT] = sensor_multilevel_report_handler - }, - }, -} -return wave_motion_sensor \ No newline at end of file