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

Added support for Z-Way Authentication token. #11

Merged
merged 6 commits into from Dec 12, 2021

Conversation

PoltoS
Copy link
Contributor

@PoltoS PoltoS commented Sep 6, 2021

Starting from v3.2.0 Z-Way requires Websocket API to be authenticate like HTTP API. This changes the node-red integration module to use the Z-Way auth token instead of login/pass.

You can change back to login/pass and autodetect the token from the first discoverDevices. Up to you

NB! This was not tested - please check before merging.

Should fix: #10

@bkorda
Copy link
Owner

bkorda commented Sep 8, 2021

Could somebody test it? I have no hardware anymore

@PoltoS
Copy link
Contributor Author

PoltoS commented Sep 23, 2021

If you give me a simple instruction on how to install node-red and this module, I can. But note, that I've ZERO experience in node-red

@maggiagg
Copy link

I could test it. I have rpi running with nodered. But I dont have any idea on how to get the fork/pull-request from Github into nodered.
If @PoltoS or @bkorda knows how to do this and give me a short instruction I can test. Otherwise there is some kind of description at https://nodered.org/docs/creating-nodes/first-node#testing-your-node-in-node-red.

@bkorda
Copy link
Owner

bkorda commented Nov 12, 2021

Ok guys, sorry for such a big delay. Will test it and update plugin

@Vinisz
Copy link

Vinisz commented Nov 24, 2021

I tested this, but I need to enter token in the config-node of zway, I used a token grabbed from zway web interface, but that crashes node-red
@PoltoS , seems like PMs not working on zway forum. Did I use the right token or should I do it another way ?

@PoltoS
Copy link
Contributor Author

PoltoS commented Nov 25, 2021

The token is the right one (from Z-Way web UI). I fear my fixes made "in blind" were not correct and that lead to the error. Maybe @bkorda can fix it. If not, we add it to our long queue of tasks.

@Vinisz
Copy link

Vinisz commented Nov 25, 2021

@PoltoS ok thanks, well, I'm not a dev so cannot solve this... Can however test from time to time...
@bkorda , are you able to make this work?

@Vinisz
Copy link

Vinisz commented Dec 2, 2021

Tested on latest Zway release (3.2.2.) as well, still does not work and causes a crash of node-red.

image
2021-12-02T20_45_01_927Z-debug.log

@bkorda

@Vinisz
Copy link

Vinisz commented Dec 2, 2021

@PoltoS , can you check on above please ? maybe it provides some insights.... debug log is there.

@PoltoS
Copy link
Contributor Author

PoltoS commented Dec 3, 2021

I can just try-and-fail if you provide me direct access via SSH and web UI.

@bkorda bkorda merged commit 83e94e2 into bkorda:develop Dec 12, 2021
Copy link

@Vinisz Vinisz left a comment

Choose a reason for hiding this comment

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

Tested this one, still crashes node-red in docker

@bkorda
Copy link
Owner

bkorda commented Dec 13, 2021

Can not reproduce this. I don't use docker. Looks like it is specific issue
image

@bkorda
Copy link
Owner

bkorda commented Dec 13, 2021

Try to remove every server (configuration) node from flow, deploy changes, add a new server node.

@Vinisz
Copy link

Vinisz commented Dec 13, 2021 via email

@Vinisz
Copy link

Vinisz commented Dec 13, 2021

@bkorda , tried directly on the RPI, so node-red and Zway running on same device, same issue, here is the output from the RPI

13 Dec 16:04:01 - TypeError: Cannot read property 'devices' of null
at Request._callback (/root/.node-red/node_modules/node-red-contrib-zway/nod es/server.js:75:59)
at Request.self.callback (/root/.node-red/node_modules/request/request.js:18 5:22)
at Request.emit (events.js:314:20)
at Request. (/root/.node-red/node_modules/request/request.js:1154 :10)
at Request.emit (events.js:314:20)
at IncomingMessage. (/root/.node-red/node_modules/request/request .js:1076:12)
at Object.onceWrapper (events.js:420:28)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

@Vinisz
Copy link

Vinisz commented Dec 13, 2021

Ok, found it after some more testing... I forgot to include the "/" in the API key (that should still not crash node-red but ok)
Now working all fine, in docker as well... @bkorda and @PoltoS , thank you for making this happen ! now I'm finally on latest Zway

@PoltoS
Copy link
Contributor Author

PoltoS commented Dec 13, 2021

Looks like if the token is wrong (missing / or just expired), the answer will be null (403) and as a result node_red crashes. May be it is worth to add such a check not to crash node-red.

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.

No longer working correctly with Zway 3.2.0
4 participants