-
Notifications
You must be signed in to change notification settings - Fork 529
add multiir_motion_MIR-IR100 #2861
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
Open
thinkaName
wants to merge
1
commit into
SmartThingsCommunity:main
Choose a base branch
from
thinkaName:multiir_motion_MIR-IR100
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...-motion-sensor/profiles/motion-battery-illuminance-sensitivity-frequency-no-fw-update.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: motion-battery-illuminance-sensitivity-frequency-no-fw-update | ||
| components: | ||
| - id: main | ||
| capabilities: | ||
| - id: motionSensor | ||
| version: 1 | ||
| - id: illuminanceMeasurement | ||
| version: 1 | ||
| - id: stse.sensitivityAdjustment | ||
| version: 1 | ||
| - id: battery | ||
| version: 1 | ||
| - id: refresh | ||
| version: 1 | ||
| categories: | ||
| - name: MotionSensor | ||
| preferences: | ||
| - title: "检测频率/秒(detection frequency/sec)" | ||
| name: detectionfrequency | ||
| description: "传感器检测频率(Sensor detects frequency unit: seconds)" | ||
| required: false | ||
| preferenceType: integer | ||
| definition: | ||
| minimum: 10 | ||
| maximum: 1800 | ||
| default: 60 | ||
13 changes: 13 additions & 0 deletions
13
drivers/SmartThings/zigbee-motion-sensor/src/MultiIR/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| return function(opts, driver, device, ...) | ||
| local FINGERPRINTS = require "MultiIR.fingerprints" | ||
| for _, fingerprint in ipairs(FINGERPRINTS) do | ||
| if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then | ||
| local subdriver = require("MultiIR") | ||
| return true, subdriver | ||
| end | ||
| end | ||
| return false | ||
| end |
6 changes: 6 additions & 0 deletions
6
drivers/SmartThings/zigbee-motion-sensor/src/MultiIR/fingerprints.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| return { | ||
| { mfr = "MultIR", model = "MIR-IR100" } | ||
| } |
117 changes: 117 additions & 0 deletions
117
drivers/SmartThings/zigbee-motion-sensor/src/MultiIR/init.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| -- Copyright 2026 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local zcl_clusters = require "st.zigbee.zcl.clusters" | ||
| local capabilities = require "st.capabilities" | ||
| local data_types = require "st.zigbee.data_types" | ||
| local FrameCtrl = require "st.zigbee.zcl.frame_ctrl" | ||
| local zcl_messages = require "st.zigbee.zcl" | ||
| local messages = require "st.zigbee.messages" | ||
| local zb_const = require "st.zigbee.constants" | ||
|
|
||
| local sensitivityAdjustment = capabilities["stse.sensitivityAdjustment"] | ||
| local sensitivityAdjustmentCommandName = "setSensitivityAdjustment" | ||
| local IASZone = zcl_clusters.IASZone | ||
| local IASZone_PRIVATE_COMMAND_ID = 0xF4 | ||
|
|
||
| local PREF_SENSITIVITY_VALUE_HIGH = 3 | ||
| local PREF_SENSITIVITY_VALUE_MEDIUM = 2 | ||
| local PREF_SENSITIVITY_VALUE_LOW = 1 | ||
|
|
||
| local function send_iaszone_private_cmd(device, priv_cmd, data) | ||
| local frame_ctrl = FrameCtrl(0x00) | ||
| frame_ctrl:set_cluster_specific() | ||
|
|
||
| local zclh = zcl_messages.ZclHeader({ | ||
| frame_ctrl = frame_ctrl, | ||
| cmd = data_types.ZCLCommandId(priv_cmd) | ||
| }) | ||
|
|
||
| local message_body = zcl_messages.ZclMessageBody({ | ||
| zcl_header = zclh, | ||
| zcl_body = data_types.Uint16(data) | ||
| }) | ||
|
|
||
| local addr_header = messages.AddressHeader( | ||
| zb_const.HUB.ADDR, | ||
| zb_const.HUB.ENDPOINT, | ||
| device:get_short_address(), | ||
| device:get_endpoint(IASZone.ID), | ||
| zb_const.HA_PROFILE_ID, | ||
| IASZone.ID | ||
| ) | ||
|
|
||
| local zigbee_msg = messages.ZigbeeMessageTx({ | ||
| address_header = addr_header, | ||
| body = message_body | ||
| }) | ||
|
|
||
| device:send(zigbee_msg) | ||
| end | ||
|
|
||
| local function iaszone_attr_sen_handler(driver, device, value, zb_rx) | ||
| if value.value == PREF_SENSITIVITY_VALUE_HIGH then | ||
| device:emit_event(sensitivityAdjustment.sensitivityAdjustment.High()) | ||
| elseif value.value == PREF_SENSITIVITY_VALUE_MEDIUM then | ||
| device:emit_event(sensitivityAdjustment.sensitivityAdjustment.Medium()) | ||
| elseif value.value == PREF_SENSITIVITY_VALUE_LOW then | ||
| device:emit_event(sensitivityAdjustment.sensitivityAdjustment.Low()) | ||
| end | ||
| end | ||
|
|
||
| local function send_sensitivity_adjustment_value(device, value) | ||
| device:send(IASZone.attributes.CurrentZoneSensitivityLevel:write(device, value)) | ||
| end | ||
|
|
||
| local function sensitivity_adjustment_capability_handler(driver, device, command) | ||
| local sensitivity = command.args.sensitivity | ||
| if sensitivity == 'High' then | ||
| send_sensitivity_adjustment_value(device, PREF_SENSITIVITY_VALUE_HIGH) | ||
| elseif sensitivity == 'Medium' then | ||
| send_sensitivity_adjustment_value(device, PREF_SENSITIVITY_VALUE_MEDIUM) | ||
| elseif sensitivity == 'Low' then | ||
| send_sensitivity_adjustment_value(device, PREF_SENSITIVITY_VALUE_LOW) | ||
| end | ||
| device:send(IASZone.attributes.CurrentZoneSensitivityLevel:read(device)) | ||
| end | ||
|
|
||
| local function added_handler(self, device) | ||
| device:emit_event(capabilities.motionSensor.motion.inactive()) | ||
| device:emit_event(sensitivityAdjustment.sensitivityAdjustment.High()) | ||
| device:emit_event(capabilities.battery.battery(100)) | ||
| device:send(IASZone.attributes.CurrentZoneSensitivityLevel:read(device)) | ||
| end | ||
|
|
||
| local function info_changed(driver, device, event, args) | ||
| for name, value in pairs(device.preferences) do | ||
| if (device.preferences[name] ~= nil and args.old_st_store.preferences[name] ~= device.preferences[name]) then | ||
| if (name == "detectionfrequency") then | ||
| local detectionfrequency = tonumber(device.preferences.detectionfrequency) | ||
| send_iaszone_private_cmd(device, IASZone_PRIVATE_COMMAND_ID, detectionfrequency) | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| local MultiIR_motion_handler = { | ||
| NAME = "MultiIR motion handler", | ||
| lifecycle_handlers = { | ||
| added = added_handler, | ||
| infoChanged = info_changed | ||
| }, | ||
| capability_handlers = { | ||
| [sensitivityAdjustment.ID] = { | ||
| [sensitivityAdjustmentCommandName] = sensitivity_adjustment_capability_handler, | ||
| } | ||
| }, | ||
| zigbee_handlers = { | ||
| attr = { | ||
| [IASZone.ID] = { | ||
| [IASZone.attributes.CurrentZoneSensitivityLevel.ID] = iaszone_attr_sen_handler | ||
| } | ||
| } | ||
| }, | ||
| can_handle = require("MultiIR.can_handle") | ||
| } | ||
|
|
||
| return MultiIR_motion_handler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have the FW update capability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the product does not have the firmware update function and version information reporting capabilities. If this capability is added to the profile, the test for this capability in the SmartThings Developer Center Test Suite will fail.