Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions drivers/SmartThings/zigbee-smoke-detector/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ zigbeeManufacturer:
manufacturer: frient A/S
model: SMSZB-120
deviceProfileName: smoke-temp-battery-alarm
- id: "frient/HESZB-120"
deviceLabel: frient Heat Detector
manufacturer: frient A/S
model: HESZB-120
deviceProfileName: heat-temp-battery-alarm
- id: "Heiman/Orvibo/Gas3"
deviceLabel: Orvibo Gas Detector
manufacturer: Heiman
Expand Down
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
36 changes: 29 additions & 7 deletions drivers/SmartThings/zigbee-smoke-detector/src/frient/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: whitespace

end

local function device_init(driver, device)
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

For example: https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/blob/main/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgb_bulb.lua#L147

end)
end
end
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion drivers/SmartThings/zigbee-smoke-detector/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ local zigbee_smoke_driver_template = {
capabilities.smokeDetector,
capabilities.battery,
capabilities.alarm,
capabilities.temperatureMeasurement
capabilities.temperatureMeasurement,
capabilities.temperatureAlarm
},
sub_drivers = {
require("frient"),
Expand Down
Loading
Loading