Battery Charting Script

Posted on
Fri May 06, 2016 2:33 pm
stuartcolman offline
Posts: 81
Joined: Nov 01, 2015
Location: Essex, United Kingdom

Re: Battery Charting Script

I think the correct command is:

Code: Select all
plt.axis('off')


However this removes everything, labels etc, and just leaves you with the main plot. If you use the following it just removes the frame.

Just replace the final block of code starting with:
Code: Select all
# Output the file


with this:

Code: Select all
# Output the file
plt.tight_layout()
plt.gca().spines['top'].set_visible((False))
plt.gca().spines['bottom'].set_visible((False))
plt.gca().spines['left'].set_visible((False))
plt.gca().spines['right'].set_visible((False))
plt.savefig(output_file, **k_plot_fig)
plt.close()

Posted on
Fri May 06, 2016 3:19 pm
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

Thanks Stuart for catching my typo. I'll go back and fix that now. Thanks too for the answer above!

Dave


Sent from my iPhone using Tapatalk

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

[My Plugins] - [My Forums]

Posted on
Fri May 06, 2016 5:39 pm
Different Computers offline
User avatar
Posts: 2531
Joined: Jan 02, 2016
Location: East Coast

Re: Battery Charting Script

So that threw the baby out with the bathwater:

Edit: WHOOPS! didn't see the second entry. trying that....

And we have a lovely winner! Many thanks.
Attachments
Screen Shot 2016-05-06 at 7.41.40 PM.png
Screen Shot 2016-05-06 at 7.41.40 PM.png (221.85 KiB) Viewed 12825 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
Fri Jun 10, 2016 11:34 am
bluehouse offline
Posts: 22
Joined: May 04, 2011

Re: Battery Charting Script

This looks like a really useful script. This might be a dumb question, but does it work with Insteon devices like open-close sensors, leak detectors, etc? I've tried running the script a couple of times. It generates the graphic, but does not populate any devices or batter levels. Thanks!

Posted on
Fri Jun 10, 2016 11:50 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

bluehouse wrote:
This looks like a really useful script. This might be a dumb question, but does it work with Insteon devices like open-close sensors, leak detectors, etc? I've tried running the script a couple of times. It generates the graphic, but does not populate any devices or batter levels. Thanks!

I don't have any Insteon devices, so I've got no way to check with any certainty. It appears from the SampleHouse database that Insteon devices do support the ['batteryLevel'] property, but alas, none of the SampleHouse Insteon devices seem to be battery-powered devices so I can't tell if they support the batteryLevel state.

Can you please check if the device has a ['batteryLevel'] state? If not, I may have to tweak the script to key off the device property rather than the device state. Please run this script against one of your battery-powered Insteon devices and paste the results in this thread:
Code: Select all
dev = indigo.devices[DEVICE ID HERE]
indigo.server.log(unicode(dev.states))


Dave

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

[My Plugins] - [My Forums]

Posted on
Sat Jun 11, 2016 5:41 am
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Battery Charting Script

This looks interesting folks. Thanks for working on it.

However, after reading through the various give and take of the fine tuning process I wonder if somebody has an updated script that includes all the features discussed? I

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Sat Jun 11, 2016 6:09 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

jalves wrote:
This looks interesting folks. Thanks for working on it.

However, after reading through the various give and take of the fine tuning process I wonder if somebody has an updated script that includes all the features discussed? I

The script in post number 1 is the most up-to-date script.

Working on including Insteon devices now. Need somebody with some battery-powered devices to send me a dict or two. :D

Dave

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

[My Plugins] - [My Forums]

Posted on
Sat Jun 11, 2016 9:09 am
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Battery Charting Script

DaveL17 wrote:
Working on including Insteon devices now. Need somebody with some battery-powered devices to send me a dict or two. :D

Dave


Thanks for the response Dave
The only battery-powered Insteon devices I've got are motion sensors. Happy to send you whatever info you would need for those, but you'll have to explain how to do that.

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Sat Jun 11, 2016 9:47 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

jalves wrote:
Thanks for the response Dave
The only battery-powered Insteon devices I've got are motion sensors. Happy to send you whatever info you would need for those, but you'll have to explain how to do that.

Please run this script and post back with the results (which will be posted to the Indigo log.) Replace 'DEVICE ID HERE' with the actual ID of your battery powered Insteon device(s).

Code: Select all
dev = indigo.devices[DEVICE ID HERE]
indigo.server.log(unicode(dev.states))


Thanks for the help!

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

[My Plugins] - [My Forums]

Posted on
Sat Jun 11, 2016 10:18 am
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Battery Charting Script

The result probably doesn't help you at all. :(

Embedded script executor host started
Script States : (dict)
onOffState : off (on/off bool)

That's it. This from an Insteon motion sensor.

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Sat Jun 11, 2016 10:20 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

jalves wrote:
The result probably doesn't help you at all. :(

It actually does help. It tells me that I need to get the information from another place. I will post back when I have something.

Thanks for the help!
Dave

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

[My Plugins] - [My Forums]

Posted on
Sat Jun 11, 2016 12:34 pm
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Battery Charting Script

In the vein of no good deed goes unpunished; would it be possible to include the battery state of some outside temperature sensors? I've got both Oregon Scientific and La Crosse devices that I access through the RFXCOM plugin

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Sat Jun 11, 2016 12:44 pm
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

jalves wrote:
In the vein of no good deed goes unpunished; would it be possible to include the battery state of some outside temperature sensors? I've got both Oregon Scientific and La Crosse devices that I access through the RFXCOM plugin

Possibly. It depends on how the plugin exposes the battery level. I am a bit hesitant to add one-off scenarios (tough to maintain when things get changed under the hood) but let's work together offline to see what we can do.

Dave

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

[My Plugins] - [My Forums]

Posted on
Sun Jun 12, 2016 6:45 am
jalves offline
Posts: 744
Joined: Jun 16, 2013

Re: Battery Charting Script

Underestand Dave. I've got a simple schedule that checked the batteries on those temperature sensors once a day and inserts the battery state into a variable. Works just fine as long as I remember to check the values. :)

The thing about these sensors seems to be that they report "10" to indicate adequate battery level, and some other value (possibly 01) for low battery, with no real measurement provided.

Running Indigo 2023.2 on a 24" iMac M1), OS X 14.4
Jeff

Posted on
Sun Jun 12, 2016 7:05 am
DaveL17 offline
User avatar
Posts: 6739
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Battery Charting Script

jalves wrote:
Underestand Dave. I've got a simple schedule that checked the batteries on those temperature sensors once a day and inserts the battery state into a variable. Works just fine as long as I remember to check the values. :)

The thing about these sensors seems to be that they report "10" to indicate adequate battery level, and some other value (possibly 01) for low battery, with no real measurement provided.

Yeah, I think that's simply a "time to change the battery" flag. Personally, I think your current approach is best. In fact, I do it too (send myself an email for low-battery conditions.)

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 1 guest