Skip to content

CHAD-15777: temperatureMeasurement:temperature registering for native… #2267

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
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions drivers/SmartThings/matter-sensor/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ local function temperature_attr_handler(driver, device, ib, response)
local temp = measured_value / 100.0
local unit = "C"
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.temperatureMeasurement.temperature({value = temp, unit = unit}))
if type(device.register_native_capability_attr_handler) == "function" then
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the same be done for matter-thermostat?

device:register_native_capability_attr_handler("temperatureMeasurement", "temperature")
end
end
end

Expand Down
3 changes: 3 additions & 0 deletions drivers/SmartThings/matter-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,9 @@ local function temperature_attr_handler(driver, device, ib, response)
local temp = measured_value / 100.0
local unit = "C"
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.temperatureMeasurement.temperature({value = temp, unit = unit}))
if type(device.register_native_capability_attr_handler) == "function" then
device:register_native_capability_attr_handler("temperatureMeasurement", "temperature")
end
end
end

Expand Down
4 changes: 3 additions & 1 deletion drivers/SmartThings/zigbee-thermostat/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ local zigbee_thermostat_driver = {
health_check = false,
}

defaults.register_for_default_handlers(zigbee_thermostat_driver, zigbee_thermostat_driver.supported_capabilities)
defaults.register_for_default_handlers(
zigbee_thermostat_driver, zigbee_thermostat_driver.supported_capabilities,
{native_capability_attrs_enabled = true})
local thermostat = ZigbeeDriver("zigbee-thermostat", zigbee_thermostat_driver)
thermostat:run()
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ local function sensor_multilevel_report_handler(self, device, cmd)
local scale = 'C'
if (cmd.args.scale == SensorMultilevel.scale.temperature.FAHRENHEIT) then scale = 'F' end
device:emit_event(capabilities.temperatureMeasurement.temperature({value = cmd.args.sensor_value, unit = scale}))
if type(device.register_native_capability_attr_handler) == "function" then
device:register_native_capability_attr_handler("temperatureMeasurement","temperature")
end
Copy link
Contributor

Choose a reason for hiding this comment

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

typically I have avoided doing this in a subdriver even if I tested with it. Was this intended to be done or was it a part of testing?

Copy link
Author

Choose a reason for hiding this comment

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

I threw this in there because I've seen it done a few times and this was the device that I used to develop the NH for Z-wave. This logic follows the default handler logic, but maybe a better route is to remove this method from the subdriver?

end
end

Expand Down
4 changes: 3 additions & 1 deletion drivers/SmartThings/zwave-thermostat/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ local driver_template = {
}
}

defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities)
defaults.register_for_default_handlers(
driver_template, driver_template.supported_capabilities,
{native_capability_attrs_enabled = true})
--- @type st.zwave.Driver
local thermostat = ZwaveDriver("zwave_thermostat", driver_template)
thermostat:run()
Loading