Skip to content

WWSTCERT-9857 Add Zooz ZSE50 to zwave-siren (for WWST Cert)#2681

Open
jtp10181 wants to merge 10 commits intoSmartThingsCommunity:mainfrom
jtp10181:zwave-siren_zse50
Open

WWSTCERT-9857 Add Zooz ZSE50 to zwave-siren (for WWST Cert)#2681
jtp10181 wants to merge 10 commits intoSmartThingsCommunity:mainfrom
jtp10181:zwave-siren_zse50

Conversation

@jtp10181
Copy link
Copy Markdown
Contributor

@jtp10181 jtp10181 commented Jan 2, 2026

Check all that apply

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

Adding Zooz ZSE50 for WWST Certification

Summary of Completed Tests

  • Tested all features manually
  • Passed full integration test from the developer test suite

Comment on lines +198 to +201
tones_list[tone_id] = string.format("%s: %s (%ss)", tone_id, tone_name, duration)
tones_duration[tone_id] = duration
device:set_field("TONES_LIST_TMP", tones_list)
device:set_field("TONES_DURATION_TMP", tones_duration)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it seems a little redundant to use two maps here where the only unique information one of them includes is the tone_name. Could you just use one map like:

{ [tone_id] = {duration: X, name: Y} }

And construct the strings in the places you actually want to emit them?

Also, the value of capabilities.mode.supportedArguments will be identical to device:get_field("TONES_LIST") most of the time, so it seems especially redundant there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented your suggestion in 243ec27

Copy link
Copy Markdown
Contributor

@greens greens left a comment

Choose a reason for hiding this comment

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

Please write and include some unit tests and remove your debug logging.

@greens greens changed the title Add Zooz ZSE50 to zwave-siren (for WWST Cert) WWSTCERT-9857 Add Zooz ZSE50 to zwave-siren (for WWST Cert) Jan 14, 2026
@jtp10181
Copy link
Copy Markdown
Contributor Author

I will work on the remaining issues and follow up when complete.

* Remove firmwareUpdate from driver_template
* Fix copyright date
* Remove unnecessary profile switch
duration = duration * device.preferences.playbackLoop
end
end
log.debug(string.format("Playing Tone: %s, playbackMode %s, duration %ss", tone_id, playbackMode, duration))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove debug log once you are ok with functionality.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is it OK to keep some as Info logs? I removed a bunch but changed this one to Info.

local soundSwitch_refresh = function()
local chime = device:get_latest_state("main", capabilities.chime.ID, capabilities.chime.chime.NAME)
local mode = device:get_latest_state("main", capabilities.mode.ID, capabilities.mode.mode.NAME)
log.debug(string.format("soundSwitch_refresh: %s | %s", chime, mode))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed this one to Info log as well if thats OK.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reiterating some of the comments that Pegor left, be sure to remove all usages of log.debug() from this file was your implementation is complete.

@KKlimczukS KKlimczukS requested a review from cbaumler March 19, 2026 13:04
@cbaumler
Copy link
Copy Markdown
Contributor

Hi @jtp10181 let us know when you're ready for a re-review.

@jtp10181
Copy link
Copy Markdown
Contributor Author

jtp10181 commented Mar 21, 2026

Hi @jtp10181 let us know when you're ready for a re-review.

Will do, I got caught up on a bunch of other stuff finally, so hope to circle back to this one soon.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Test Results

   72 files    496 suites   0s ⏱️
2 738 tests 2 738 ✅ 0 💤 0 ❌
4 614 runs  4 614 ✅ 0 💤 0 ❌

Results for commit b7a24a7.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

File Coverage
All files 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/multifunctional-siren/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/apiv6_bugfix/can_handle.lua 66%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/aeotec-doorbell-siren/init.lua 85%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/philio-sound-siren/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/zwave-sound-sensor/init.lua 84%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/zooz-zse50/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/preferences.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/lazy_load_subdriver.lua 57%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/configurations.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/utilitech-siren/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/yale-siren/init.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-siren/src/zipato-siren/init.lua 92%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against b7a24a7

* Merged upstream and updated for lazy-load
* Consolidated tones_list and tones_duration maps as suggested
* Removed debug logs and commented out code
jtp10181 added 3 commits April 5, 2026 15:33
* Added units tests
Removed audioVolume from supported capabilities so main unit test does not fail.
Added more units tests to increase coverage
@jtp10181
Copy link
Copy Markdown
Contributor Author

jtp10181 commented Apr 5, 2026

Hi @jtp10181 let us know when you're ready for a re-review.

Will do, I got caught up on a bunch of other stuff finally, so hope to circle back to this one soon.

Ok @greens, @wkhenon, @cbaumler
I think I have this all squared away now. I believe I addressed all issues and added 24 unit tests to get it to 95%. I think the two failing checks are some sort of issue with the bot itself and not an issue with the code.

I really hate making unit tests so I decided to have Copilot help make then, worked great once I told it to ingest all the other ones in the same folder for examples.

@cbaumler cbaumler requested review from aleclorimer and cjswedes April 6, 2026 15:38
Comment on lines +191 to +193
if tones_list == nil or tones_list == {} then
rebuildTones(device)
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this statement is true, the tones list could be nil, and then there would be a nil index error on line 200.

Suggested change
if tones_list == nil or tones_list == {} then
rebuildTones(device)
end
if tones_list == nil or tones_list == {} then
rebuildTones(device)
return
end

Copy link
Copy Markdown
Contributor Author

@jtp10181 jtp10181 Apr 8, 2026

Choose a reason for hiding this comment

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

I did not want to bail on playing the tone here so I fixed the now line 201 to be nil safe so it will fail over to my default as intended.

local toneInfo = (tones_list or {})[tone_id] or { name = "Unknown", duration = "0" }

Comment on lines +46 to +47
local tones_list = device:get_field("TONES_LIST")
local default_tone = device:get_field("TONE_DEFAULT")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These need to be nil checked to make sure we avoid nil index errors on lines 52 and 54.

Copy link
Copy Markdown
Contributor Author

@jtp10181 jtp10181 Apr 8, 2026

Choose a reason for hiding this comment

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

I added a nil fall back to 47

local default_tone = device:get_field("TONE_DEFAULT") or 1

Then for the other one I rearranged some things below and added a nil check for tones_list to the only if block using it. The duration is now set to 0 by default when initialized as well.

elseif tones_list ~= nil and tone_id > 0 then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants