Z-way token Expiration
-
It sticked for over a month, now i'm suddenly thrown out again.. @akbooer: I see in the log that the bridge knows its not logged in (says so in the reply to commands), could you set a variable for this, so reactor can be set up to notify me when this happens?
Seems to be an issue on the z-way side..
-
-
I'm pretty sure it was there, and there was still "not logged in" in the log.. two days since last luup reload (added some sensors)..
-
Further to your request for a variable flag, there already is one, of course...
...if
DisplayLine1
shows "Login required", then it's lost the token. -
I'm pretty sure it didn't, and "commfailure" was zero as well? Thats why I went to the openluup log to find out what had happened.
I'll see if i can reproduce this state.. -
Confirmed. If I remove the active session for AltUI in Z-Way, i get this situation.
Openluup log:
2021-01-13 16:51:01.685 luup_log:198: ZWay: http://127.0.0.1:8083/ZAutomation/api/v1/devices 2021-01-13 16:51:01.686 luup_log:198: ZWay: Not logged in 2021-01-13 16:51:01.686 luup_log:198: ZWay ASYNC callback status: 401, #data: 13 2021-01-13 16:51:02.722 luup_log:198: ZWay: http://127.0.0.1:8083/ZAutomation/api/v1/devices 2021-01-13 16:51:02.722 luup_log:198: ZWay: Not logged in 2021-01-13 16:51:02.722 luup_log:198: ZWay ASYNC callback status: 401, #data: 13
No visible "not logged in" in GUI, and commfailure is 0?
-
Yes. It’s only set at startup.
-
Ok, and to update DisplayLine1 when the openluup log is told "not logged in" should be an easy fix? I'll see if i can do it myself.
-
@akbooer, Is this the correct way to get DisplayLine updated if 401 is replied for a command?
Line 1761 in L_Zway2.lua:
function _G.ZWay_async_callback (status, response) local delay = POLLRATE debug ("aync callback size: " .. #(response or empty)) if status == 200 and response then local d = json.decode (response) local vDevs = d and d.data and d.data.devices if vDevs then updateChildren (vDevs) end -- delay = POLL_MINIMUM end -- yes, ask for another one soon... -- init = '' -- ... without initialising data version elseif status == 401 then setVar ("DisplayLine1", 'Login required', SID.AltUI) else luup.log (log: format (status or '?', #(response or ''))) end luup.call_delay ("ZWay_async_request", delay, '') -- schedule next request end
-
There's a few problems introduced here:
- there's also a synchronous request which perhaps need to be changed as well
- you've lost the output to the log in the case of 401
- it doesn't change the CommFailure variable or device status
Although I suggested it as a quick-fix, I don't think that useing the DisplayVariable is a particularly good way of flagging the error to a scene trigger (CommFailure would perhaps be more appropriate.)
Is this still an ongoing issue for you (ie. are you losing the credentials on a regular basis?)
-
No, haven't seen it since i mentioned it here.
I agree that commfailure should be set, and as long as something can tell me why shit stopped working without me going into AltUI (cursing), i'm happy.
If this is a viable way to do it, i'll use commfailure instead, and copy the log() line to the elseif and to the sync function.The reason why the line drops should offcourse be addressed, but I think this is an important feature nevertheless, as there might be bugs in z-way and it seems to take a while between updates there..
I don't think i've had a single luup reload by the system since I was running Vera..
-
@perh said in Z-way token Expiration:
If this is a viable way to do it, i'll use commfailure instead
No, it’s not sufficient to do that, since device status and last failure time will not be set.
You need to use
luup.set_failure()
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_set_failure
There need to be a few more changes to the ZWay module in the plugin too.
I’ll post a new version shortly, so that it’ll be in the baseline.
-
ZWay development branch v21.1.19 has a fix.
As well as setting
CommFailure
, it also setsCommFailureTime
, and the internal device status, which turns the plugin's device banner red on both AltUI and the openLuup console interfaces.As I've said many times, this whole plugin was just a prototype and it seriously need rewriting to improve maintainability... but, nevertheless, it does work quite well.
-
It definately does. (work well, that is) Thanks!
-
Token lost again today..
The z-way-server.log seems to be about z-wave communication only, wonder if I can find traces of wtf is happening with the token somewhere as well?
-
Is this exactly 7 days after it was refreshed?
-
nope. 9 days..
-
Updated openLuup to v. 21.6.8 yesterday. I notice the z-way bridge has lost connection. and requires login. When I go to device/actions there is no way to enter credentials - only a login button.
-
Ooh, good spot! NO idea where that's gone. Will take a look.