-
Notifications
You must be signed in to change notification settings - Fork 516
WWSTCERT-8242 Add support to frient heat detector #2447
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
marcintyminski
wants to merge
8
commits into
SmartThingsCommunity:main
Choose a base branch
from
marcintyminski:Add-support-to-frient-heat-detector
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 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a0001e6
Add support to frient heat detector
marcintyminski 86d706b
removed whitspaces
marcintyminski 87a1f03
Merge branch 'SmartThingsCommunity:main' into Add-support-to-frient-h…
marcintyminski 3cf140d
deleted whitespace
marcintyminski b5ad14d
Merge branch 'SmartThingsCommunity:main' into Add-support-to-frient-h…
marcintyminski b1860ed
Change the tests to increase code coverage
marcintyminski b4a3695
Merge branch 'Add-support-to-frient-heat-detector' of https://github.…
marcintyminski 8d27a56
change the date in test file
marcintyminski 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
55 changes: 55 additions & 0 deletions
55
drivers/SmartThings/zigbee-smoke-detector/profiles/heat-temp-battery-alarm.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,55 @@ | ||
| name: heat-temp-battery-alarm | ||
| components: | ||
| - id: main | ||
| capabilities: | ||
| - id: temperatureAlarm | ||
| version: 1 | ||
| config: | ||
| values: | ||
| - key: "temperatureAlarm.value" | ||
| enabledValues: | ||
| - heat | ||
| - cleared | ||
| - id: temperatureMeasurement | ||
| version: 1 | ||
| - id: battery | ||
| version: 1 | ||
| - id: firmwareUpdate | ||
| version: 1 | ||
| - id: refresh | ||
| version: 1 | ||
| - id: alarm | ||
| version: 1 | ||
| config: | ||
| values: | ||
| - key: "alarm.value" | ||
| enabledValues: | ||
| - off | ||
| - siren | ||
| - key: "{{enumCommands}}" | ||
| enabledValues: | ||
| - off | ||
| - siren | ||
| categories: | ||
| - name: TempSensor | ||
| preferences: | ||
| - preferenceId: tempOffset | ||
| explicit: true | ||
| - name: "tempSensitivity" | ||
| title: "Temperature Sensitivity (°C)" | ||
| description: "Minimum change in temperature to report" | ||
| required: false | ||
| preferenceType: number | ||
| definition: | ||
| minimum: 0.1 | ||
| maximum: 2.0 | ||
| default: 1.0 | ||
| - name: "warningDuration" | ||
| title: "Alarm duration (s)" | ||
| description: "After how many seconds should the alarm turn off" | ||
| required: false | ||
| preferenceType: integer | ||
| definition: | ||
| minimum: 0 | ||
| maximum: 65534 | ||
| default: 240 |
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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ local cluster_base = require "st.zigbee.cluster_base" | |
| local Basic = zcl_clusters.Basic | ||
| local alarm = capabilities.alarm | ||
| local smokeDetector = capabilities.smokeDetector | ||
| local temperatureAlarm = capabilities.temperatureAlarm | ||
|
|
||
| local IASWD = zcl_clusters.IASWD | ||
| local IASZone = zcl_clusters.IASZone | ||
|
|
@@ -72,8 +73,15 @@ end | |
|
|
||
| local function device_added(driver, device) | ||
| device:emit_event(alarm.alarm.off()) | ||
| device:emit_event(smokeDetector.smoke.clear()) | ||
| device:send(cluster_base.read_manufacturer_specific_attribute(device, Basic.ID, DEVELCO_BASIC_PRIMARY_SW_VERSION_ATTR, DEVELCO_MANUFACTURER_CODE)) | ||
|
|
||
| if device:supports_capability(capabilities.temperatureAlarm) then | ||
| device:emit_event(temperatureAlarm.temperatureAlarm.cleared()) | ||
| end | ||
|
|
||
| if device:supports_capability(capabilities.smokeDetector) then | ||
| device:emit_event(smokeDetector.smoke.clear()) | ||
| end | ||
| device:send(cluster_base.read_manufacturer_specific_attribute(device, Basic.ID, DEVELCO_BASIC_PRIMARY_SW_VERSION_ATTR, DEVELCO_MANUFACTURER_CODE)) | ||
| end | ||
|
|
||
| local function device_init(driver, device) | ||
|
|
@@ -111,14 +119,28 @@ local info_changed = function (driver, device, event, args) | |
| end | ||
|
|
||
| local function generate_event_from_zone_status(driver, device, zone_status, zigbee_message) | ||
|
|
||
| if zone_status:is_test_set() then | ||
| device:emit_event(smokeDetector.smoke.tested()) | ||
| if device:supports_capability(capabilities.temperatureAlarm) then | ||
| device:emit_event(temperatureAlarm.temperatureAlarm.heat()) | ||
| end | ||
| if device:supports_capability(capabilities.smokeDetector) then | ||
| device:emit_event(smokeDetector.smoke.tested()) | ||
| end | ||
| elseif zone_status:is_alarm1_set() then | ||
| device:emit_event(smokeDetector.smoke.detected()) | ||
| if device:supports_capability(capabilities.temperatureAlarm) then | ||
| device:emit_event(temperatureAlarm.temperatureAlarm.heat()) | ||
| end | ||
| if device:supports_capability(capabilities.smokeDetector) then | ||
| device:emit_event(smokeDetector.smoke.detected()) | ||
| end | ||
| else | ||
| device.thread:call_with_delay(6, function () | ||
| device:emit_event(smokeDetector.smoke.clear()) | ||
| if device:supports_capability(capabilities.temperatureAlarm) then | ||
| device:emit_event(temperatureAlarm.temperatureAlarm.cleared()) | ||
| end | ||
| if device:supports_capability(capabilities.smokeDetector) then | ||
| device:emit_event(smokeDetector.smoke.clear()) | ||
| end | ||
|
Comment on lines
+138
to
+143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this branch is where you're lacking code coverage. We have a way to set up delayed events tests. |
||
| end) | ||
| end | ||
| end | ||
|
|
@@ -249,7 +271,7 @@ local frient_smoke_sensor = { | |
| } | ||
| }, | ||
| can_handle = function(opts, driver, device, ...) | ||
| return device:get_manufacturer() == "frient A/S" and device:get_model() == "SMSZB-120" | ||
| return device:get_manufacturer() == "frient A/S" and (device:get_model() == "SMSZB-120" or device:get_model() == "HESZB-120") | ||
| end | ||
| } | ||
| return frient_smoke_sensor | ||
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.
nit: whitespace