Add Matter water valve support and example sketch - #182
Add Matter water valve support and example sketch#182Ludovic BOUÉ (lboue) wants to merge 3 commits into
Conversation
Tamas Jozsi (silabs-bozont)
left a comment
There was a problem hiding this comment.
Thank you for implementing this - it'll be a great addition to the library. I've tested it with Home Assistant - works as expected. I had a few minor remarks, after fixing them we're good to go.
0feac94 to
067c73a
Compare
|
Push fixes into 067c73a |
Restricts the public setter to defined fault values instead of an arbitrary uint16_t, per PR review feedback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
|
||
| // Valve Configuration and Control cluster attributes | ||
| DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(waterValveConfigurationAndControlAttrs) | ||
| DECLARE_DYNAMIC_ATTRIBUTE(ValveConfigurationAndControl::Attributes::OpenDuration::Id, INT32U, 4, 0), /* Open Duration */ |
There was a problem hiding this comment.
Most of these attributes should also be nullable by having ATTRIBUTE_MASK_NULLABLE.
The only ones which are not nullable are ValveFault and FeatureMap.
I noticed that in Home Assistant if I set the Default open duration to something other than 0 - it'll not let me go back to zero, possibly this is the cause for that.
There was a problem hiding this comment.
Thanks for the update, I've tested it, however the Default open duration is now vanished from HA. The attributes are now correct however. This might be an issue on Home Assistant's side. Can you also please test it on your setup to see if you have the same issue?
There was a problem hiding this comment.
Good point. I'll fix that issue:
home-assistant/core#177128
There was a problem hiding this comment.
That's awesome! Thank you for going out and fixing the issue in HA.
There was a problem hiding this comment.
The patch has been released in the dev branch for an upcoming beta release.
OpenDuration, DefaultOpenDuration, RemainingDuration, CurrentState and TargetState are all nullable per spec, and OpenDuration/DefaultOpenDuration have a min value of 1, so "no duration configured" must be represented as null rather than 0. Without ATTRIBUTE_MASK_NULLABLE, writes of null (e.g. clearing DefaultOpenDuration from Home Assistant) were rejected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add Matter Water Valve support
Summary
MatterWaterValveArduino API on top of the Matter Valve Configuration and Control cluster (device type0x0042), following the existingDevice/MatterEndpointpattern used by other Matter appliances in this core.DeviceWaterValveclass (libraries/Matter/src/devices/DeviceWaterValve.{h,cpp}) implementingCurrentState,TargetState,OpenDuration,DefaultOpenDuration,RemainingDuration, andValveFaultattributes, plusHandleReadEmberAfAttribute/HandleWriteEmberAfAttributeoverrides.MatterWaterValve.{h,cpp}with a public API to open the valve indefinitely or for a set duration, close it, and read/write duration and fault state, along with a command handler for the cluster'sOpen/Closecommands.MatterEndpoint.h(DEVICE_TYPE_WATER_VALVE) anddevices/MatterDevice.h(kDeviceType_WaterValve).matter_watervalveexample sketch demonstrating commissioning, opening the valve with a countdown duration, closing it, and mirroring valve state on the built-in LED.test/build/test_build.pyundertestlist_matterso it's built by CI across all Matter-capable boards.