Skip to content

Conversation

@petewaddy-petewaddy
Copy link

Check all that apply

Type of Change

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

Checklist

  • [ x] I have performed a self-review of my code
  • [ x] I have commented my code in hard-to-understand areas
  • [x ] I have verified my changes by testing with a device or have communicated a plan for testing
  • [x ] 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

add a sub driver to the standard edge driver for Zigbee Power meter to supply temperature and battery percentage readings

Summary of Completed Tests

Smartthings full 14 test test suite from the certification console, all 14 tests passed

Test date: 13 November 2025 at 11:28:28
Test duration: 00:12:27
Session ID: WHJ1WLTHID

Test date: 13 November 2025 at 11:51:55
Test duration: 00:09:10
Session ID: 1DIHUP08CV

battery seems to always be at 100% on both tested clamps, even throiugh one is as 98%
Now calling the ct clamp sub driver - have temperature,battery,power meter and energy meter on the screen, last two are correct values, first two are not as yet
…nd deployed to the hub, using the standard smartthings zigbee power meter as the base and adding as a sub driver the temperature and battery level
@greens greens changed the title Ct clamp driver wwsm WWSTCERT-9096 Ct clamp driver wwsm Nov 25, 2025

local function battery_level_handler(driver, device, value, _zb_rx)
if type(value.value) == "number" then
local number = value.value/2

Choose a reason for hiding this comment

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

spacing

PR SmartThingsCommunity#2552

indent code under the statement to the right   as per pull request comment
Copy link

@pegor-karoglanian pegor-karoglanian left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

Choose a reason for hiding this comment

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

missing copyright/license statement

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Comment on lines +43 to +63
- id: "ChameleonCTClamp"
deviceLabel: Zigbee CT
deviceIdentifiers:
- 0x000D
zigbeeProfiles:
- 0x0104
clusters:
server:
- 0x0000 #Basic
- 0x0001 #Power Configuration
- 0x0002 #Device Temperature Configuration
- 0x0003 #Identify
- 0x0019 #Over the Air Bootloading
- 0x0020 #Poll Control
- 0x0702 #Simple Metering
- 0x0B04 #Electrical Measurement
client:
- 0x0003 #Identify
deviceProfileName: ct-clamp


Copy link
Contributor

Choose a reason for hiding this comment

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

Please just include the manufacturer-specific fingerprint

Copy link
Contributor

Choose a reason for hiding this comment

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

changes to this file should be omitted

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Test Results

   71 files    469 suites   0s ⏱️
2 457 tests 2 457 ✅ 0 💤 0 ❌
4 177 runs  4 177 ✅ 0 💤 0 ❌

Results for commit e04499e.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

File Coverage
All files 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-power-meter/src/frient/init.lua 77%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-power-meter/src/shinasystems/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-power-meter/src/chameleon/init.lua 73%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-power-meter/src/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-power-meter/src/configurations.lua 95%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against e04499e

Copy link
Contributor

Choose a reason for hiding this comment

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

Since there isn't anything here that makes this device-specific, could you please rename to something like power-energy-battery-temp?

Comment on lines +68 to +71
local batt_level = device:get_latest_state("main", capabilities.battery.ID, capabilities.battery.battery.NAME) or nil
if batt_level == nil then
device:emit_event(capabilities.battery.battery.normal())
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect this to go in added. Is there a reason you included it in init?

Comment on lines +43 to +59
local function battery_level_handler(driver, device, value, _zb_rx)
if type(value.value) == "number" then
local number = value.value/2
local integer_result = math.floor(number)
device:emit_event(capabilities.battery.battery(integer_result))
else
log.error("Invalid battery level value received: " .. tostring(value.value))
end
end

local function temperature_handler(driver, device, value, _zb_rx)
if type(value.value) == "number" then
device:emit_event(capabilities.temperatureMeasurement.temperature({ value = value.value, unit = "C" }))
else
log.error("Invalid temperature value received: " .. tostring(value.value))
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

if you just added battery and temperatureMeasurement here: https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/blob/main/drivers/SmartThings/zigbee-power-meter/src/init.lua#L53

You could omit most of this file.

@greens
Copy link
Contributor

greens commented Dec 1, 2025

Checking drivers/SmartThings/zigbee-power-meter/src/chameleon/init.lua 2 warnings

    drivers/SmartThings/zigbee-power-meter/src/chameleon/init.lua:2:7: (W211) unused variable cluster_base
    drivers/SmartThings/zigbee-power-meter/src/chameleon/init.lua:3:7: (W211) unused variable data_types

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.

3 participants