Author Topic: Ecobee 3 Plugin --> How long does a PIN last?  (Read 601 times)

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Ecobee 3 Plugin --> How long does a PIN last?
« on: February 12, 2018, 12:37:59 pm »
I updated my ecobee 3 plugin's PIN number the middle of last week. This morning Vera is saying, "ecobee : Not yet authorized. Press 'Get PIN' once; wait for PIN; enter at ecobee.com." Yet in the Ecobee web interface - it shows that Vera is still authorized.  How long does this authorization last? IF this is a Vera error, where do I look to find out why it is not retaining the authorization?

Thanks!

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 514
  • Karma: +6/-12
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #1 on: February 13, 2018, 08:20:16 pm »
The PIN is simply to authorize the device to the Ecobee website. What happens is that the plugin needs a new access token from time to time and it's supposed to happen without any user interaction. If, for some reason, it misses the new token (or reboots before it's committed to storage), then you get the message you describe. There's more to it than this, but that's the jist of it. Remove the "app" from the Ecobee web page and use the new PIN to authorize it again. Used to happen to me fairly often, now it's rare. Reboots seem to be the usual cause, at least for me...

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #2 on: February 15, 2018, 10:59:49 pm »
The PIN is simply to authorize the device to the Ecobee website. What happens is that the plugin needs a new access token from time to time and it's supposed to happen without any user interaction. If, for some reason, it misses the new token (or reboots before it's committed to storage), then you get the message you describe. There's more to it than this, but that's the jist of it. Remove the "app" from the Ecobee web page and use the new PIN to authorize it again. Used to happen to me fairly often, now it's rare. Reboots seem to be the usual cause, at least for me...

I just came back from "fixing" it by deleting the app(s) and reinstalling them. Then reauthorized it and was enjoying the functionality for at least 3 - 5 days before this informative message.

Yes - there was a forced reboot but it was Saturday - many days after the authorization.

Will go thru the delete/re-add procedure once again. . . . Thanks for responding.

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 514
  • Karma: +6/-12
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #3 on: February 17, 2018, 08:59:43 pm »
The Vera is likely rebooting without your knowledge. Mine still does it from time to time for reasons I haven't determined as of yet. It was doing it several times a day and that appeared to be caused by the ERGY plugin (that is installed by default). All it takes is one reboot at the wrong time. Hope you get this ironed out before you get too frustrated. I haven't had to reauthorize in weeks...

Online rafale77

  • Hero Member
  • *****
  • Posts: 1004
  • Karma: +47/-20
    • My Setup
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #4 on: February 17, 2018, 09:00:47 pm »
I have been going for months without this problem. The big factor is to not have the vera reload luup right at the time the token is changing. The API changes the token on a regular basis. For example if you load a config from backup on your vera, you are very likely to have renew your token.
I have been able to stabilize the vera enough to go weeks between a luup restart by moving a lot of my plugins and scenes/automation to Openluup. You can track the reboots by installing the system monitor plugin and set it to send a notification every time luup reloads.
Openluup (93 devices, 88 scenes, 20 apps) controlling HomeAss + VeraPlus (132 zwave nodes, 8 Zigbee nodes, 202 devices, 71 scenes , 3 apps) +  Bridged to Homekit and Alexa

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #5 on: February 19, 2018, 02:08:10 pm »
I have been going for months without this problem. The big factor is to not have the vera reload luup right at the time the token is changing. The API changes the token on a regular basis. For example if you load a config from backup on your vera, you are very likely to have renew your token.
I have been able to stabilize the vera enough to go weeks between a luup restart by moving a lot of my plugins and scenes/automation to Openluup. You can track the reboots by installing the system monitor plugin and set it to send a notification every time luup reloads.

I think the issue is the stability of my Vera Secure. It seems when I have hard reboots, when it awakes everything is screwed up. Wondering if the PIN persists somewhere that is volatile and when I have to do a forced reboot, it is erased.

Well, I've reset it yet again. Thanks for everyone's feedback.

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #6 on: February 23, 2018, 09:11:27 am »
I reset it on the 17th. My Vera unit hasn't needed a force reboot during that time. This morning it asked me to get another PIN. So it lasted 7 days. ALTHOUGH on the Ecobe3 app side, it said the previous PIN was still authorized. So it undoubtedly is the Ecobee app.

Online rafale77

  • Hero Member
  • *****
  • Posts: 1004
  • Karma: +47/-20
    • My Setup
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #7 on: February 23, 2018, 10:25:47 am »
I reset it on the 17th. My Vera unit hasn't needed a force reboot during that time. This morning it asked me to get another PIN. So it lasted 7 days. ALTHOUGH on the Ecobe3 app side, it said the previous PIN was still authorized. So it undoubtedly is the Ecobee app.

The way this token works is:
1. The app sends a request to the API with a 4 letter code,
2. The API generates a token
3. We manually need login into the ecobee account and link the 4 letter code of the app to the API token.
4. The app then connects to the API using this token.
5. The API periodically changes the token. When this occurs it sends a sync up to the app.
6. The App receives the new token and updates it.

If your unit does a Luup reload right when step 5 occurs (or if your internet was disconnected), it misses that the token was renewed so the token is out of sync and you have to manually reconnect by going back to step 1. Of course the API will tell you the link is still valid. The API token is renewed, it is the vera which missed the change while rebooting itself.

The issue is the timing of your luup reload. I don't know anyway around it. It is just that the Ecobee API is pretty strict on these security token.
I have been using this app for many years now and stability has dramatically improved over time without changing the app but by reducing the frequency of Luup reloads... I did this by reducing the loading on the vera, removing apps, removing devices and scenes etc... As I am gradually obsoleting the vera as well turning it into just a zwave stick.
« Last Edit: February 23, 2018, 10:39:14 am by rafale77 »
Openluup (93 devices, 88 scenes, 20 apps) controlling HomeAss + VeraPlus (132 zwave nodes, 8 Zigbee nodes, 202 devices, 71 scenes , 3 apps) +  Bridged to Homekit and Alexa

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #8 on: February 23, 2018, 10:55:37 am »
If your unit does a Luup reload right when step 5 occurs (or if your internet was disconnected), it misses that the token was renewed so the token is out of sync and you have to manually reconnect by going back to step 1. Of course the API will tell you the link is still valid. The API token is renewed, it is the vera which missed the change while rebooting itself.

The issue is the timing of your luup reload. I don't know anyway around it. It is just that the Ecobee API is pretty strict on these security token.
I have been using this app for many years now and stability has dramatically improved over time without changing the app but by reducing the frequency of Luup reloads... I did this by reducing the loading on the vera, removing apps, removing devices and scenes etc... As I am gradually obsoleting the vera as well turning it into just a zwave stick.

WOW - that explains it! We did experience internet issues with one of my routers - it lost internet connectivity for about 1 hour and it had to be rebooted. That must have been the time the new token was sent!

OK - I'll chill. But I wanted to THANK YOU for this explanation! It really cleared things up! If I ever get extra time in my life, I'd love to learn how to develop in this 'language' so I can help update apps. . . Thanks again rafale77

Online rafale77

  • Hero Member
  • *****
  • Posts: 1004
  • Karma: +47/-20
    • My Setup
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #9 on: February 23, 2018, 11:01:38 am »
No Problem, I only somewhat merely reverse engineered someone else's code to make it work on UI7 and learned how it works in the process. It was originally written for UI5.
The irony of it all is that the last remaining source of my Luup reloads is currently the Hue2 Plugin which is a MCV app. All the other 3rd party plugin I have (and I run a lot of them) do not cause unwanted Luup reloads.
Openluup (93 devices, 88 scenes, 20 apps) controlling HomeAss + VeraPlus (132 zwave nodes, 8 Zigbee nodes, 202 devices, 71 scenes , 3 apps) +  Bridged to Homekit and Alexa

Offline gniknalu

  • Full Member
  • ***
  • Posts: 153
  • Karma: +3/-2
Re: Ecobee 3 Plugin --> How long does a PIN last?
« Reply #10 on: March 08, 2018, 10:52:54 am »
No Problem, I only somewhat merely reverse engineered someone else's code to make it work on UI7 and learned how it works in the process. It was originally written for UI5.

As I've stated, when it works, it's great!   :)

But I've basically given up on the PIN issue and will let it sit around without being in sync until something changes with how it is working.