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

Indicate why adding an association is not allowed or failed #6772

Closed
duylong opened this issue Feb 27, 2024 · 8 comments · Fixed by #6935
Closed

Indicate why adding an association is not allowed or failed #6772

duylong opened this issue Feb 27, 2024 · 8 comments · Fixed by #6935
Labels
enhancement New feature or request

Comments

@duylong
Copy link

duylong commented Feb 27, 2024

Hi,

I recently tried to add an association between 2 devices that did not have the same level of security. I got the errors below:

error1

error2

Once you know the problem it's easy, but if you don't, the message doesn't help.

Is it possible to improve the error message?

@duylong duylong added the enhancement New feature or request label Feb 27, 2024
@robertsLando
Copy link
Member

@AlCalzone What are the possible reasons why an association could not be allowed apart of security?

@AlCalzone
Copy link
Member

I've been thinking of adding an enum with possible reasons, since there are a few actually. Should I move this to my repo as a feature request?

@robertsLando
Copy link
Member

Yeah I think it makes sense 👍🏼

@AlCalzone AlCalzone transferred this issue from zwave-js/zwave-js-ui Apr 16, 2024
@AlCalzone AlCalzone changed the title Best message in case of failure for association with different security level Indicate **why** adding an association is not allowed or failed Apr 16, 2024
@AlCalzone AlCalzone changed the title Indicate **why** adding an association is not allowed or failed Indicate why adding an association is not allowed or failed Apr 16, 2024
@AlCalzone
Copy link
Member

The driver will include the reason for the failure in the thrown error starting with version 13.

@robertsLando
Copy link
Member

Nice! No changes required on my side so as I already show the error thrown :)

@AlCalzone
Copy link
Member

do you use isAssociationAllowed?

@robertsLando
Copy link
Member

Yes:

for (const a of associations) {
					if (
						this._driver.controller.isAssociationAllowed(
							source,
							groupId,
							a,
						)
					) {
						this.logNode(
							zwaveNode,
							'info',
							`Adding Node ${a.nodeId} to Group ${groupId} of ${sourceMsg}`,
						)

						await this._driver.controller.addAssociations(
							source,
							groupId,
							[a],
						)

						return true
					} else {
						this.logNode(
							zwaveNode,
							'warn',
							`Unable to add Node ${a.nodeId} to Group ${groupId} of ${sourceMsg}, association not allowed`,
						)
					}
				}

@AlCalzone
Copy link
Member

Then you'll need to change something, see linked PR. I'll also write migration docs for v13 like usual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants