Skip to content

Support Soil Sensor device type#2757

Open
nickolas-deboom wants to merge 2 commits intomainfrom
feature/matter-soil-sensor
Open

Support Soil Sensor device type#2757
nickolas-deboom wants to merge 2 commits intomainfrom
feature/matter-soil-sensor

Conversation

@nickolas-deboom
Copy link
Copy Markdown
Contributor

@nickolas-deboom nickolas-deboom commented Feb 5, 2026

This adds support for the Soil Sensor device type, introduced with Matter 1.5.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

Test Results

   72 files    508 suites   0s ⏱️
2 790 tests 2 789 ✅ 0 💤 0 ❌ 1 🔥
4 695 runs  4 694 ✅ 0 💤 0 ❌ 1 🔥

For more details on these errors, see this check.

Results for commit b3cc43b.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

File Coverage
All files 85%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/utils.lua 74%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/fields.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/device_configuration.lua 80%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/legacy_device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/init.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/lazy_load_subdriver.lua 57%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/Global/types/MeasurementAccuracyStruct.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/Global/types/LevelValueEnum.lua 69%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/Global/types/MeasurementAccuracyRangeStruct.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/Global/types/MeasurementTypeEnum.lua 69%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_handlers/attribute_handlers.lua 78%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/init.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/smoke_co_alarm/init.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sensor_utils/device_configuration.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sensor_utils/embedded_cluster_utils.lua 45%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/SoilMeasurement/init.lua 79%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/SoilMeasurement/server/attributes/SoilMoistureMeasurementLimits.lua 78%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/embedded_clusters/SoilMeasurement/server/attributes/SoilMoistureMeasuredValue.lua 81%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sub_drivers/bosch_button_contact/init.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-sensor/src/sensor_handlers/attribute_handlers.lua 88%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against b3cc43b

@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from 5abb504 to eb50abd Compare February 5, 2026 15:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

Comment thread drivers/SmartThings/matter-sensor/src/init.lua
@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch 2 times, most recently from a7fcbb4 to 09c0f55 Compare February 5, 2026 16:50
clusters.RadonConcentrationMeasurement.attributes.MeasuredValue,
clusters.RadonConcentrationMeasurement.attributes.MeasurementUnit,
},
[capabilities.relativeHumidityMeasurement.ID] = {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was a duplicate entry

-- remove leading "-"
profile_name = string.sub(profile_name, 2)

device.log.info_with({hub_logs=true}, string.format("Updating device profile to %s.", profile_name))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this log because I realized this is now logged by the lua libs

@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from d3ae5af to 01d94a4 Compare March 2, 2026 17:08
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Duplicate profile check: Warning - duplicate profiles detected.
soil-sensor-battery.yml == humidity-battery.yml
soil-sensor-batteryLevel.yml == humidity-batteryLevel.yml
soil-sensor.yml == humidity.yml

@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from 8e21d60 to a2e702f Compare March 2, 2026 18:56
@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from a2e702f to 0de69b8 Compare April 2, 2026 19:16
@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from 0de69b8 to 8bff4f6 Compare April 2, 2026 19:21
ib.data.elements.min_measured_value == nil or ib.data.elements.min_measured_value.value == nil or
ib.data.elements.max_measured_value == nil or ib.data.elements.max_measured_value.value == nil or
ib.data.elements.min_measured_value.value >= ib.data.elements.max_measured_value.value then
device.log.warn_with({hub_logs = true}, "Device reported invalid soil moisture limits")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you expand on this warning to give slightly more info?

Comment on lines +97 to +98
sensor_utils.set_field_for_endpoint(device, fields.SOIL_LIMIT_MIN, ib.endpoint_id, ib.data.elements.min_measured_value.value)
sensor_utils.set_field_for_endpoint(device, fields.SOIL_LIMIT_MAX, ib.endpoint_id, ib.data.elements.max_measured_value.value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we have sanity checks here you think?

if device:supports_capability(capabilities.relativeHumidityMeasurement) then
profile_name = profile_name .. "-humidity"
-- Soil Sensor fingerprints to the humidity profile, so we should also check for
-- TemperatureMeasurement, which is an optional cluster for this device type.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

might be worth adding a TODO comment about having a new category for soil sensor. Otherwise this kinda doesn't make sense why there'd be a separate profile

Comment on lines +85 to +86
update_device_profile()
test.wait_for_events()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest we break this into a separate test. I don't think we need to test the do configure profile update in a relative humidity report test. I think this makes changing tests later more difficult. Same comment for other tests.

Basically I think we should have this profile update be its own test, separate from everything else.

@nickolas-deboom nickolas-deboom force-pushed the feature/matter-soil-sensor branch from c744895 to b3cc43b Compare April 21, 2026 19:29
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.

2 participants