Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Unhandled promise rejection #7

Open
maxmulready opened this issue Jul 6, 2018 · 17 comments
Open

Unhandled promise rejection #7

maxmulready opened this issue Jul 6, 2018 · 17 comments

Comments

@maxmulready
Copy link

Hi,

This plugin has been working great for months, but today it stopped and I noticed that I'm getting an unhandled promise rejection warning when I try to run homebridge. Seems like ThinkEco has updated their website...maybe this has something to do with it?

@dave-atx
Copy link
Owner

dave-atx commented Jul 6, 2018

Ah, yep, you're right -- looks like the website got redesigned. I'll try to see if I can make some updates over the weekend to fix things.

@wezmininger
Copy link

wezmininger commented Jul 6, 2018

This is the error I see from within homebridge plugin in Hassio.

Hope the new website is more responsive, faster and just better overall than it has been the last couple years.

(node:713) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): StatusCodeError: 302 - "<html><head><title>Object moved</title></head><body>\r\n<h2>Object moved to <a href=\"/Account/Login\">here</a>.</h2>\r\n</body></html>\r\n"

(node:713) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@rodalpho
Copy link

rodalpho commented Jul 7, 2018

Their site would almost have to be better!

@matthew-gerstman
Copy link

I've been attempting to get this to work but no luck. For some reason It's either not logging in or the cookie is not persiting

  async auth() {
    if (Date.now() - this.lastLogin > LOGIN_FREQUENCY) {
      this.log('api', 'logging in...');
      const response = await this.session.post(
        'https://web.mymodlet.com/Account/Login',
        {
          // form: {'returnUrl': '/Dashboard/Index'},
          json: {data: {'Email': this.username, 'Password': this.password}},
          followRedirect: false,
          simple: false,          
        }
      );
      return response;
    }
  }

  // return an iterable of all of the Thermostats in the account
  // will retain a reference to and update the current status of
  // all returned Thermostats each time it's called
  async getThermostats() {
    // we only want a single concurrent call to mymodlet.com
    // because this is quite expensive. without a lock, multiple
    // concurrent operations here makes updating multiple attributes
    // on a thermostat(s) is pretty slow.
    await this.lock.acquire();
    if (Date.now() - this.lastUpdate > UPDATE_FREQUENCY) {
      this.log('api', 'updating thermostat status...');
      const auth = await this.auth();
      
      const statusTxt = await this.session.get('https://web.mymodlet.com/Devices/UpdateData');
      console.log(statusTxt);      

@DFurnes
Copy link
Contributor

DFurnes commented Jul 12, 2018

I was able to get this working in #5. For whatever reason, responses are given as stringified JSON and requests must be formatted as stringified JSON inside a data property... 🤔

@maxmulready
Copy link
Author

maxmulready commented Jul 12, 2018

Not to be a pain, but I am now getting an error that says
Unable to read/write thermostat.
at Thermostat.handleErrors (/usr/local/lib/node_modules/homebridge-platform-smartac/index.js:191:19)
at /usr/local/lib/node_modules/homebridge-platform-smartac/index.js:247:12
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:39542) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:39542) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Something on my end perhaps?

**To clarify, the plugin will run fine until I initiate any commands through the Home iOS app, and then this error occurs

@MRyanNYC
Copy link

Not a programmer, just a regular user of this extension.

Dave-ATX - Thanks for your hard work and I am sure you'll get this resolved.
DFurnes - Reading over your changes in #5, I hope that Dave will implement them.

@StJoHo
Copy link

StJoHo commented Jul 17, 2018

I Can’t tell you how much I miss this app working, and now that I know a fix is in sight I’m hopeful, given the current heat in NYC that my favourite and most used home automation app returns soon. You really forget how reliant you are on them and after having such great control it’s awful to now be back at 4am waking up because the ac is back to its old tricks and the rooms so cold you need the comforter. I know everyone does this in spare time and it’s appreciated.

Imagine much begging to see it working again as I realise my apt just hit 90 and the Modlets have all disconnected.

Help me Obi AC Kenobi. You’re my only hope.

@RickyRomero
Copy link

For what it's worth, this works for me:

npm i https://github.com/DFurnes/homebridge-platform-smartac/tarball/heater-cooler

This will add @DFurnes's fixed branch as a dependency directly, so you don't have to wait for #5 to be merged.

Alternatively, you can replace the dependency manually in package.json:

From:
"homebridge-platform-smartac": "^1.1.2"

To:
"homebridge-platform-smartac": "https://github.com/DFurnes/homebridge-platform-smartac/tarball/heater-cooler"

Stay cool. ❄️

@MRyanNYC
Copy link

Sorry to be such a newb, but can you let me know the full path to the file I need to change? Stumbling around I had found two different config.json files (one for SmartAC and one for Homebridge itself) but didn't find the line you reference in either. Thanks!

@RickyRomero
Copy link

@MRyanNYC That line goes in package.json. If you have vanilla homebridge, try running:

sudo npm uninstall -g homebridge-platform-smartac
sudo npm i -g https://github.com/DFurnes/homebridge-platform-smartac/tarball/heater-cooler

@MRyanNYC
Copy link

@RickyRomero Thanks, that worked for me.
@DFurnes Thank you as well.

@wezmininger
Copy link

I am running Hassio using the builtin Homekit library (the homebridge addon is being deprecated as the homekit integration is built out)
Is it possible to install into latest Hassio 74.2 on HassOS (the newest non resin based)

@metameric
Copy link

These modlets are so much more useful when they're working through Homebridge. I've learned a ton from the coding efforts here - kudos @dave-atx. Thanks @RickyRomero for noting @DFurnes fork with those great fixes. They're working for me and hope they can be incorporated in the master.

@ifunlisted
Copy link

Couldn't agree more @metameric. Without Homebridge and this platform, they are more frustrating than useful. It astounds me how bad the smartAC app is and how ThinkEco could let it go for this long without any updates...especially when the modlets themselves are so valuable and in demand.

Anyway, one odd thing... my temp selector will not stop at 79 degrees. It just skips from 78 to 80. Is anyone else seeing this?

@MRyanNYC
Copy link

MRyanNYC commented Sep 7, 2018

Both my Smart AC units are showing the dreaded "No Response" message. Rebooted my computer, where HomeBridge runs, and still nothing. All other non-HomeBridge Homekit items are working.

Anyone else seeing this? SmartAC issue?

@StJoHo
Copy link

StJoHo commented Sep 7, 2018

Mines is still working and all ac u it’s connectwd and working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests