Skip to content
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

Rolling up main to beta #1849

Merged
merged 15 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-thermostat/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ local function sequence_of_operation_handler(driver, device, ib, response)
-- or not the device supports emergency heat or fan only
local supported_modes = {capabilities.thermostatMode.thermostatMode.off.NAME}

local auto = device:get_endpoints(clusters.Thermostat.ID, {feature_bitmap = clusters.Thermostat.types.ThermostatFeature.auto})
local auto = device:get_endpoints(clusters.Thermostat.ID, {feature_bitmap = clusters.Thermostat.types.ThermostatFeature.AUTOMODE})
if #auto > 0 then
table.insert(supported_modes, capabilities.thermostatMode.thermostatMode.auto.NAME)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,40 @@ local mock_device = test.mock_device.build_test_matter_device({
}
})

local mock_device_auto = test.mock_device.build_test_matter_device({
profile = t_utils.get_profile_definition("thermostat-humidity-fan.yml"),
manufacturer_info = {
vendor_id = 0x0000,
product_id = 0x0000,
},
endpoints = {
{
endpoint_id = 0,
clusters = {
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"},
},
device_types = {
device_type_id = 0x0016, device_type_revision = 1, -- RootNode
}
},
{
endpoint_id = 1,
clusters = {
{cluster_id = clusters.FanControl.ID, cluster_type = "SERVER"},
{
cluster_id = clusters.Thermostat.ID,
cluster_revision=5,
cluster_type="SERVER",
feature_map=35, -- Heat, Cool, and Auto features
},
{cluster_id = clusters.TemperatureMeasurement.ID, cluster_type = "SERVER"},
{cluster_id = clusters.RelativeHumidityMeasurement.ID, cluster_type = "SERVER"},
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"},
}
}
}
})

local function test_init()
local cluster_subscribe_list = {
clusters.Thermostat.attributes.LocalTemperature,
Expand Down Expand Up @@ -85,6 +119,38 @@ local function test_init()
end
test.set_test_init_function(test_init)

local function test_init_auto()
local cluster_subscribe_list = {
clusters.Thermostat.attributes.LocalTemperature,
clusters.Thermostat.attributes.OccupiedCoolingSetpoint,
clusters.Thermostat.attributes.OccupiedHeatingSetpoint,
clusters.Thermostat.attributes.AbsMinCoolSetpointLimit,
clusters.Thermostat.attributes.AbsMaxCoolSetpointLimit,
clusters.Thermostat.attributes.AbsMinHeatSetpointLimit,
clusters.Thermostat.attributes.AbsMaxHeatSetpointLimit,
clusters.Thermostat.attributes.SystemMode,
clusters.Thermostat.attributes.ThermostatRunningState,
clusters.Thermostat.attributes.ControlSequenceOfOperation,
clusters.TemperatureMeasurement.attributes.MeasuredValue,
clusters.TemperatureMeasurement.attributes.MinMeasuredValue,
clusters.TemperatureMeasurement.attributes.MaxMeasuredValue,
clusters.RelativeHumidityMeasurement.attributes.MeasuredValue,
clusters.FanControl.attributes.FanMode,
clusters.FanControl.attributes.FanModeSequence,
clusters.PowerSource.attributes.BatPercentRemaining,
}
test.socket.matter:__set_channel_ordering("relaxed")
local subscribe_request = cluster_subscribe_list[1]:subscribe(mock_device_auto)
for i, cluster in ipairs(cluster_subscribe_list) do
if i > 1 then
subscribe_request:merge(cluster:subscribe(mock_device_auto))
end
end
test.socket.matter:__expect_send({mock_device_auto.id, subscribe_request})
test.socket.matter:__expect_send({mock_device_auto.id, clusters.Thermostat.attributes.MinSetpointDeadBand:read(mock_device_auto)})
test.mock_device.add_test_device(mock_device_auto)
end

test.register_message_test(
"Relative humidity reports should generate correct messages",
{
Expand Down Expand Up @@ -295,7 +361,7 @@ test.register_message_test(
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat"}, {visibility={displayed=false}}))
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -308,7 +374,7 @@ test.register_message_test(
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "heat"}, {visibility={displayed=false}}))
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -321,11 +387,57 @@ test.register_message_test(
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool"}, {visibility={displayed=false}}))
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool"}, {visibility={displayed=false}}))
},
}
)

test.register_message_test(
"Thermostat control sequence reports should generate correct messages when auto feature is supported",
{
{
channel = "matter",
direction = "receive",
message = {
mock_device_auto.id,
ControlSequenceOfOperation:build_test_report_data(mock_device_auto, 1, ControlSequenceOfOperation.COOLING_AND_HEATING_WITH_REHEAT)
}
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
direction = "receive",
message = {
mock_device_auto.id,
ControlSequenceOfOperation:build_test_report_data(mock_device_auto, 1, ControlSequenceOfOperation.HEATING_WITH_REHEAT)
}
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
direction = "receive",
message = {
mock_device_auto.id,
ControlSequenceOfOperation:build_test_report_data(mock_device_auto, 1, ControlSequenceOfOperation.COOLING_WITH_REHEAT)
}
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool"}, {visibility={displayed=false}}))
},
},
{ test_init = test_init_auto }
)

test.register_message_test(
"Additional mode reports should extend the supported modes",
{
Expand All @@ -340,7 +452,7 @@ test.register_message_test(
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat"}, {visibility={displayed=false}}))
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -358,11 +470,49 @@ test.register_message_test(
{
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat", "emergency heat"}, {visibility={displayed=false}}))
message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool", "heat", "emergency heat"}, {visibility={displayed=false}}))
}
}
)

test.register_message_test(
"Additional mode reports should extend the supported modes when auto is supported",
{
{
channel = "matter",
direction = "receive",
message = {
mock_device_auto.id,
clusters.Thermostat.server.attributes.ControlSequenceOfOperation:build_test_report_data(mock_device_auto, 1, 5)
}
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat"}, {visibility={displayed=false}}))
},
{
channel = "matter",
direction = "receive",
message = {
mock_device_auto.id,
clusters.Thermostat.server.attributes.SystemMode:build_test_report_data(mock_device_auto, 1, 5)
}
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat())
},
{
channel = "capability",
direction = "send",
message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "auto", "cool", "heat", "emergency heat"}, {visibility={displayed=false}}))
}
},
{ test_init = test_init_auto }
)

local FanMode = clusters.FanControl.attributes.FanMode
test.register_message_test(
"Thermostat fan mode reports should generate correct messages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main",
capabilities.thermostatMode.supportedThermostatModes({ "off", "auto", "cool", "heat" }, {visibility={displayed=false}}))
capabilities.thermostatMode.supportedThermostatModes({ "off", "cool", "heat" }, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -322,7 +322,7 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main",
capabilities.thermostatMode.supportedThermostatModes({ "off", "auto", "heat" }, {visibility={displayed=false}}))
capabilities.thermostatMode.supportedThermostatModes({ "off", "heat" }, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -336,7 +336,7 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main",
capabilities.thermostatMode.supportedThermostatModes({ "off", "auto", "cool" }, {visibility={displayed=false}}))
capabilities.thermostatMode.supportedThermostatModes({ "off", "cool" }, {visibility={displayed=false}}))
},
}
)
Expand All @@ -356,7 +356,7 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main",
capabilities.thermostatMode.supportedThermostatModes({ "off", "auto", "cool", "heat" }, {visibility={displayed=false}}))
capabilities.thermostatMode.supportedThermostatModes({ "off", "cool", "heat" }, {visibility={displayed=false}}))
},
{
channel = "matter",
Expand All @@ -375,7 +375,7 @@ test.register_message_test(
channel = "capability",
direction = "send",
message = mock_device:generate_test_message("main",
capabilities.thermostatMode.supportedThermostatModes({ "off", "auto", "cool", "heat", "emergency heat" }, {visibility={displayed=false}}))
capabilities.thermostatMode.supportedThermostatModes({ "off", "cool", "heat", "emergency heat" }, {visibility={displayed=false}}))
}
}
)
Expand Down
25 changes: 23 additions & 2 deletions drivers/SmartThings/matter-window-covering/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matterManufacturer:
deviceLabel: Zemismart MT25B Roller Motor
vendorId: 0x139C
productId: 0xFF60
deviceProfileName: window-covering
deviceProfileName: window-covering
- id: "5020/65296"
deviceLabel: Zemismart MT82 Smart Curtain
vendorId: 0x139C
Expand All @@ -30,12 +30,33 @@ matterManufacturer:
deviceLabel: Zemismart ZM02 Smart Curtain
vendorId: 0x139C
productId: 0xFA32
deviceProfileName: window-covering
deviceProfileName: window-covering
- id: "5020/64017"
deviceLabel: Zemismart ZM25C Smart Curtain
vendorId: 0x139C
productId: 0xFA11
deviceProfileName: window-covering
- id: "5020/64049"
deviceLabel: Zemismart ZM01 Smart Curtain
vendorId: 0x139C
productId: 0xFA31
deviceProfileName: window-covering
#WISTAR
- id: "5207/17"
deviceLabel: WISTAR WSER40 Smart Tubular Motor
vendorId: 0x1457
productId: 0x0011
deviceProfileName: window-covering
- id: "5207/18"
deviceLabel: WISTAR WSER50 Smart Tubular Motor
vendorId: 0x1457
productId: 0x0012
deviceProfileName: window-covering
- id: "5207/2"
deviceLabel: WISTAR WSERD30-B Smart Tubular Motor
vendorId: 0x1457
productId: 0x0002
deviceProfileName: window-covering-battery
matterGeneric:
- id: "windowcovering"
deviceLabel: Matter Window Covering
Expand Down
2 changes: 1 addition & 1 deletion drivers/SmartThings/philips-hue/src/consts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Consts.DEFAULT_MAX_MIREK = 500
Consts.MIN_TEMP_KELVIN_COLOR_AMBIANCE = 2000
Consts.MIN_TEMP_KELVIN_WHITE_AMBIANCE = 2200
Consts.MAX_TEMP_KELVIN = 6500
Consts.DEFAULT_MIN_DIMMING = 2
Consts.KELVIN_STEP_SIZE = 11

return Consts
3 changes: 3 additions & 0 deletions drivers/SmartThings/philips-hue/src/disco/button.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local log = require "log"
local socket = require "cosock".socket
local st_utils = require "st.utils"
-- trick to fix the VS Code Lua Language Server typechecking
---@type fun(val: any?, name: string?, multi_line: boolean?): string
st_utils.stringify_table = st_utils.stringify_table

local HueDeviceTypes = require "hue_device_types"

Expand Down
3 changes: 3 additions & 0 deletions drivers/SmartThings/philips-hue/src/disco/contact.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local log = require "log"
local socket = require "cosock".socket
local st_utils = require "st.utils"
-- trick to fix the VS Code Lua Language Server typechecking
---@type fun(val: any?, name: string?, multi_line: boolean?): string
st_utils.stringify_table = st_utils.stringify_table

local HueDeviceTypes = require "hue_device_types"

Expand Down
3 changes: 3 additions & 0 deletions drivers/SmartThings/philips-hue/src/disco/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ local socket = require "cosock.socket"
local mdns = require "st.mdns"
local net_utils = require "st.net_utils"
local st_utils = require "st.utils"
-- trick to fix the VS Code Lua Language Server typechecking
---@type fun(val: any?, name: string?, multi_line: boolean?): string
st_utils.stringify_table = st_utils.stringify_table

local Fields = require "fields"
local HueApi = require "hue.api"
Expand Down
3 changes: 3 additions & 0 deletions drivers/SmartThings/philips-hue/src/disco/light.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local log = require "log"
local socket = require "cosock".socket
local st_utils = require "st.utils"
-- trick to fix the VS Code Lua Language Server typechecking
---@type fun(val: any?, name: string?, multi_line: boolean?): string
st_utils.stringify_table = st_utils.stringify_table

local HueDeviceTypes = require "hue_device_types"

Expand Down
3 changes: 3 additions & 0 deletions drivers/SmartThings/philips-hue/src/disco/motion.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local log = require "log"
local socket = require "cosock".socket
local st_utils = require "st.utils"
-- trick to fix the VS Code Lua Language Server typechecking
---@type fun(val: any?, name: string?, multi_line: boolean?): string
st_utils.stringify_table = st_utils.stringify_table

local HueDeviceTypes = require "hue_device_types"

Expand Down
2 changes: 0 additions & 2 deletions drivers/SmartThings/philips-hue/src/fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
--- @field BRIDGE_SW_VERSION string The SW Version of the bridge to determine if it supports CLIP V2
--- @field DEVICE_TYPE string Field on all Hue devices that indicates type, maps to a Hue service rtype.
--- @field BRIDGE_API string Transient field that holds the HueAPI instance for the bridge
--- @field MIN_DIMMING string Minimum dimming/brightness value accepted by a light
--- @field EVENT_SOURCE string Field on a bridge that stores a handle to the SSE EventSource client.
local Fields = {
_ADDED = "added",
Expand All @@ -24,7 +23,6 @@ local Fields = {
IPV4 = "ipv4",
IS_ONLINE = "is_online",
IS_MULTI_SERVICE = "is_multi_service",
MIN_DIMMING = "mindim",
MIN_KELVIN = "mintemp",
MAX_KELVIN = "maxtemp",
MODEL_ID = "modelid",
Expand Down
Loading
Loading