Closed psy0rz closed 2 years ago
it never worked correctly, so 1.1.1 didnt actually break it, but i hoped it would fix it :)
strange: I've deleted the evohome session, which then became "[object Object]" and now it works!
Also: why does node-red crash if a module isnt handling an exception? shouldn't be there some kind of global exception handler that catches everything a module throws?
i also just ran into the issue.
the cause seems as follows.
globalContext object is serialized to disk (at least in my configuration) while node-red is stopped/started/restarted.
unfortunately that context within evohome-session holds functions and potentially other stuff that cannot go to JSON and back, especially its prototype structure. so while the nodes wake up after a restart of node-red the globalContext.get("evohome-session") returns an object that "seems" to be as expected but in fact is not and session.getLocations() is of course gone. this seems to be fixable alone by deleting the evohome-session from global context. i still dont know if removing that during runtime is safe or if a restart should also be done after that.
one possibility to fix the issue would of course be to ask in evohome-status.js not only
if (!globalContext.get('evohome-session')) {
but instead
if (!globalContext.get('evohome-session') || !globalContext.get('evohome-session').getLocations || !globalContext.get('evohome-session').getLocations.apply) {
in order to "start with a new session object from scratch" including all constructors and prototype hierarchy.
but i am sure the problem would probably be better fixed by not storing implementation in session objects that in my opinion are designed to only hold data.
i observed situations where node-red complains about getLocations(). i also observed node-red to crash entirely and needs to be started in safe mode in order to remove the broken session from global context. i can only guess that in this case the missing functions or prototype members cause errors so deep inside red-matic that it decides to simply stop.
ok i fixed it for me in the two places:
evohome-status.js line 15 replaced with: if (!globalContext.get('evohome-session') || !globalContext.get('evohome-session').getLocations) {
evohome-control.js line 12 inserted: if (!session.getLocations) session = null;
this fix is not a beauty but now i can restart node-red and use evohome-status (evohome-control i did NOT test) without exceptions or crashes...
@realgnark can you try current source and if it solves your issue? If you confirm fix works I'll publish new NPM package ASAP. Thank you!
ok i ll give it a try. unfortunately currently i have to manually copy over stuff back and forth. so a code review showed you
tested everything and it works exactly as expected :)
Published new version to NPM. Thank you for verifying.
Probably related to #1 and the 1.1.1 fix you just uploaded?
My nodered keeps crashing when it tries to get the temperature: