Solution for battery status in Kodi/LibreELEC

  • Hi all have just dedicated a Dell Latitude 11 tablet to LibreELEC.


    Was frustrated by not having any good way to see a battery status so pieces together what I could and thought I'd share.


    The simplest obvious way I found was to push a notification into Kodi on a time interval.


    To do so I wrote a trivial bash script, stored it in /storage, and then used the Kodi Callbacks addon to periodically call the script, which extracts the battery from /sys and uses Kodi-send to do a notification.


    Side note: In order to do this I used the Web SSH/ttyd (which I had to fix, PR created) and Chrome add ons. (I'm on Generic so I can do that - others would have to use a remote SSH.)


    Script looks like (adjust to need):

    #!/bin/bash

    kodi-send -a "Notification($(cat /sys/class/power_supply/BAT0/status),$(cat /sys/class/power_supply/BAT0/capacity)%)'


    Logically I'll probably change this to have some if's so the notification is only sent when the battery state changes or the percent is low.


    The Kodi Callbacks configuration of the task looks like:

    Task: script

    Max num of this task running simultaneously: 1

    Script executable file: /storage/battery.sh

    Wait for script to complete: Yes

    Event: on Interval Alarm

    Hours: 0

    Minutes: 1

    Seconds: 0


    Now I could get an idea about how power efficient my old tablet could be.