Display Battery Level for custom devices

Posted on
Tue May 12, 2020 9:15 pm
jheddings offline
User avatar
Posts: 127
Joined: Dec 01, 2013
Location: Denver, CO

Display Battery Level for custom devices

Posting this in case anyone can help for a future release...

Is there a way to use the built in
Code: Select all
batteryLevel
device state for custom devices? When I try to use that in this plugin, the device state is hidden and no meter shows on the UI. I'm currently using a generic
Code: Select all
level
state, but it would be nice to build on the known states where possible.

Thanks!
-jh

Posted on
Wed May 13, 2020 5:21 am
FlyingDiver offline
User avatar
Posts: 4256
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Display Battery Level for custom devices

For it to show in the UI, in your device definition you need:
Code: Select all
            <Field id="SupportsBatteryLevel" type="checkbox" defaultValue="false">
                <Label>Device reports battery status:</Label>
            </Field>           


If the custom device always has a battery level, then just set that to True and hide it in the Devices.xml.

Code: Select all
         <Field id="SupportsBatteryLevel" type="checkbox" defaultValue="true" hidden="true" />

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed May 13, 2020 8:26 am
jheddings offline
User avatar
Posts: 127
Joined: Dec 01, 2013
Location: Denver, CO

Re: Display Battery Level for custom devices

Works like a charm, thanks! I've kept the legacy state for compatibility with existing devices. Any new Battery devices will display the battery indicator. I'll make note of this when I do a new release.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests