Matplotlib Plugin for Indigo 7 - New!

Posted on
Wed Nov 30, 2016 4:58 pm
rvarela offline
Posts: 81
Joined: Oct 16, 2012

Re: Matplotlib Plugin for Indigo 7 - New!

Ok. I'm here to help if I can.


Sent from my iPhone using Tapatalk

Posted on
Wed Nov 30, 2016 5:08 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

rvarela wrote:
Ok. I'm here to help if I can.

Thanks, but I found it. Totally my bad. The short version of the story is that I introduced a bug in the key assignment routine and, as a result, was working with strings instead of integers.

Code: Select all
>>> a = '2'
>>> b = '10'
>>> print b > a
False
>>>

I have fashioned a fix and will test it on my production server when I get home from work. Tests on my development server (which I have with me always! :D ) are working as expected. Sorry for the trouble. Please hang tight with 10 charts for a short while longer.

Durosity refers to it as 'incompetence' and I agree with him in this case. :D

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Nov 30, 2016 9:03 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

I have posted an update to the plugin that should address known issues. Please let me know if there are others. All future plugin updates will be announced on that thread.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 01, 2016 8:06 am
Different Computers offline
User avatar
Posts: 2554
Joined: Jan 02, 2016
Location: East Coast

Re: Matplotlib Plugin for Indigo 7 - New!

Tried this last night and had some real trouble. The low hanging fruit is my lack of clear understanding about what the "State" is, and what can be put there.

I'm trying to chart output from my Aeon Smart Energy Meter, and it has a tab called Meter Total. But when I put that in, I get a Matplotlib error in the log referring to being unable to find such a thing.
Code: Select all
Invalid CSV definition. 'key Meter Total not found in dict'


This is just the first of many things I'm apparently not understanding about how to configure this plugin.

Code: Select all
Matplotlib Warning   Invalid Indigo ID. invalid literal for int() with base 10: 'None'
Matplotlib Critical Error   Energy Line Chart: Check path to CSV file (max() arg is an empty sequence)


All help appreciated!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu Dec 01, 2016 11:22 am
richo offline
Posts: 158
Joined: Nov 25, 2014
Location: Pomorskie, Poland

Re: Matplotlib Plugin for Indigo 7 - New!

Have a problem when trying to run an Action Group to Redraw Charts with the following error in log:

Code: Select all
   Action Group                    Odśwież wykresy Mathplotlib
   Matplotlib Error                Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 984, in refreshTheChartsAction
TypeError: 'PluginAction' object is not iterable

Ryszard

Posted on
Thu Dec 01, 2016 1:14 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

Different Computers wrote:
Tried this last night and had some real trouble. The low hanging fruit is my lack of clear understanding about what the "State" is, and what can be put there.

I'm trying to chart output from my Aeon Smart Energy Meter, and it has a tab called Meter Total. But when I put that in, I get a Matplotlib error in the log referring to being unable to find such a thing.
Code: Select all
Invalid CSV definition. 'key Meter Total not found in dict'


This is just the first of many things I'm apparently not understanding about how to configure this plugin.

Code: Select all
Matplotlib Warning   Invalid Indigo ID. invalid literal for int() with base 10: 'None'
Matplotlib Critical Error   Energy Line Chart: Check path to CSV file (max() arg is an empty sequence)


All help appreciated!

For the CSV engine, there are three pieces of information that you need for each data element. A title, a source and a value. The title can effectively be whatever you want (there few small exceptions). The source, as you've probably figured out is either a device or variable ID. The value is either a device state or a variable value. For variables, just enter the word 'value'. For devices, it has to be a defined state for the device you're using. The easiest way to see them for any device is to run this Python script in Indigo:
Code: Select all
indigo.server.log(unicode(indigo.devices[DEVICE_ID].states))

Copy the device state name exactly and don't use the ones that have '.ui' on the end. Of course, you can only use things that are chartable (numbers not words, etc.)

You might find it helpful to open TextEdit to use as a scratchpad.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 01, 2016 1:16 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

richo wrote:
Have a problem when trying to run an Action Group to Redraw Charts with the following error in log:

Code: Select all
   Action Group                    Odśwież wykresy Mathplotlib
   Matplotlib Error                Error in plugin execution ExecuteAction:

Traceback (most recent call last):
  File "plugin.py", line 984, in refreshTheChartsAction
TypeError: 'PluginAction' object is not iterable

Darned if it doesn't. :D

I've identified the offending code and, embarrassingly, it's a simple piece of code that's supposed to write something to the log. It's now fixed and will be included in the next update.

Thanks for reporting it.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 01, 2016 1:20 pm
rvarela offline
Posts: 81
Joined: Oct 16, 2012

Re: Matplotlib Plugin for Indigo 7 - New!

Thanks very much Dave. The update is working perfectly well for me after adding 14 elements. On a side note, what was raised by different Computers above is a good point I think. I also spent some time trying to figure out what state means, entering text like temperature, for example. I know it is obvious for you, as it is for me now, but at the very beginning maybe including a line in the description will certainly help (at least for some of us). It could be just to execute the phyton command you suggested at the beginning of this blog to obtain the correct answer.

Posted on
Thu Dec 01, 2016 4:39 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

rvarela wrote:
Thanks very much Dave. The update is working perfectly well for me after adding 14 elements. On a side note, what was raised by different Computers above is a good point I think. I also spent some time trying to figure out what state means, entering text like temperature, for example. I know it is obvious for you, as it is for me now, but at the very beginning maybe including a line in the description will certainly help (at least for some of us). It could be just to execute the phyton command you suggested at the beginning of this blog to obtain the correct answer.

Glad to hear that solved the issue for you.

I agree that the CSV engine is a bit wonkish and I'll add something to the initial post with that as a tip. I'm looking at ways to simplify the way that elements are added, but want to be sure that I don't make it even more difficult to understand. :D

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 01, 2016 7:18 pm
Different Computers offline
User avatar
Posts: 2554
Joined: Jan 02, 2016
Location: East Coast

Re: Matplotlib Plugin for Indigo 7 - New!

indigo.server.log(unicode(indigo.devices[DEVICE_ID].states))


Sorry, " run this Python script in Indigo" doesn't work as:

A. pasted in the scripting shell
B. embedded python in an action group.
or, outside of indigo in a python prompt in Terminal.

WHERE do I run it in Indigo?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu Dec 01, 2016 7:36 pm
jay (support) offline
Site Admin
User avatar
Posts: 18221
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Matplotlib Plugin for Indigo 7 - New!

It runs fine - the output is in the Event Log window. Looks something like this:

Code: Select all
Dec 1, 2016, 7:35:13 PM
   Interactive Shell               States : (dict)
     canConnect : true (bool)
     canRemoteControl : true (bool)
     instanceName : FatBook (string)
     protocolVersion : 1.5 (string)
     sourceAlbum : Face To Face (string)
     sourceArtist : Michael Halaas (string)
     sourceGroup : recentApplications (string)
     sourceIdentifier : /Applications/iTunes.app (string)
     sourceMachineModel : MacBookPro11,4 (string)
     sourceMachineName : FatBook (string)
     sourceMetadataAvailable : FatBook (string)
     sourceName : iTunes (string)
     sourcePlayStatus : unavailable (string)
     sourcePlayStatus.error : false (bool)
     sourcePlayStatus.paused : false (bool)
     sourcePlayStatus.playing : false (bool)
     sourcePlayStatus.stopped : false (bool)
     sourcePlayStatus.unavailable : true (bool)
     sourceRemoteControlAvailable : true (bool)
     sourceTrackName : Endure (string)
     status : connected (string)
     status.connected : true (bool)
     status.disconnected : false (bool)
     status.unavailable : false (bool)


Did you substitute DEVICE_ID with the actual ID of the device?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Dec 01, 2016 7:41 pm
Different Computers offline
User avatar
Posts: 2554
Joined: Jan 02, 2016
Location: East Coast

Re: Matplotlib Plugin for Indigo 7 - New!

Did you substitute DEVICE_ID with the actual ID of the device?

ahhhhhhhhhh.

See, I thought it was a variable.

Duh.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu Dec 01, 2016 7:46 pm
Different Computers offline
User avatar
Posts: 2554
Joined: Jan 02, 2016
Location: East Coast

Re: Matplotlib Plugin for Indigo 7 - New!

I get this:
Code: Select all
     accumEnergyTimeDelta : 73962 (integer)
     accumEnergyTimeDelta.ui : 73962 seconds (string)
     accumEnergyTotal : 0 (real)
     accumEnergyTotal.ui : 0.0 kWh (string)
     batteryLevel : 36 (integer)
     batteryLevel.ui : 36% (string)
     curEnergyLevel : 1301.08 (real)
     curEnergyLevel.ui : 1301.080 W (string)


thought I was looking for something like a device ID. Should I use curEnergyLevel or curEnergyLevel.ui? I'll experiment.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu Dec 01, 2016 7:50 pm
Different Computers offline
User avatar
Posts: 2554
Joined: Jan 02, 2016
Location: East Coast

Re: Matplotlib Plugin for Indigo 7 - New!

re-enabled Matplotlib and my log fills with red:
Code: Select all
Matplotlib Critical Error       Energy Line Chart: Check path to CSV file (max() arg is an empty sequence)
   Matplotlib Error                Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 2301, in runConcurrentThread
  File "plugin.py", line 963, in refreshTheCharts
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 561, in savefig
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/figure.py", line 1421, in savefig
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backend_bases.py", line 2220, in print_figure
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backend_bases.py", line 1962, in print_png
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_agg.py", line 510, in print_png
IOError: [Errno 2] No such file or directory: u'/Library/Application Support/Perceptive Automation/Indigo 7/IndigoWebServer/images/controls/static//Users/macadmin/Pictures/ChartEnergyLine.png'

Some of that is from before I tried changing state, but a lot of it is the same after.

EDIT: OK, I think that was because I wasn't using CurrEnergy, instead I was using the .ui. But I've still got red and lots of it. looks like all I got rid of is
Code: Select all
 Matplotlib Critical Error       Energy Line Chart: Check path to CSV file (invalid literal for float(): 1977.140 W)
 


And another edit: realized what I was doing wrong with
Code: Select all
IOError: [Errno 2] No such file or directory: u'/Library/Application Support/Perceptive Automation/Indigo 7/IndigoWebServer/images/controls/static//Users/macadmin/Pictures/ChartEnergyLine.png'
and have fixed that, I think. Much much less red, but still:
Code: Select all
Matplotlib Warning              Invalid Indigo ID. invalid literal for int() with base 10: 'None'
   Matplotlib Critical Error       Energy Line Chart: Check path to CSV file (invalid literal for float(): 1977.140 W)
   Matplotlib Critical Error       ValueError: ordinal must be >= 1


Also, just went into the CSV and removed bad data from when I was using CurrEnergy.ui, so now I'm getting this:
Code: Select all
Timestamp,Energy
2016-12-01 20:51:06.956000,1968.12
2016-12-01 20:51:17.610000,1968.12
2016-12-01 20:51:28.375000,1968.12
2016-12-01 20:51:39.037000,1968.12
2016-12-01 20:51:49.665000,1968.12
2016-12-01 20:52:00.278000,1968.12
2016-12-01 20:52:10.910000,1968.12
2016-12-01 20:52:21.619000,1968.12
2016-12-01 20:52:32.274000,1968.12
2016-12-01 20:52:42.887000,1968.12
2016-12-01 20:52:53.496000,1968.12
2016-12-01 20:53:04.111000,1968.12
2016-12-01 20:53:14.745000,1968.12
2016-12-01 20:53:25.363000,1968.12
2016-12-01 20:53:35.972000,1968.12
2016-12-01 20:53:46.588000,1409.76
2016-12-01 20:53:57.187000,1409.76
2016-12-01 20:54:07.801000,1409.76
2016-12-01 20:54:18.918000,1409.76
2016-12-01 20:54:30.042000,1409.76
2016-12-01 20:54:40.653000,1409.76
2016-12-01 20:54:51.258000,1409.76
2016-12-01 20:55:01.874000,1409.76
2016-12-01 20:55:12.496000,1409.76
2016-12-01 20:55:23.168000,1409.76
2016-12-01 20:55:33.806000,1409.76
2016-12-01 20:55:44.422000,1409.76
2016-12-01 20:55:55.040000,1408.11
2016-12-01 20:56:05.658000,1408.11
2016-12-01 20:56:16.308000,1408.11
2016-12-01 20:56:26.971000,1408.11
2016-12-01 20:56:37.578000,1408.11
2016-12-01 20:56:48.182000,1408.11
2016-12-01 20:56:58.799000,1408.11
2016-12-01 20:57:09.430000,1408.11
2016-12-01 20:58:50.055000,1408.11
2016-12-01 21:09:46.692000,1407.12


FINAL EDIT: I Think I've Got IT. Though clearly, I need to do some tweaking:
Attachments
ChartEnergyLine.png
ChartEnergyLine.png (22.38 KiB) Viewed 3014 times

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu Dec 01, 2016 8:39 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Matplotlib Plugin for Indigo 7 - New!

Looks like you're on your way.

Some of the weirdness that you're seeing in the chart is because of the plugin restarts. Every time the plugin restarts, it's going to grab a new value and save it to the CSV file. You've got some that are several times per minute. That will give you a LOT of observations. All your data is within 20 minutes and the plugin's shortest window is once every 15.

Second, it looks as if you have annotations turned on. I highly recommend only using annotations when there are a few observations--like a weather forecast.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 6 of 19 1 ... 3, 4, 5, 6, 7, 8, 9 ... 19

Who is online

Users browsing this forum: No registered users and 13 guests

cron