dre2901 / node-red-contrib-myq

Node-Red node to control MyQ (Chamberlain) devices
5 stars 3 forks source link

Receiving errors with v0.0.9 #12

Closed k5map closed 9 months ago

k5map commented 10 months ago

I just upgraded to v0.0.9 and am still getting "Error received:" and "Could not refresh devices!" errors when I send an INFO request. Even though I get the errors, I do get the correct status of the devices (gate and garage door). Not sure if this error is related to the new release.

rgerrans commented 10 months ago

I reinstalled the new version (had fully uninstalled the nodes) and reconfigured my node. My first info request produced a normal output. Every one after that is generating the same errors as above except I'm not getting the correct status of the devices after that very first request, just the error messages

rgerrans commented 10 months ago

This may help from my log file:

Error: 403 Forbidden myQ API: Unable to access the OAuth authorization endpoint.

dre2901 commented 10 months ago

that's exactly the error that was fixed with 0.0.9. have you tried to change the region from east to west? I don't have any errors anymore with 0.0.9

k5map commented 10 months ago

@dre2901 ... my apologizes as I don't recall seeing how to change regions. I just checked the node and do not see that option. How do I change regions?

k5map commented 10 months ago

@dre2901 Ok after a reboot of my RPi, I now see the region option. I was set to East but when I change to West I am receiving the same errors. Also like @rgerrans I am not receiving any status on either device.

I read in another post you released v0.0.10. My NR hasn't seen that release so will upgrade as soon as I can to confirm if the errors still persist.

k5map commented 10 months ago

@dre2901 ... after doing more investigating, I'm finding even though I send "info" request every 30 seconds (I get the errors each time this request is made) I get the actual status of each device every 6 minutes. Not sure why I can't get the status more often but wanted to pass along my findings.

k5map commented 10 months ago

Things just get more bizarre... this morning all of the errors I've been receiving have stopped AND I did not make any changes on my end. I'm still running v0.0.9 because my NR does not show I can download v0.0.10. Anyone else who were seeing errors, not now?

rgerrans commented 10 months ago

I upgraded to v0.0.10 and still get the errors. I also can't switch from east to west (I try and it just stays east when I reopen the config node)

k5map commented 10 months ago

Well I jinked myself... the errors are back... @rgerrans I have the same issue with v0.0.9 in that if I set it to West, when I reopen the node it shows East.

ahakobyan79 commented 10 months ago

Having the same problems, with same errors, even though everything seems to be correct. It's also impossible to change from East to West, as soon as I close the node settings it changes back to East.

dre2901 commented 10 months ago

Ok, another attempt with 0.0.11. It might be that if you have multiple MyQ nodes there is a kind of throttling on MyQ server and you get kicked out. In my case I have only one node for garage node which I ping every 30 seconds so I have no issues at all. In 0.0.11 I've moved api server declaration into global config node so it will be shared between all your MyQ nodes. Also bug with saving of region is fixed. Now you need to specify the region on the credentials page. Make sure you provide the rest of credentials like username and password there too, as usually password is not saved in flow so you need to re-enter it when changing config page, otherwise after redeploy you'll get all those Could not refresh devices! errors. If still having errors, please post your log here (you can get it with node-red-log when on Raspi https://nodered.org/docs/user-guide/runtime/logging)

rgerrans commented 10 months ago

I updated the node and then updated the config, was still getting the error. I ended up deleting everything (credentials and device node). Re added / configured it and it was working fine. I pulled the serial number from the output message and added that to the node. Then it started giving me errors again.

So repeated deleting everything and started over (didn't input the serial number this time, just device name). I got two successful info payloads and then started erroring again. I'm seeing two sets of api error codes (and sometimes it just returns generic errors):

myQ API: https://devices.myq-cloud.com/api/v5.2/Accounts/[REDACTED]/Devices Error: 403 Forbidden myQ API: Unable to update device status from the myQ API. Acquiring a new access token.

myQ API: https://partner-identity.myq-cloud.com/connect/authorize?client_id=IOS_CGI_MYQ&code_challenge= [REDACTED]&code_challenge_method=S256&redirect_uri=com.myqops%3A%2F%2Fios&response_type=code&scope=MyQ_Residential+offline_access Error: 403 Forbidden myQ API: Unable to access the OAuth authorization endpoint.

On Mon, Sep 11, 2023 at 2:58 AM Dimitry Remenuk @.***> wrote:

Ok, another attempt with 0.0.11. It might be that if you have multiple MyQ nodes there is a kind of throttling on MyQ server and you get kicked out. In my case I have only one node for garage node which I ping every 30 seconds so I have no issues at all. In 0.0.11 I've moved api server declaration into global config node so it will be shared between all your MyQ nodes. Also bug with saving of region is fixed. Now you need to specify the region on the credentials page. Make sure you provide the rest of credentials like username and password there too, as usually password is not saved in flow so you need to re-enter it when changing config page, otherwise after redeploy you'll get all those Could not refresh devices! errors. If still having errors, please post your log here (you can get it with node-red-log when on Raspi https://nodered.org/docs/user-guide/runtime/logging)

— Reply to this email directly, view it on GitHub https://github.com/dre2901/node-red-contrib-myq/issues/12#issuecomment-1713464116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOC2HDQV5NP6ZSRMUBUX53XZ3HDFANCNFSM6AAAAAA4QX3RYU . You are receiving this because you were mentioned.Message ID: @.***>

dre2901 commented 10 months ago

the errors are coming because region (suffix -east or -west) is not present in both Urls above.. which means the patch for @hjdhjd/myq/myq-api.js was not applied or was somehow rolled back.. weird

ahakobyan79 commented 10 months ago

myQ API: https://partner-identity.myq-cloud.com/connect/authorize?client_id=*******&code_challenge=**********************************&code_challenge_method=S256&redirect_uri=com.myqops%3A%2F%2Fios&response_type=code&scope=MyQ_Residential+offline_access Error: 403 Forbidden myQ API: Unable to access the OAuth authorization endpoint. 11 Sep 09:18:06 - [error] [myq-device-node:Garage Door] Error received: 11 Sep 09:18:06 - [error] [myq-device-node:Garage Door] Could not refresh devices! 11 Sep 09:18:06 - [error] [myq-device-node:Garage Door] Error code: undefined 11 Sep 09:18:06 - [error] [myq-device-node:Garage Door] Error message: undefined 11 Sep 09:18:06 - [error] [myq-device-node:Garage Door] Could not refresh devices! myQ API: throttling refreshDevices API call. Using cached data from the past two seconds. 11 Sep 09:18:52 - [error] [myq-device-node:Garage Door] Error received: 11 Sep 09:18:52 - [error] [myq-device-node:Garage Door] Could not refresh devices! 11 Sep 09:18:52 - [error] [myq-device-node:Garage Door] Error code: undefined 11 Sep 09:18:52 - [error] [myq-device-node:Garage Door] Error message: undefined 11 Sep 09:18:52 - [error] [myq-device-node:Garage Door] Could not refresh devices! myQ API: throttling refreshDevices API call. Using cached data from the past two seconds. myQ API: throttling refreshDevices API call. Using cached data from the past two seconds. 11 Sep 09:18:54 - [error] [myq-device-node:Garage Door] Error received: 11 Sep 09:18:54 - [error] [myq-device-node:Garage Door] Could not refresh devices! 11 Sep 09:18:54 - [error] [myq-device-node:Garage Door] Error code: undefined 11 Sep 09:18:54 - [error] [myq-device-node:Garage Door] Error message: undefined 11 Sep 09:18:54 - [error] [myq-device-node:Garage Door] Could not refresh devices!

dre2901 commented 10 months ago

Ok, instead of patching the original @hjdhjd/myq library, I've switched to it's fork @brbeaird/myq which was downgraded from es module to commonjs. So we can make sure it's not a conflict with other dependencies.. published as 0.0.12

k5map commented 10 months ago

@dre2901... I think you fixed it with v0.0.12. I just upgraded; updated my credentials; assigned West as my region and so far no error. YEAH!

My next test is to see if I can get "opening" and "closing" status to work.

k5map commented 10 months ago

@dre2901 ... v0.0.12 is working GREAT. All 3 of the new statuses (opening, closing and stopped) are returned with INFO. Can't thank you enough for getting the errors and new statuses working.

ahakobyan79 commented 10 months ago

I upgraded, it worked right away, then i tried to turn off the light, I got the same set of errors, and now every command give me the same errors again.

rgerrans commented 10 months ago

Upgraded and working. Tested with open / close (garage door) and still working post.

Thanks!!!

On Mon, Sep 11, 2023 at 11:32 AM Anri @.***> wrote:

I upgraded, it worked right away, then i tried to turn off the light, I got the same set of errors, and now every command give me the same errors again.

— Reply to this email directly, view it on GitHub https://github.com/dre2901/node-red-contrib-myq/issues/12#issuecomment-1714307406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOC2HDQ6AWPZOV4HADNGI3XZ5DMJANCNFSM6AAAAAA4QX3RYU . You are receiving this because you were mentioned.Message ID: @.***>

ahakobyan79 commented 10 months ago

@dre2901 should the node still work for the lights too? I'm only able to open and close with payload, anything else causes it to fail again for everything else too, as sson as i try to change the light status.

dre2901 commented 10 months ago

@dre2901 should the node still work for the lights too? I'm only able to open and close with payload, anything else causes it to fail again for everything else too, as sson as i try to change the light status.

Can't test for lamp as I don't have any but I don't any reason why it should not work. We just pass the payload to APIs.

But what I've noticed (and I presume it's exactly your issue) is that if I send some nonsense payload to my garage door then, of course, it fails but also API we are using treats it as authorization error and deletes oauth token. Normally, on next devices refresh call (status) that token is refreshed. But there is some throttling hardcoded inside which does not allow to call authorization endpoint more than once per 2 minutes. That's why you start getting error even for door opener. I have same behaviour. Then, at least for me, everything returns to normal when that 2 minutes timer elapses.

So my suggestion, check what payload you are sending to your lamp. Maybe it's just a wrong one / not supported

ahakobyan79 commented 10 months ago

@dre2901 should the node still work for the lights too? I'm only able to open and close with payload, anything else causes it to fail again for everything else too, as sson as i try to change the light status.

Can't test for lamp as I don't have any but I don't any reason why it should not work. We just pass the payload to APIs.

But what I've noticed (and I presume it's exactly your issue) is that if I send some nonsense payload to my garage door then, of course, it fails but also API we are using treats it as authorization error and deletes oauth token. Normally, on next devices refresh call (status) that token is refreshed. But there is some throttling hardcoded inside which does not allow to call authorization endpoint more than once per 2 minutes. That's why you start getting error even for door opener. I have same behaviour. Then, at least for me, everything returns to normal when that 2 minutes timer elapses.

So my suggestion, check what payload you are sending to your lamp. Maybe it's just a wrong one / not supported

What you are saying makes absolute sense. And it seems that the 2 min thing is true also, I waited, and it worked again. Thank you for that.

As far as other options go, I follow your directions and applied the appropriate string to msg.payload: lamp_on lamp_off on off - for the light

Please let me know if I'm doing something wrong

dre2901 commented 10 months ago

can you try with turnon and turnoff ?

ahakobyan79 commented 10 months ago

can you try with turnon and turnoff ?

same results. 1st request comesback with msg.payload: false, the second time i get the errors.

ahakobyan79 commented 10 months ago

@dre2901 I am really interested in getting to the lights control. Searched google, couldn't find MyQ API anywhere. Do you mind sharing the link to their API Docs if you have it? Thank you.

kskenyon commented 10 months ago

I don't think the built in light on the opener itself can be controlled remotely. The optional accessory light probably can be though.

dre2901 commented 10 months ago

Ah.. I thought you have a separate light device and trying to control it. No, of course, it does not work with opener and that's why you get errors - it does not understand "light/lamp" commands. And, no, I don't have any official docs and presume all those API libraries are results of MyQ app's reverse engineering. But I might be wrong

hitnrun30 commented 9 months ago

It's back... All of a sudden I'm getting the infamous myq credentials error.

I might have a little insight. The myq integration for home assistant had to do an overhaul to work. That may be the reason I am having an issue.

rgerrans commented 9 months ago

I had forgotten to reconnect my auto check and it looks like mine is producing errors as well once I started polling the api again

On Sun, Oct 15, 2023 at 3:58 PM hitnrun30 @.***> wrote:

It's back... All of a sudden I'm getting the infamous myq credentials error.

I might have a little insight. The myq integration for home assistant had to do an overhaul to work. That may be the reason I am having an issue.

— Reply to this email directly, view it on GitHub https://github.com/dre2901/node-red-contrib-myq/issues/12#issuecomment-1763515048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOC2HAQ3AGMP5NZVLVKBQTX7RMA5AVCNFSM6AAAAAA4QX3RYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGUYTKMBUHA . You are receiving this because you were mentioned.Message ID: @.***>

hitnrun30 commented 9 months ago

I had forgotten to reconnect my auto check and it looks like mine is producing errors as well once I started polling the api again On Sun, Oct 15, 2023 at 3:58 PM hitnrun30 @.> wrote: It's back... All of a sudden I'm getting the infamous myq credentials error. I might have a little insight. The myq integration for home assistant had to do an overhaul to work. That may be the reason I am having an issue. — Reply to this email directly, view it on GitHub <#12 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEOC2HAQ3AGMP5NZVLVKBQTX7RMA5AVCNFSM6AAAAAA4QX3RYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGUYTKMBUHA . You are receiving this because you were mentioned.Message ID: @.>

I believe there is already an update that needs to be pushed. The myq in home assistant was just updated. All that is needed is to reference version 1.0.3 instead of 1.0.2

dre2901 commented 9 months ago

fixed in 0.0.15 - new api dependency (with explicit login function in new api)