thomasmunduchira / myq-api

An updated API to interface with myQ devices
https://www.npmjs.com/package/myq-api
MIT License
137 stars 38 forks source link

Cannot run getDevices(): Unidentified error returned from service. #35

Closed johndc7 closed 3 years ago

johndc7 commented 3 years ago

I cannot seem to list any of the devices on my account using getDevices(). I attempted this using example.js from the documentation.

The only error that is logged is MyQError: Unidentified error returned from service.

So I checked the response from axios and found the following response from MyQ:

{
  ReturnCode: '-99',
  ErrorMessage: 'please contact customer care, supportID: xxxxxxxxxxxxxx',
  CorrelationId: ''
}

Any ideas? I am using a MyQ integration for hubitat that still works so I assume MyQ didn't change anything.

Edit: If I change the API Version in constants.js to 5 instead of 5.1 everything works.

vikramprabhu123 commented 3 years ago

I second this. Even, I was seeing this error from 4-5 days. When I changed ApiVersion below to 5 from 5.2, everything is working.

_headers: { 'Content-Type': 'application/json', ApiVersion: '5', BrandId: '2', Culture: 'en', },

cjustinhall commented 3 years ago

Q, @vikramprabhu123 - how are you using the src instead of the npm? Sorry for the dumb Q. I see what you have changed in the src but seems the npm (myq-api) is being used instead. Thoughts? thx

johndc7 commented 3 years ago

@cjustinhall You can change the source files under node_modules\myq-api. The file I was referring to is under node_modules\myq-api\src\constants.js.

vikramprabhu123 commented 3 years ago

@cjustinhall

Apology for not being clear.

Yes I modified "node_modules\myq-api\src\constants.js"

cjustinhall commented 3 years ago

Good stuff. I found that/see that but when i run it seems it is using the (compiled?) myq-api from npm install and not the source. How can I get this setup to use the src not the npm?

johndc7 commented 3 years ago

npm is just cloning the github repo. This library is not minified or compiled. If you edit the file under node_modules and reload your program, it should work.

vikramprabhu123 commented 3 years ago

@cjustinhall You might be already knowing the below.....

Make sure not to use global option for install, instead let it download in local project directory

So please use like below.

npm install myq-api --save

cjustinhall commented 3 years ago

Got it. My stupidity. Working! Wahoo. Thanks all.

pprimm commented 3 years ago

Had the same issue. I can confirm that this change _headers: { ... ApiVersion: '5', ... },

in node_modules\myq-api\constants.js fixed my getDevices() failure

thomasmunduchira commented 3 years ago

Apologies for the delay here! I cut a new release after #37 landed. Shoutout to @StrathCole for this!

Per the discussion on the linked PR, both 5 and 5.2 works, with us going ahead with the latter.