[ANSWERED]: newbie question - battery notify, heating sync..

Posted on
Sun Jun 23, 2019 12:11 pm
captcurrent offline
Posts: 440
Joined: Nov 28, 2005

Re: [ANSWERED]: newbie question - battery notify, heating sy

thanks for the quick response

I made an other action group just to double check sending mail

it is working fine

I know I have at least one insteon with low battery as it keeps smiling me. no idea which one

Posted on
Sun Jun 23, 2019 6:00 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [ANSWERED]: newbie question - battery notify, heating sy

My guess is that there's something hinky with the conditional -- unfortunately, I don't have any Insteon devices to test against. Hopefully someone will be able to knock this one for you.

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

[My Plugins] - [My Forums]

Posted on
Mon Jun 24, 2019 5:47 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [ANSWERED]: newbie question - battery notify, heating sy

I did a little more research on the forums, and it looks like Insteon devices may not report a battery level percentage like Z-Wave devices do. I don't know if this is universal for all Insteon devices or only the one discussed in the thread (I expect the former). In which case, it looks like Insteon devices will send out a battery low alert, so the conditional will have to watch for that flag (whatever it may look like).

This is all conjecture, though, and will need to be confirmed by someone with Insteon experience.

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

[My Plugins] - [My Forums]

Posted on
Mon Jun 24, 2019 7:21 am
captcurrent offline
Posts: 440
Joined: Nov 28, 2005

Re: [ANSWERED]: newbie question - battery notify, heating sy

Thanks. I know I have a device telling me it hs. low battery just can't find it.

Wish you script worked .. its perfect

Posted on
Mon Jun 24, 2019 8:58 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]: newbie question - battery notify, heating sy

Insteon devices don't report battery percentage. The best they can do is send a battery low notification which you can catch in a Trigger. But even that is quite unreliable. Another reason we don't recommend using battery powered Insteon devices if you can find Z-Wave alternatives.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jun 24, 2019 9:04 am
captcurrent offline
Posts: 440
Joined: Nov 28, 2005

Re: [ANSWERED]: newbie question - battery notify, heating sy

actually this script didn't report the state of my battery z-wave door

I have been playing with your battery reporting script (viewtopic.php?f=78&t=12578&p=178876#p178876). with no luck either


Guess I will live it.. I still would like to figure which device is sending me the lower battery email

Posted on
Thu Apr 23, 2020 3:12 am
jaknudsen offline
User avatar
Posts: 41
Joined: Nov 16, 2015

Re: [ANSWERED]: newbie question - battery notify, heating sy

Dual wrote:
I have already modified your code and scheduled it to send one email with the state of all batteries (i.e. even if 100%).

I would be really grateful if you could share your modified script :)

I found another script, but this also includes devices that are not battery powered: http://blog.homeautomation-direct.co.uk ... ry-devices

Code: Select all
## Check devices battery levels
 
# Set the target battery level and the email address to notify
TargetLevel=25
EmailAddress="example@example.com"
LowBatteryCount=0
 
# Shortcut the log function
def log(msg):
 indigo.server.log(msg, type="Low Battery Notification Script")
 
log ("Starting check")
emailBody="The following devices have low batteries: \r\n\r\n"
 
# Loop round all the devices
for dev in indigo.devices.itervalues():
 if (dev.batteryLevel != None) and (dev.enabled):
 log (emailBody)
 if (dev.batteryLevel < TargetLevel):
 log ("Device below threshold, sending email")
 emailBody=emailBody+"\t"+(u'%s (battery level: %s' % (dev.name, dev.batteryLevel)) + "%)\r\n"
 LowBatteryCount+=1
emailBody=emailBody+"\r\n-End-"
if LowBatteryCount >0:
 indigo.server.sendEmailTo(EmailAddress, subject="Indigo battery alert", body=emailBody)
log ("Finished check")

Posted on
Thu Apr 23, 2020 4:38 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [ANSWERED]: newbie question - battery notify, heating sy

captcurrent wrote:
This is exactly what I want

But as usual. I just don't seem to get it

To test I added an action group with the following script
Code: Select all
targetLevel = 100
emailAddress = "reallyme@somewhere.com"

for dev in indigo.devices.itervalues():
   if dev.batteryLevel:
      if dev.batteryLevel < targetLevel:
         emailBody = (u'%s battery level: %s' % (dev.name, dev.batteryLevel))
         indigo.server.sendEmailTo(emailAddress, subject="Indigo Low Battery Alert", body=emailBody)




I added a schedule. and figured with 100 thresh hold I would get a good start position
Log says its is running my no email or errors in log

It has to be something simple I am not doing . Thoughts or suggestions?

Looking back through this thread, I see one thing that escaped me last time. This modified script (with target level of 100) won't include devices that have a battery level of 100. This is because the logic says to include devices with battery levels less than the target level. There are two ways you can fix this. The first is simply to set the target level to 101. The second is to change the logic from this:
Code: Select all
      if dev.batteryLevel < targetLevel:

to this:
Code: Select all
      if dev.batteryLevel <= targetLevel:

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

[My Plugins] - [My Forums]

Posted on
Thu Apr 23, 2020 10:34 am
Dual offline
Posts: 255
Joined: Feb 05, 2019

Re: [ANSWERED]: newbie question - battery notify, heating sy

jaknudsen wrote:
I would be really grateful if you could share your modified script :)


Code: Select all
emailAddress = "me@me.com"
emailBody="BATTERY UPDATE."

for dev in indigo.devices.itervalues():
   if dev.batteryLevel:
         emailBody = emailBody + "\n \n" + str(dev.batteryLevel) + " ... " + dev.name
indigo.server.sendEmailTo(emailAddress, subject="BATTERY UPDATE", body=emailBody)

Who is online

Users browsing this forum: No registered users and 4 guests