Skip to content

Added support for frient switch devices #2208

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

Conversation

marcintyminski
Copy link
Contributor

@marcintyminski marcintyminski commented Jun 23, 2025

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
  • Bug fix
  • New feature
  • Refactor

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

Summary of Completed Tests

Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

Copy link

github-actions bot commented Jun 23, 2025

Channel deleted.

Copy link

github-actions bot commented Jun 23, 2025

Test Results

   67 files  ± 0    444 suites  +1   0s ⏱️ ±0s
2 273 tests + 9  2 273 ✅ + 9  0 💤 ±0  0 ❌ ±0 
3 872 runs  +10  3 872 ✅ +10  0 💤 ±0  0 ❌ ±0 

Results for commit 1259705. ± Comparison against base commit 7c43811.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 23, 2025

File Coverage
All files 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/init.lua 73%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/inovelli-vzm31-sn/init.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/jasco/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/multi-switch/init.lua 87%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/preferences.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/init.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/version/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/frient/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/tuya-multi/init.lua 43%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/aqara/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/zigbee-switch-power/vimar/init.lua 70%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/ge-link-bulb/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/enbrighten-metering-dimmer/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/zigbee-switch-power/aurora-relay/init.lua 80%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua 90%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 1259705

maximum_interval = 600,
data_type = Alarms.attributes.AlarmCount.base_type,
reportable_change = 1,

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra whitespace


local function alarm_report_handler(driver, device, zb_rx)
local alarm_status = zb_rx.body.zcl_body
log.error("Received alarm report:"..util.stringify_table(zb_rx.body.zcl_body, nil, true))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a debug statement, and I expect this message is already logged by the driver framework.

local multiplier = device:get_field(VOLTAGE_MEASUREMENT_MULTIPLIER_KEY) or 1
local divisor = device:get_field(VOLTAGE_MEASUREMENT_DIVISOR_KEY) or 1

if divisor == 0 then
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a concern, I would put the check where you write the value to VOLTAGE_MEASUREMENT_DIVISOR_KEY.

Comment on lines 88 to 108
local function current_measurement_divisor_handler(driver, device, divisor, zb_rx)
log.info("current divisor value = ", divisor.value)
local raw_value = divisor.value
device:set_field(CURRENT_MEASUREMENT_DIVISOR_KEY, raw_value, { persist = true })
end

local function current_measurement_multiplier_handler(driver, device, multiplier, zb_rx)
log.info("current multipl value = ", multiplier.value)
local raw_value = multiplier.value
device:set_field(CURRENT_MEASUREMENT_MULTIPLIER_KEY, raw_value, { persist = true })
end

local function voltage_measurement_divisor_handler(driver, device, divisor, zb_rx)
log.info("V divisor value = ", divisor.value)

local raw_value = divisor.value
device:set_field(VOLTAGE_MEASUREMENT_DIVISOR_KEY, raw_value, { persist = true })
end

local function voltage_measurement_multiplier_handler(driver, device, multiplier, zb_rx)
log.info("Volt Multiplayer value = ")
Copy link
Contributor

Choose a reason for hiding this comment

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

several log statements here that ought to be removed. This one doesn't actually log any values.

cluster = ElectricalMeasurement.ID,
attribute = ElectricalMeasurement.attributes.ActivePower.ID,
minimum_interval = 5,
maximum_interval = 600,
Copy link
Contributor

Choose a reason for hiding this comment

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

Our default max here is one hour, rather than 5 minutes. Is there a particular reason you've chosen a shorter max interval? Because of the reportable change, any updates to the value itself should still come in (provided they're not more frequent than the minimum interval), so we're wondering if there's a specific reason you want to see the current value reported every five minutes.

If not, we'd appreciate you sticking with our default configurations.

@KKlimczukS KKlimczukS requested a review from greens July 7, 2025 08:23
@greens greens merged commit b9e5ff1 into SmartThingsCommunity:main Jul 7, 2025
12 checks passed
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