Errors on Installation

Posted on
Mon Nov 25, 2019 12:55 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Errors on Installation

I just installed the plugin (1.0.5), and it is not creating any devices (I tried changing folder names, picking an already-created folder, or even no folder), and just reporting the error below. No devices are being created, but it seems to be authenticating (since it reports total energy usage). Any ideas?

Code: Select all
Nov 25, 2019 at 12:37:53 PM
   Enabling plugin "Sense 1.0.5"
   Starting plugin "Sense 1.0.5" (pid 72050)
   Started plugin "Sense 1.0.5"
   Sense Debug                     startup called
   Sense Debug                     Authenticating...
   Sense Debug                     Rate limit is: 30
   Sense Debug                     IDs: []
   Sense Debug                     Active: 2428.14306641w
   Sense Debug                     Daily: 33.956337kw
   Sense Error                     Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 203, in runConcurrentThread
  File "plugin.py", line 132, in getDevices
KeyError: 'core'

   Sense Error                     plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Sense Debug                     IDs: []
   Sense Debug                     Active: 2428.14306641w
   Sense Debug                     Daily: 33.956337kw
   Sense Error                     Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 203, in runConcurrentThread
  File "plugin.py", line 132, in getDevices
KeyError: 'core'

   Sense Error                     plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Sense                           Debug logging enabled
   Sense Debug                     Rate limit is: 30
   Sense Debug                     IDs: []
   Sense Debug                     Active: 2428.14306641w
   Sense Debug                     Daily: 33.956337kw
   Sense Error                     Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 203, in runConcurrentThread
  File "plugin.py", line 132, in getDevices
KeyError: 'core'

   Sense Error                     plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Disabling plugin "Sense 1.0.5"
   Stopping plugin "Sense 1.0.5" (pid 72050)
   Sense Debug                     shutdown called
   Stopped plugin "Sense 1.0.5"


Posted on
Mon Nov 25, 2019 3:33 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Errors on Installation

Hi.

Does this fix itself when you start (restart) the plugin?

The 'core' device is created automatically and it's obviously there because you say you're seeing the active total.

In theory next time you start that device (which will happen at plugin startup) it will fix that particular error.

Peter

Posted on
Mon Nov 25, 2019 3:48 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

I've restarted the plugin several times and it is not fixing it. It never creates the device, which looks to be the issue...

Looking at the code (below) it looks like it pulls and logs the active power and daily usage before it tries to put them into the core device. The problem I'm seeing is that there is no core device being created. I see that saving out of the config dialogue should create the core device, but for some reason that isn't happening...

Code: Select all
   def getDevices(self):
      #self.debugLog(u"Getting realtime()")
      try:
         self.sense.update_realtime()
         for i in self.sense._realtime['devices']:
            rtid = i['id']
            self.rt[rtid] = int(i['w'])
      except SenseAPITimeoutException as e:
         self.errorLog(e)
      self.sense.update_trend_data()
      active = self.sense.active_power
      daily = self.sense.daily_usage
      self.debugLog("Active: {}w".format(active))
      self.debugLog("Daily: {}kw".format(daily))
      indigo.devices[self.devFromSid['core']].updateStateOnServer(key='power', value=str(int(active)), uiValue=str("{} w".format(int(active))))
      indigo.devices[self.devFromSid['core']].updateStateImageOnServer(indigo.kStateImageSel.PowerOn)

Posted on
Mon Nov 25, 2019 4:14 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

Ok, I solved it. Was an error where it was trying to convert the string, folderID (from the config dialogue) to an int. This happens on two lines of the code (lines 69 and 175).

Changing the code to

Code: Select all
dev = indigo.device.create(indigo.kProtocol.Plugin,"Active Total","Active Total",deviceTypeId="sensedevice",folder=str(self.folderID))

vs the old code:
Code: Select all
dev = indigo.device.create(indigo.kProtocol.Plugin,"Active Total","Active Total",deviceTypeId="sensedevice",folder=int(self.folderID))


That fixed the problem for me.

Posted on
Tue Nov 26, 2019 2:56 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Errors on Installation

I believe the configuration UI where it asks you for the folder is wanting the folder ID (right-click on folder to get context menu to copy its ID) and not the folder name. The create() API will take either: if it is an integer it assumes it is the folder ID, if it is a string then it assumes it is the folder name.

Image

Posted on
Tue Nov 26, 2019 3:14 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

matt (support) wrote:
I believe the configuration UI where it asks you for the folder is wanting the folder ID (right-click on folder to get context menu to copy its ID) and not the folder name. The create() API will take either: if it is an integer it assumes it is the folder ID, if it is a string then it assumes it is the folder name.


But then it would only work with an existing folder? When I changed it to str, it created a new device group, which is probably the behavior most end users would expect?

Posted on
Tue Nov 26, 2019 3:20 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Errors on Installation

Device group or folder? Normally when we refer to device groups we are talking about devices all grouped together (each device showing as a tab in the device's settings dialog), which is different than what folder the device lives in. The argument in the API (and the option shown in the configuration UI) is for the latter; which is just the folder the device(s) will live in.

Image

Posted on
Tue Nov 26, 2019 3:23 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

matt (support) wrote:
Device group or folder? Normally when we refer to device groups we are talking about devices all grouped together (each device showing as a tab in the device's settings dialog), which is different than what folder the device lives in. The argument in the API (and the option shown in the configuration UI) is for the latter; which is just the folder the device(s) will live in.


I’m just using terms loosely. I meant folder.


Sent from my iPhone using Tapatalk

Posted on
Tue Nov 26, 2019 3:34 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Errors on Installation

I could be mistaken, but I don't believe the device create() API will create a new folder if it doesn't exist.

Image

Posted on
Tue Nov 26, 2019 4:00 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

matt (support) wrote:
I could be mistaken, but I don't believe the device create() API will create a new folder if it doesn't exist.


I thought it had, but maybe I mis-remembered.... I suspect you'd know better than me!

Posted on
Tue Nov 26, 2019 4:03 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Errors on Installation

matt (support) wrote:
I believe the configuration UI where it asks you for the folder is wanting the folder ID (right-click on folder to get context menu to copy its ID) and not the folder name.

Correct - the setup instructions do state this, but I accept that the UI in the config dialog box doesn't, and will get that updated.

It's always best to go with IDs as you might rename the folder in the future which would break the plugin.

(I was confused when I read your earlier message and proposed fix, becase I know those lines WERE causing errors at one stage but I fixed them - Matt's post explains it!)

Peter

Posted on
Tue Nov 26, 2019 4:16 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

howartp wrote:
Correct - the setup instructions do state this, but I accept that the UI in the config dialog box doesn't, and will get that updated.

It's always best to go with IDs as you might rename the folder in the future which would break the plugin.

(I was confused when I read your earlier message and proposed fix, becase I know those lines WERE causing errors at one stage but I fixed them - Matt's post explains it!)

Peter


That's what I get for not RTFM

Posted on
Tue Nov 26, 2019 4:38 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Errors on Installation

1.0.6 uploaded to Plugin Store to clarify and validate the FolderID requirement.

Posted on
Tue Nov 26, 2019 4:46 pm
rapamatic offline
Posts: 276
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: Errors on Installation

Working for me - I changed to the ID in the configuration dialogue box..

Posted on
Sat Nov 28, 2020 10:03 am
DU Lou offline
Posts: 279
Joined: Mar 08, 2012
Location: Florida

Re: Errors on Installation

Good Morning!
I just got a Black Friday deal on Sense.... Giving it a try with this plugin as well, however I received the following error:

Reloading plugin "Sense Home Energy 1.0.6"
Stopping plugin "Sense Home Energy 1.0.6" (pid 3631)
Stopped plugin "Sense Home Energy 1.0.6"
Starting plugin "Sense Home Energy 1.0.6" (pid 3638)
Started plugin "Sense Home Energy 1.0.6"
Sense Home Energy Error Error in plugin execution startup:

Traceback (most recent call last):
File "plugin.py", line 94, in startup
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/Sense.indigoPlugin/Contents/Server Plugin/sense_energy/senseable.py", line 27, in authenticate
Exception: Connection failure: EOF occurred in violation of protocol (_ssl.c:590)

Sense Home Energy Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 214, in runConcurrentThread
File "plugin.py", line 132, in getDevices
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/Sense.indigoPlugin/Contents/Server Plugin/sense_energy/senseable.py", line 45, in update_realtime
AttributeError: 'Senseable' object has no attribute 'sense_monitor_id'

Sense Home Energy Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Sense Home Energy Error Error in plugin execution runConcurrentThread:

Thanks for the assist!
~Lou

Who is online

Users browsing this forum: No registered users and 1 guest