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

Add force send parameter to setOnOffValue and send it on matter start #35287

Conversation

damian-kurek-wizzdev
Copy link

I sent this PR based on matter implementation for esp-matter it might work differently in other SDKs.
This change is useful and required for an onoff device controlled via NC/NO relay.
Since matter controls the startup parameter via "onoff write start-up-on-off" parameter. Connectedhomeip is the only place where the startup relay state can be determined. The current implementation's problem is that it only provides information about the startup relay state when it is different from the last known state before restart e.g.
start-up-on-off is set to On when the last state of OnOff parameter is Off CHIP sends information about state change,
start-up-on-off is set to On when the last state of OnOff parameter is On CHIP won't send information about the state of OnOff parameter

I think this makes it inconsistent and for me sending the state of OnOff parameter always at the start is the best way to go about it, so information about the startup state always comes from on/off server

Copy link

Review changes with SemanticDiff.

@CLAassistant
Copy link

CLAassistant commented Aug 29, 2024

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the app label Aug 29, 2024
@@ -340,8 +340,11 @@ Status OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOff
* @param endpoint Ver.: always
* @param command Ver.: always
* @param initiatedByLevelChange Ver.: always
* @param forceSend Send value of the On/Off even when it is the same as current On/Off value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Send what and where?

At startup, if some hardware state needs to be synced to the state of the On/Off cluster, the right sequence of actions is:

  1. Start up the Matter stack, which initializes the On/Off cluster instance(s).
  2. Read the relevant attributes from those cluster instances (which might involve the StartUpOnOff value, or might involve reading the persisted OnOff state from flash, or some combination thereof).
  3. Sync the hardware state to the desired state as represented by the attributes.

Choose a reason for hiding this comment

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

I think name is a bit incorrect and should be something like force_ember.
What you proposed as syncing of the state will work but it causes duplicate of logic on matter side, I changed it to wait for matter to be started and get this value. I will discard the pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants