-
Notifications
You must be signed in to change notification settings - Fork 521
WWSTCERT-9096 Ct clamp driver wwsm #2552
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
petewaddy-petewaddy
wants to merge
18
commits into
SmartThingsCommunity:main
Choose a base branch
from
petewaddy-petewaddy:ct_clamp_driver_wwsm
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.
+132
−2
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a9d571b
no workspace files in repo
petewaddy-petewaddy 1f2ebee
start of using zigbee powerr meter as the main and then adding a sub …
petewaddy-petewaddy 2112515
first pass, after help from gemini.
petewaddy-petewaddy cf02dcf
Another attempt
petewaddy-petewaddy 8546844
first pass of what seems to be a fully working sub driver, packaged a…
petewaddy-petewaddy f7a9dab
Changes to copied in values for temperature and battery percentage
petewaddy-petewaddy a5f9d46
remove reference to VS code workspace
petewaddy-petewaddy 21e07f3
set back to origin code
petewaddy-petewaddy f101e5c
no message
petewaddy-petewaddy a5d3c87
cr lf
petewaddy-petewaddy e04499e
WWSTCERT-9096
petewaddy-petewaddy 7774158
ct-clamp-driver-wwsm
petewaddy-petewaddy eeef59b
ct_clamp-driver_wwsm
petewaddy-petewaddy 590dddd
ct_clamp_river_wwsm
petewaddy-petewaddy 3e2c2e5
ct_clap_driver_wwsm
petewaddy-petewaddy 2209e1b
removed as causing error in the HUB log
petewaddy-petewaddy e2b453f
ct_clamp_driver_wwsm
petewaddy-petewaddy 766c49e
ct_clamp_driver_wwsm
petewaddy-petewaddy 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ lua_libs-api_* | |
| tools/test_output/* | ||
| tools/coverage_output/* | ||
| .DS_Store | ||
| .venv/ | ||
| .venv/ | ||
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
19 changes: 19 additions & 0 deletions
19
drivers/SmartThings/zigbee-power-meter/profiles/power-energy-battery-temperature.yml
greens marked this conversation as resolved.
Show resolved
Hide resolved
|
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,19 @@ | ||
| name: power-energy-battery-temperature | ||
| components: | ||
| - id: main | ||
| capabilities: | ||
| - id: powerMeter | ||
| version: 1 | ||
| - id: energyMeter | ||
| version: 1 | ||
| - id: firmwareUpdate | ||
| version: 1 | ||
| - id: refresh | ||
| version: 1 | ||
| - id: battery | ||
| version: 1 | ||
| - id: temperatureMeasurement | ||
| version: 1 | ||
| categories: | ||
| - name: CurbPowerMeter | ||
|
|
104 changes: 104 additions & 0 deletions
104
drivers/SmartThings/zigbee-power-meter/src/chameleon/init.lua
greens marked this conversation as resolved.
Show resolved
Hide resolved
|
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,104 @@ | ||
| -- Copyright 2025 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. | ||
|
|
||
| local clusters = require "st.zigbee.zcl.clusters" | ||
| local capabilities = require "st.capabilities" | ||
| local log = require "log" | ||
|
|
||
| local TemperatureMeasurement = clusters.DeviceTemperatureConfiguration | ||
| local PowerConfiguration = clusters.PowerConfiguration | ||
|
|
||
| local ZIGBEE_FINGERPRINT = { | ||
| {model = "CT101xxxx" } | ||
| } | ||
|
|
||
| local configuration = { | ||
| { | ||
| cluster = TemperatureMeasurement.ID, | ||
| attribute = TemperatureMeasurement.attributes.CurrentTemperature.ID, | ||
| minimum_interval = 30, | ||
| maximum_interval = 3600, | ||
| data_type = TemperatureMeasurement.attributes.CurrentTemperature.base_type, | ||
| reportable_change = 1 | ||
| }, | ||
| { | ||
| cluster = PowerConfiguration.ID, | ||
| attribute = PowerConfiguration.attributes.BatteryPercentageRemaining.ID, | ||
| minimum_interval = 30, | ||
| maximum_interval = 3600, | ||
| data_type = PowerConfiguration.attributes.BatteryPercentageRemaining.base_type, | ||
| reportable_change = 2 | ||
| } | ||
| } | ||
|
|
||
| local is_chameleon_ct_clamp = function(opts, driver, device) | ||
| for _, fingerprint in ipairs(ZIGBEE_FINGERPRINT) do | ||
| if device:get_model() == fingerprint.model then | ||
| return true | ||
| end | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| 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 | ||
|
Comment on lines
+54
to
+70
Contributor
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. if you just added You could omit most of this file. |
||
|
|
||
| local function device_init(driver, device) | ||
| if configuration ~= nil then | ||
| for _, attribute in ipairs(configuration) do | ||
| device:add_configured_attribute(attribute) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| local function added_handler(self, device) | ||
| device:emit_event(capabilities.temperatureMeasurement.temperature({ value = 0, unit = "C" })) | ||
| device:emit_event(capabilities.battery.battery({value = 0, unit = "%" })) | ||
| end | ||
|
|
||
| local ct_clamp_battery_temperature_handler = { | ||
| NAME = "ct_clamp_battery_temperature_handler", | ||
| zigbee_handlers = { | ||
| attr = { | ||
| --[PowerConfiguration.ID] = { | ||
| -- [PowerConfiguration.attributes.BatteryPercentageRemaining.ID] = battery_level_handler | ||
| --}, | ||
| [TemperatureMeasurement.ID] = { | ||
| [TemperatureMeasurement.attributes.CurrentTemperature.ID] = temperature_handler | ||
| } | ||
| } | ||
| }, | ||
| lifecycle_handlers = { | ||
| init = device_init, | ||
| added = added_handler | ||
| }, | ||
| can_handle = is_chameleon_ct_clamp | ||
| } | ||
|
|
||
| return ct_clamp_battery_temperature_handler | ||
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
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.
changes to this file should be omitted