-
Notifications
You must be signed in to change notification settings - Fork 499
Feature/matter britzyhub #2189
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
KyuminAhn
wants to merge
14
commits into
SmartThingsCommunity:main
Choose a base branch
from
KyuminAhn:feature/matter-britzyhub
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.
Open
Feature/matter britzyhub #2189
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d58a759
init commit
KyuminAhn bd11a6b
reflect elevator called/standby status for smartthings ui
KyuminAhn 47d37e2
Merge branch 'main' into feature/matter-britzyhub
KyuminAhn 66ad2f6
update: elevator, gas-valve, vent ids
KyuminAhn 90eaf7c
update: elevator, gas-valve, vent ids
KyuminAhn 6ea9387
update: remove fanSpeedPercent,windMode,fanOscillationMode capabilit…
KyuminAhn 1407441
Merge branch 'SmartThingsCommunity:main' into feature/matter-britzyhub
KyuminAhn 1086664
update: add DeviceTypeID, change gas-valve capability
KyuminAhn f6bc2c4
Merge branch 'SmartThingsCommunity:main' into feature/matter-britzyhub
KyuminAhn 4f64d3f
Merge branch 'SmartThingsCommunity:main' into feature/matter-britzyhub
KyuminAhn 98c2582
Refactor : ventilator and gas valve handlers: remove unused capabilit…
KyuminAhn b7e0251
Merge branch 'SmartThingsCommunity:main' into feature/matter-britzyhub
KyuminAhn 7e2cffa
remove : dimm-light, air-conditioner.yml
KyuminAhn 6c731b5
Merge branch 'SmartThingsCommunity:main' into feature/matter-britzyhub
KyuminAhn 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# BritzyHub Matter Edge Driver | ||
|
||
Edge driver for registering BritzyHub Matter dedicated Matter devices. | ||
|
||
--- | ||
|
||
## Reference |
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,6 @@ | ||
name: BritzyHub Matter | ||
packageKey: britzyhub-matter | ||
permissions: | ||
matter: {} | ||
description: SmartThings Edge driver for BritzyHub Matter devices. | ||
vendorSupportInformation: https://sinux.kr |
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,16 @@ | ||
matterGeneric: | ||
- id: "elevator" | ||
deviceLabel: "Elevator" | ||
deviceTypes: | ||
- id: 0xFF02 | ||
deviceProfileName: elevator | ||
- id: "gas-valve" | ||
deviceLabel: "Gas Valve" | ||
deviceTypes: | ||
- id: 0xFF01 | ||
deviceProfileName: gas-valve | ||
- id: "ventilator" | ||
deviceLabel: "Ventilator" | ||
deviceTypes: | ||
- id: 0xFF03 | ||
deviceProfileName: ventilator |
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,8 @@ | ||
name: elevator | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: elevatorCall | ||
version: 1 | ||
categories: | ||
- name: Elevator |
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,8 @@ | ||
name: gas-valve | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: safetyValve | ||
version: 1 | ||
categories: | ||
- name: GasValve |
17 changes: 17 additions & 0 deletions
17
drivers/SmartThings/sinux-britzyhub/profiles/ventilator.yml
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,17 @@ | ||
name: ventilator | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: airPurifierFanMode | ||
version: 1 | ||
config: | ||
values: | ||
- key: "airPurifierFanMode.value" | ||
enabledValues: | ||
- auto | ||
- low | ||
- medium | ||
- high | ||
- off | ||
categories: | ||
- name: Vent |
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,91 @@ | ||
-- SinuxSoft (c) 2025 | ||
-- Licensed under the Apache License, Version 2.0 | ||
|
||
local capabilities = require "st.capabilities" | ||
local clusters = require "st.matter.clusters" | ||
local log = require "log" | ||
|
||
local elevator_cap = capabilities.elevatorCall | ||
local onoff_cluster = clusters.OnOff | ||
|
||
local ELEVATOR_DEVICE_TYPE_ID = 0xFF02 | ||
|
||
local function on_off_attr_handler(_, device, ib, _) | ||
if ib.data.value then | ||
device:emit_event_for_endpoint(ib.endpoint_id, elevator_cap.callStatus.called()) | ||
else | ||
device:emit_event_for_endpoint(ib.endpoint_id, elevator_cap.callStatus.standby()) | ||
end | ||
end | ||
|
||
local function handle_elevator_call(driver, device, cmd) | ||
local endpoint_id = device:component_to_endpoint(cmd.component) | ||
local req = onoff_cluster.server.commands.On(device, endpoint_id) | ||
device:send(req) | ||
end | ||
|
||
local function find_default_endpoint(device, cluster) | ||
local eps = device:get_endpoints(cluster) | ||
table.sort(eps) | ||
for _, ep in ipairs(eps) do | ||
if ep ~= 0 then return ep end | ||
end | ||
log.warn(string.format("No endpoint found, using default %d", device.MATTER_DEFAULT_ENDPOINT)) | ||
return device.MATTER_DEFAULT_ENDPOINT | ||
end | ||
|
||
local function component_to_endpoint(device, _) | ||
return find_default_endpoint(device, clusters.OnOff.ID) | ||
end | ||
|
||
local function device_init(_, device) | ||
device:set_component_to_endpoint_fn(component_to_endpoint) | ||
device:subscribe() | ||
end | ||
|
||
local function info_changed(_, device) | ||
device:add_subscribed_attribute(onoff_cluster.attributes.OnOff) | ||
device:subscribe() | ||
end | ||
|
||
local function is_matter_elevator(opts, driver, device) | ||
for _, ep in ipairs(device.endpoints) do | ||
for _, dt in ipairs(ep.device_types) do | ||
if dt.device_type_id == ELEVATOR_DEVICE_TYPE_ID then | ||
return true | ||
end | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local elevator_handler = { | ||
NAME = "Elevator Handler", | ||
can_handle = is_matter_elevator, | ||
lifecycle_handlers = { | ||
init = device_init, | ||
infoChanged = info_changed, | ||
}, | ||
matter_handlers = { | ||
attr = { | ||
[onoff_cluster.ID] = { | ||
[onoff_cluster.attributes.OnOff.ID] = on_off_attr_handler, | ||
} | ||
} | ||
}, | ||
capability_handlers = { | ||
[elevator_cap.ID] = { | ||
[elevator_cap.commands.call.NAME] = handle_elevator_call, | ||
} | ||
}, | ||
supported_capabilities = { | ||
elevator_cap, | ||
}, | ||
subscribed_attributes = { | ||
[elevator_cap.ID] = { | ||
onoff_cluster.attributes.OnOff | ||
} | ||
}, | ||
} | ||
|
||
return elevator_handler |
93 changes: 93 additions & 0 deletions
93
drivers/SmartThings/sinux-britzyhub/src/gas-valve/init.lua
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,93 @@ | ||
-- SinuxSoft (c) 2025 | ||
-- Licensed under the Apache License, Version 2.0 | ||
|
||
local capabilities = require "st.capabilities" | ||
local clusters = require "st.matter.clusters" | ||
local log = require "log" | ||
|
||
local valve_cap = capabilities.safetyValve | ||
local onoff_cluster = clusters.OnOff | ||
|
||
local GAS_VALVE_DEVICE_TYPE_ID = 0xFF01 | ||
|
||
local function on_off_attr_handler(driver, device, ib, response) | ||
if ib.data.value then | ||
device:emit_event_for_endpoint(ib.endpoint_id, valve_cap.valve.open()) | ||
else | ||
device:emit_event_for_endpoint(ib.endpoint_id, valve_cap.valve.closed()) | ||
end | ||
end | ||
|
||
local function handle_valve_command(driver, device, cmd, cluster_command) | ||
local endpoint_id = device:component_to_endpoint(cmd.component) | ||
local req = cluster_command(device, endpoint_id) | ||
device:send(req) | ||
end | ||
|
||
local function find_default_endpoint(device, cluster) | ||
local eps = device:get_endpoints(cluster) | ||
table.sort(eps) | ||
for _, ep in ipairs(eps) do | ||
if ep ~= 0 then return ep end | ||
end | ||
log.warn(string.format("No endpoint found, using default %d", device.MATTER_DEFAULT_ENDPOINT)) | ||
return device.MATTER_DEFAULT_ENDPOINT | ||
end | ||
|
||
local function component_to_endpoint(device, _) | ||
return find_default_endpoint(device, onoff_cluster.ID) | ||
end | ||
|
||
local function device_init(_, device) | ||
device:set_component_to_endpoint_fn(component_to_endpoint) | ||
device:subscribe() | ||
end | ||
|
||
local function info_changed(_, device) | ||
device:add_subscribed_attribute(onoff_cluster.attributes.OnOff) | ||
device:subscribe() | ||
end | ||
|
||
local function is_matter_gas_valve(opts, driver, device) | ||
for _, ep in ipairs(device.endpoints) do | ||
for _, dt in ipairs(ep.device_types) do | ||
if dt.device_type_id == GAS_VALVE_DEVICE_TYPE_ID then | ||
return true | ||
end | ||
end | ||
end | ||
return false | ||
end | ||
|
||
local gas_valve_handler = { | ||
NAME = "Gas Valve Handler", | ||
can_handle = is_matter_gas_valve, | ||
lifecycle_handlers = { | ||
init = device_init, | ||
infoChanged = info_changed, | ||
}, | ||
matter_handlers = { | ||
attr = { | ||
[onoff_cluster.ID] = { | ||
[onoff_cluster.attributes.OnOff.ID] = on_off_attr_handler, | ||
} | ||
} | ||
}, | ||
capability_handlers = { | ||
[valve_cap.ID] = { | ||
[valve_cap.commands.close.NAME] = function(driver, device, cmd) | ||
handle_valve_command(driver, device, cmd, onoff_cluster.server.commands.Off) | ||
end, | ||
} | ||
}, | ||
supported_capabilities = { | ||
valve_cap, | ||
}, | ||
subscribed_attributes = { | ||
[valve_cap.ID] = { | ||
onoff_cluster.attributes.OnOff | ||
} | ||
}, | ||
} | ||
|
||
return gas_valve_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- SinuxSoft (c) 2025 | ||
-- Licensed under the Apache License, Version 2.0 | ||
|
||
local MatterDriver = require "st.matter.driver" | ||
local log = require "log" | ||
|
||
local matter_driver = MatterDriver("britzyhub-matter", { | ||
sub_drivers = { | ||
require ("elevator"), | ||
require ("gas-valve"), | ||
require ("ventilator"), | ||
} | ||
}) | ||
|
||
log.info_with({hub_logs=true}, string.format("Starting %s driver, with dispatcher: %s", matter_driver.NAME, matter_driver.matter_dispatcher)) | ||
matter_driver:run() |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.