[ANSWERED]Battery level for secondary devices

Posted on
Mon Jan 13, 2014 11:52 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

[ANSWERED]Battery level for secondary devices

The secondary devices for an Aeon Labs MultiSensor (temperature, humidity, or luminance) do not have a battery level, not even in Python. (Well, it's None which isn't useful.) Only the primary (motion) device does. How do I figure out the battery state of such a secondary device? Is there a way to find the "main" device corresponding to it? (I suppose I could scan all devices for a same-protocol, same-address device with a working batteryLevel, but that would be exceedingly hokey.)

BTW, is there a way to set up Indigo to trigger when any battery-powered device goes low on battery? Or do I have to make triggers for each one separately?

Cheers
-- perry

Posted on
Tue Jan 14, 2014 12:01 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Battery level for secondary devices

The next version (to be released today or tomorrow) will have a new API to retrieve all device IDs from a device group:

Code: Select all
idList = indigo.device.getGroupList(devIdOrInstance)


The argument can be any device ID in the group or any device instance in the group. The first item in the returned list is considered the main/root device and will have the battery level if it exists. So to get the battery level given any device ID in a group you can do something like:

Code: Select all
level = indigo.devices[indigo.device.getGroupList(devIdOrInstance)[0]].batteryLevel


In the future we might improve the semantics of accessing the main/root device in a group and/or share these base properties across all instances in a group, but for now the recommended approach is above.

There isn't currently a way to trigger off of any batteryLevel dropping below a threshold, but on my wish list is adding battery management functionality to Indigo which would include that along with lots of other goodies. No ETA, of course.

Image

Posted on
Tue Jan 14, 2014 7:25 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Battery level for secondary devices

Version 6.0.8 is now available with the new API.

Image

Posted on
Tue Jan 14, 2014 9:46 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Battery level for secondary devices

That was most fortuitous timing indeed. Thanks, and that new call works great.

Cheers
-- perry

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests