Open beefcheeks opened 2 years ago
Thanks for getting this together @beefcheeks. Hopefully @karlg100 has a chance to review and pull this in sometime soon.
@beefcheeks any chance you can post your fixes in it's own branch and npm? Not sure the original dev is still monitoring or updating his plugin.
Hey all. This is what I'm getting even after applying every fix I've found on these threads. Not a coder. Just copying and pasting. I've also noticed that since the release of the new Frigidaire app, not only is the plugin not working, but, I'm unable to control my unit it with my google home. Don't know if it's related.
[6/6/2023, 3:38:31 PM] [homebridge-frigidaire] Child bridge process ended [6/6/2023, 3:38:31 PM] [homebridge-frigidaire] Process Ended. Code: 1, Signal: null [6/6/2023, 3:38:38 PM] [homebridge-frigidaire] Restarting Process... [6/6/2023, 3:38:39 PM] [homebridge-frigidaire] Launched child bridge with PID 28541 [6/6/2023, 3:38:40 PM] Registering platform 'homebridge-frigidaire.Frigidaire' [6/6/2023, 3:38:40 PM] [homebridge-frigidaire] Loaded homebridge-frigidaire v2.1.3 child bridge successfully failed to parse auth result json: '[object Object]'
/usr/lib/node_modules/homebridge-frigidaire/node_modules/frigidaire/lib/frigidaire.js:539
var sessionKey = body.data.sessionKey
^
TypeError: Cannot read properties of undefined (reading 'sessionKey')
at Request.authPostCallback [as _callback] (/usr/lib/node_modules/homebridge-frigidaire/node_modules/frigidaire/lib/frigidaire.js:539:37)
at Request.self.callback (/usr/lib/node_modules/homebridge-frigidaire/node_modules/request/request.js:185:22)
at Request.emit (node:events:513:28)
at Request.
Hey, thanks for creating this plugin - it is great being able to operate my AC inside of the Home app.
This PR fixes a warning and stacktrace caused by a combination of cyclical logic and incorrect function return values involving the getCleanAir and setCleanAir functions. Sample warning and stacktrace below:
These changes fix the stacktraces and enable expected behavior for the clean air switch (my AC model supports this switch). In conjunction with #41, I believe this fixes all known issues I've seen with this plugin. I'd also like to note that while the set command updating the clean air switch works well, the get command shortly after a set temporarily sets the switch back to its previous state for a few seconds. This is likely because the AC itself isn't returning the updated state when a get request is made. Without introducing a caching layer, I think this is actually expected behavior.