We have moved at community.getvera.com

Author Topic: Plug-in for ecobee thermostats in development  (Read 231071 times)

Offline niharmehta

  • Sr. Member
  • ****
  • Posts: 377
  • Karma: +17/-0
Re: Plug-in for ecobee thermostats in development
« Reply #780 on: October 26, 2018, 11:33:56 am »

This is odd. Let me look into it though it may not be immediate since I need to sleep and work tomorrow. The logs seem to indicate something very simple. Seems like a variable not properly declared in the code somewhere. I have not seen this on openLuup so it maybe some specific vera syntax.

Edit: I found where I messed up. I updated the repo. You can just download the I_Ecobee1.xml which contains the fix. I also edited v2.1 hoping not too many people downloaded it. The thermostat should work now. Thank you for testing and reporting it.

@rafale77, thank you. I just updated and it looks like everything seems to be working now.  I will keep your version  since I have my own dev key. I really appreciate @watou and your efforts to immediately jump on this and fix it.   The Ecobee has become critical part of several of my automations and when they went offline, it broke a lot. 
2x VeraLite; 2xTrane Tstats; 45 x Switches/Dimmers/Appliance Modules; 4x Everspring Water Sensors; DSC Integration; 2 x Zwave Door Locks; 1x Ted5K; 1x Rainforest Eagle; Onkyo AVR; 6x Squeezebox;

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Plug-in for ecobee thermostats in development
« Reply #781 on: October 26, 2018, 12:07:56 pm »
Watou, 1.9 works perfectly..many thanks for doing this so quickly!!  Will the plugin change potentially affect the daily PIN requests I was having to make?  It was only in the last two weeks or so it started to do this...

Rafale, thanks to you as well.  Your files just copied into the UI7 setup did get me the home/away functionality that most of my automations use, however GUI changes to temp in Vera did not "reach" the actual ecobee stats.  I'll keep the files tucked away in case we need them :-)

Ha... actually I fixed the problem you are describing as well as reported by @niharmehta. Just have to replace one file but there is no fundamental reason to use my version on a vera at this point since Watou updated the mios appstore version.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline theal

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #782 on: October 29, 2018, 01:47:05 pm »
The Vera folks responded very quickly, publishing 1.9 of the Ecobee plugin in record time!  Now if someone is willing to upgrade from 1.8 to 1.9 and see if it works, that would be much appreciated.  I don't want too many people upgrading before there is empirical evidence that it actually fixed the problem!

I don't see a way to update to 1.9 on "My Apps" on both UI5 & UI7.
However, I do see it lists v 1.9 under "Install Apps" in UI7 (Ecobee is not in the plugin list for UI5 for some reason).
Is there a way to update to the new version without deleting/installing?



Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #783 on: October 29, 2018, 01:51:36 pm »
Weird. In UI7, in the Ecobee App screen in My Apps, the should be a button to upgrade. I have two buttons, "Create Another" and "Update App".

Offline denwood

  • Sr. Newbie
  • *
  • Posts: 41
  • Karma: +3/-0
Re: Plug-in for ecobee thermostats in development
« Reply #784 on: October 30, 2018, 01:20:49 pm »
Theal, in your first attachment there is an update button.  Just use that.

Watou, apparently the tLs line change also fixed the frequent need for pin reissues at my end. It?s been solid for four days now.

Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #785 on: October 30, 2018, 02:36:20 pm »
denwood, I had one of mine drop last night. Reloading the Vera engine brought it back.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Plug-in for ecobee thermostats in development
« Reply #786 on: October 30, 2018, 02:55:05 pm »
I am still getting some communication errors causing the plugin to think that it is disconnected. As soon as you send a second command it shows as reconnected.

@fullmoonguru, instead of a Luup reload, try sending another house mode change. I think it shows reconnected right away. I may look into this error handling so it reports an error instead of an API disconnection when I have time.

FYI, The error I am getting from the API is "Error: create function not permitted: value expected at line 1, column 1". It is intermittent and is so far always eliminated after a second call. My patch so far as been to write my scene to repeat the call within 5s of the first one. I will look to build it into to the plug-in.
« Last Edit: October 30, 2018, 03:03:37 pm by rafale77 »
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #787 on: October 30, 2018, 03:33:55 pm »
I'll try next time one drops.

Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #788 on: October 30, 2018, 04:01:17 pm »
I have one disconnected now. Changing mode didn't work, but then neither did reloading the engine. So I guess this is the case where it dropped teh token so I'll have to get a new pit & register with Ecobee. Just wanted to to see if there was something else you wanted me to try.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Plug-in for ecobee thermostats in development
« Reply #789 on: October 30, 2018, 04:22:27 pm »
Not much I can do after the token is dropped. The question is why it would drop the token. I have not observed this in ages but I run the plugin on openluup, not on vera. If I was to take a guess, I would say
1. internet connection,
2. Unwanted Luup reload which flushed the memory before the updated token could be saved (that's most of my event case when I was running it on the vera)
3. A combination of both (vera rebooting because it lost internet connection somehow)

I am testing a code which retries the API call in case of failure to see if it fixes the problem I observed.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #790 on: October 30, 2018, 04:50:14 pm »
Yeah it might be because of dropping the internet. I have four systems with Ecobees on them & a combination of having to get teh pin again or just reloading the engine to get them back up. The controller on this one sent me an alert earlier that it was down, then back up. Assuming it wasn't just the Vera bug that's constantly telling me that when it's not actually true (ugh), that makes sense.

I asked earlier about how to get notification when the Ecobee drops but I don't know enough about using lua code to do that. Could you spell that out a little more for me please? I basically need the full code to paste.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Plug-in for ecobee thermostats in development
« Reply #791 on: October 30, 2018, 05:29:16 pm »
Yeah it might be because of dropping the internet. I have four systems with Ecobees on them & a combination of having to get teh pin again or just reloading the engine to get them back up. The controller on this one sent me an alert earlier that it was down, then back up. Assuming it wasn't just the Vera bug that's constantly telling me that when it's not actually true (ugh), that makes sense.

I asked earlier about how to get notification when the Ecobee drops but I don't know enough about using lua code to do that. Could you spell that out a little more for me please? I basically need the full code to paste.

I am doing this on openLuup/Altui. There are multiple ways to do it so let's take this in steps:

1. Get a notification service. Do you want to use the native vera one or vera alerts or any other service? You probably want to look it up. I personally use pushover and go through a local notification API I set up on home assistant. Basically vera/cameras/openluup all send their notifications to home assistant which then sends them to my devices through the Pushover service. I used to use the mcv one which requires knowing your user id (I found in my logs) to send customized notification messages through their API. The lack of reliability made me give up on this.
2. Once you have that notification service, I suppose you would have an url for it or a REST API call to generate the notification which is a constructed http url. Generally a "post" call. If you use VeraAlert, that plugin will do it for you so you may want to look at it.
3. On the vera create a manually triggered scene which would send this call. I am pretty sure it would make use of a Vera Alert function. For me it is a Lua code to send a message.
4. create a "luup.variable_watch"  with the corresponding function like below in your startup Lua:

Code: [Select]
luup.variable_watch("ecobeeupdate", "urn:ecobee-com:serviceId:Ecobee1", "Status", k)
function ecobeeupdate (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
    if tonumber(lul_value_new) == 1 then
        luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="**12345**" }, 0) --** scene number of the scene you created to send notification of connection
   end
   if tonumber(lul_value_new) == 0 then
        luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="**123**" }, 0) --** scene number of the scene you created to send notification of disconnection
   end
end

If you know the action to send the notification directly without a scene, you can even avoid creating a scene altogether and just post that call instead of the run scene I have suggested. As I said, there are many ways to do this.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Plug-in for ecobee thermostats in development
« Reply #792 on: October 31, 2018, 11:44:25 pm »
So far I have had no event of ghost disconnection with the one retry solution but the error from the API has been too intermittent for me to conclude yet. I will continue to test for a few more days and if successful will release the fix.

The only fix I can think of for those who have the actual key loss is to eliminate luup reloads and vera reboots or better yet, move to openLuup. The loss mechanism I observed is the vera reloading while the API key renewal is occurring and not saving it properly in the user data file. It would then reload with the old expired key and disconnect from the ecobee API server.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline fullmoonguru

  • Full Member
  • ***
  • Posts: 207
  • Karma: +0/-3
Re: Plug-in for ecobee thermostats in development
« Reply #793 on: November 01, 2018, 02:13:12 pm »
Thanks for in info. rafale, I'll be looking into this in the coming days.

Offline chasiu

  • Jr. Member
  • **
  • Posts: 67
  • Karma: +0/-0
Re: Plug-in for ecobee thermostats in development
« Reply #794 on: November 01, 2018, 08:37:46 pm »
I have been having a lot of issues with having to get the PIN once a week.  Today I removed 1.8 and installed 1.9.  I am in UI5 and the GET PIN button does not work.  Will this app still work with UI5?  Or is ecobee down right now for getting a PIN?