-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
[feat] Add API to configure associations to a final state #186
Comments
I also think that this API could help reduce chatter on the z-wave networks. It's my impression that the defaults of many devices, is to send all updates to node 1 (the controller).. This makes the networks "just work", but also introduces a lot of potentially unnecessary messages. Removing the node 1 from many of the groups would go a long way to reducing this. :) |
@LordMike I don't get this. Without the lifeline association devices will not work, it's used to push changes to controller |
Ah yes - but if you don't need the updates of changes. This could be a way to achieve this. A device default could also be the controller in multiple other groups to "make it just work". For my power plugs, I think this is the case - they report three values (power usage W, amperage A and some other thing) in three messages.. Iirc, these came over the lifeline group with no way to choose not to get them. Additionally, the controller isn't always no. 1. :) |
@LordMike I dunno about the controller id but AFAIK by default all devices need lifeline and I dunno all the possible downsides about not setting this. @AlCalzone ? |
If you look here (and the following lines) you will see that this is taken care of:
The first thing when we do this is that 99.99% of our users will complain that the UI/Application they use falls out of sync with the devices. I think the specifications for ZWave+ V2 even require that the devices report all their updates through the lifeline, so they will probably not even get polled anymore after a set. Which means you'd be flying blind without the feedback. |
I do agree that bulk-configuring associations makes sense, but you can already do that in two commands: We could extend removeAssociations to remove all of them, but as I wrote above, you probably don't want to do that. In general, getting Associations configured correctly is very tricky, so it is best to let the controller take care of that for you where it can. The following points must all be considered:
|
With those two commands, in addition to Now the request is just for zjs2m to have this feature :) |
And I would not, of course, at any point advocate for a function that automatically removes every default configuration there is. removeAssocation should do exactly that, remove the specified associations. A high level API, like for ZJS2M, could provide a desired state API, that changes the device into whatever is needed - while doing as few API calls as possible. :) I can probably make this API myself, if I can figure out how to call get get/remove/add associations over MQTT. |
@LordMike You can call all zwave functions with: https://zwave-js.github.io/zwavejs2mqtt/#/guide/mqtt?id=zwave-apis |
@LordMike Does that solves your problem? |
I was caught up in work the past few days. It might. For others interested. This is a direct link to the associations API's @ zwave-js. (It was tricky to find .. the search isn't very helpful). |
Ah. Apparently I was missing an |
Nevermind.. I was reading the events docs.. Needed to scroll down. |
So I've been publishing to I found this code, which I think is being called, and it's odd - because this differs from the zwavejs docs. In this code, groupId is required, but adding that (0..25) doesn't provide any results either. I've been publishing I even iterated the nodes/groups from the getNodes, and couldn't find a pair that produced anything but []'s. Other notes:
|
You right, I could extend that to return all associations if groupId is not specified, would it be ok for you?
Because that is actually used in |
Perfect. Do you know why the results I get is always
I'm not interested in the API, I think.. It was more of a jab against the statement on the docs, saying "You have full access to all zwavejs APIs (and more) by simply using MQTT." ... The list of allowed apis kinda limits that :) ... and f.ex. the extra parameter on |
What are the args passed?
You absolutely right, in dact that comes from the old zwave2mqtt where I simply called the zwave apis without any checks, now I have encapsulated all zwave apis in other functions to better handle them, I have created this as a reminder: #260 I will look at it once I have more free time to improve docs :) |
I provided two numerics, a node id and a group id - I also tried with node id alone. But were plain numbers, in the Zjs2mqtt has the data. And I tried requesting it with:
Each time I get a response, with the following: {"success":true,"message":"Success zwave api call","result":[],"args":[]} ... curiously, I just checked the debug log on the UI: So... Node 27 is undefined?
It is node 27 I'm testing at: |
Ooh, the code says this message appears when the nodeId in the args is undefined.. I'm seeing other code saying the input is incorrect. |
Yeap. I figured it out. The actual input is "args". Not "data". I have no idea where I got "data" from.. :| |
I'm getting the associations from that.. So yea, it probably works out in the end. I would suggest that an error is returned, if the call actually doesn't work. |
Hey - just wanted to report back that I'm now using get/add/remove associations to setup my home. In the pic below, my program took a file I created that maps desired associations, and applies them to the result of getAssociations (to get add and remove). What we see here is partly that apparently the lifeline association for the devices has two associations with the controller.. I tested, and only the Maybe one day this could be a visual tool... :) I actually got a bunch of errors from this (besides, my topics were wrong): Investigating. |
The warning I showed before, comes from here - but even though the method threw an exception, the associations were removed from Z2M. I've refreshed some of the nodes, and the associations are still gone - so I think it came through. |
Humm really strang. @AlCalzone Do you know why this hjappens ? @LordMike COuld you send me a log output of zwavejs when you send the removeAssociation command? So we can see what's going on in the lower level |
Which one? Which device? |
ZDB5100 from Logic Group. Apparently, there are two associations to node 1 - one targeting endpoint 0, and one targeting endpoint 1. I've now removed the one targeting endpoint 1, and written to the company asking why it might be there. The device works without this association (I still get updates etc..). It's my impression that having two, just makes for double the traffic. |
I'm not sure where that came from. Devices don't have associations out of the box. These are assigned by controllers, so maybe OZW or something else added them. But an association to the controller, endpoint 1 seems pointless. |
Oh. Well, they've definitely been added using OZW. Re-including with zwave-js did not yield the 1.1 association. |
zwavejs2mqtt
zwave-js
@AlCalzone notice the @robertsLando here are the logs. It doesn't seem like zwave-js reports anything odd, perhaps except that the association report comes in twice? |
It does look like 20:2 was successfully removed. The duplicate report is a result of polling after the command. I'm working on a more general solution for that. |
And that is totally a bug. Seems like your device only supports Multi Channel Associations, but that should not raise an error. |
Should we close this, now that zwave-js has an issue? |
fixed, the logic had a little bug when trying to remove only multi-channel associations |
Is your feature request related to a problem? Please describe.
I maintain a desired state configuration for my z-wave items besides OZW/Z2M/ZJS2M .. this configures my devices (we've discussed templated configurations before) and configures HASS with desired discovery documents. What I haven't currently got, is associations between devices.
Describe the solution you'd like
I'd like an API, where I can configure the associations for a device in one go.
For example, I could post this message to MQTT:
Describe alternatives you've considered
I could probably cook something up that does a series of "getAssociation" and add/removes.. But I imagine this could be a precursors to something that's part of ZJS2M.
Additional context
N/A
The text was updated successfully, but these errors were encountered: