This represents a personal project that I've been working on to enable my Kindle Signature 12th gen to act as my home automation server for controlling various IKEA Zigbee devices. What appears below is taken from "readme.txt" in the root of the attached zip file.
I'm sharing this in case others find parts or all of what I've learned in your own projects. In addition to the credits at the end of what appears below, I need to acknowledge all of you who have worked to enable us to use our kindles as we see fit, especially those who have worked on past and current jailbreak solutions without which none of this would be possible.
So THANK YOU!!
---- cut here for readme.txt contents ----
The purpose of this project is to:
1) Keep the kindle from suspending (entering a deep sleep) when
plugged into a power source or its battery level is
above config/config.sh's definition of BATTLEVELTHRESHOLD.
Unlike other solutions which I've seen, mine does not use the ";ds" search
bar option or the powerd preventScreenSaver property. Both of these
options on my Kindle Signature disable the power button. I did not like
this behavior and wanted to rely on the kindle's normal power management
cycle, preventing it from suspending based on whether the kindle
is plugged in or its battery level is above a given threshold.
2) Keep any Bluetooth device connected as long as the kindle is
plugged in.
3) Support displaying a rotating set of screensaver images along
with the current date and time in digital form at the top via cron
when the kindle is in screensaver mode.
Unlike other solutions that I've seen, mine relies on the kindle's normal
screensaver mode functionality. As the kindle enters its screensaver mode
you will see its default screensaver image appear briefly before it is
replaced with the above.
4) Support playing grandfather clock sounds at appropriate times
each hour via cron if the kindle is plugged into a power source and
is in screensaver mode.
5) Support home automation, turning various IKEA zigbee devices on
and off throughout the day and night via cron. My IKEA setup relies on
an IKEA Dirigera hub and a number of smart plugs.
(1) through (4) above are serviced by bin/processevents.sh and
bin/processeventsloop.sh scripts (processevent.sh calls
processeventsloop.sh).
(3) and (4) are supported by various cron jobs that
invoke front-end scripts in the bin and screensaver
directories, which in turn invoke "lipc-send-event"
commands to send events to processevents.sh for
servicing the given request.
Item (5) is supported by various cron jobs that
invoke scripts within the homeauto directory, which in turn
use the curl command to send requests to the
Dirigera hub to turn devices on and off.
As with all Kindle support, use this your own risk and use caution
when making changes. I recommend against installing this software
until after you have reviewed it and agree with what it does and
how it works. The purpose of sharing this is to save others time
and effort in discovering things about the kindle's behavior and
how you might use it in your own projects.
To install, place "kindleautox" in the kindle's /mnt/us directory.
You can name this root directory to your liking. The installation
process will automatically configure things (/etc/upstart scripts,
crontab entries, and config/config.sh) to take into account
whatever directory from which you invoke install.sh.
Then invoke:
./install.sh
install.sh creates config/config.sh (by calling configure.sh),
appends entries from crontab.txt to /etc/crontab/root if
they don't exist already, and creates and copies 2 scripts
from upstartScripts directory to /etc/upstart.
After running install.sh, edit config/btconfig.sh to set
fall-back Bluetooth device details. bin/processeventsloop.sh
attempts to use the currently connected Bluetooth device,
but will use these as fallback values. See bin/btconnect.sh
and its invocation from within bin/processeventsloop.sh
for details.
Place any screen saver images that you would like displayed in
the screensaver/images directory. There is a default set
included in the zip file below. No special naming convention
is required. The screensaver/showimage.sh and screensaver/getimage.awk
scripts randomly pick an image from the images directory to display.
Edit /etc/crontab/root to change how often the image is changed
(see the calls to screensaver/showimage.sh and screensaver/showtime.sh).
Place any sounds that you would like played in the sounds directory
and edit /etc/crontab/root to change what gets played and when
(see the invocations of bin/playmediawhenpluggedinandinscreensavermode.sh).
I could not include the wav files that I'm using because of their
size. I would not have been able to upload the zip file. You can
pull your own copies of the grandfather clock sounds that I'm
using from the website noted in the credits below.
Edit config/homeauto.config to define the IP address and
access token of your IKEA Dirigera hub. Define the IP address
first, then run homeauto/GetAccessToken.sh to get the
access token to use.
Run homeauto/ListDevices.sh, saving the output to a file, and then
edit various scripts light scripts withing the homeauto directory
to define the IKEA Dirigera device id passed to homeautos/ControlPlug.sh
for the given IKEA Zigbee smart plug.
After configuring things, invoke the reboot(1) command from
ssh or kterm to have the kindle invoke the /etc/upstart
scripts and to pick up the new crontab entries.
To enable debugging, edit config/config.sh and set DEBUG=1
instead of 0. This option will apply to all scripts
that support debugging. You can obviously add this
variable to individual scripts if you just want to
see debugging results for that script. Resulting
log files are place in the log directory.
The main event processing scripts, bin/processevents.sh
and bin/processeventsloop.sh (called from processevents.sh),
support:
+ Knowing if the kindle is plugged in and in screensaver mode.
+ Keeping the kindle from suspending/going into a deep
sleep as long as its plugged into a power source.
+ Keeping any configured Bluetooth device connected as long
as the kindle is plugged in.
+ Displaying images when the kindle is in screen saver mode (see
screensaver/showimage.sh and "showimage" event processing).
+ Displaying the current date/time in digital form at the top
of the screen when in screen saver mode (see screensaver/showtime.sh
and "showtime" event processing).
+ Playing media at any time or when the kindle is plugged in and in
screensaver mode (see bin/playmedia.sh,
bin/playMediaWhenPluggedInAndInScreenSaverMode.sh, and the
and "playmedia" and "playmediawhenpluggedinandinscreensavermode"
event processing).
When changing configuration details, use the following command
to have the bin/processeventsloop.sh script read the files
in the config directory.
lipc-send-event com.kindleautox.gen readcfg
When changing crontab entries, you only need to restart cron
using bin/restartcron.sh
The data directory holds various files created by processeventsloop.sh
The log directory holds various log files if DEBUG is set to 1
in config/config.sh. These log files are not kept open. Instead
they are simply appended to as new messages are logged. Therefore,
they can be removed or truncated at anytime without fear of
the original files being written to even though they've been
unliked from the file system.
Credits:
screensaver/images: Screen saver images.
https://www.reddit.com/r/kindlescreensavers/
https://imgur.com/a/71Mbr
(converted from "indexed" to "grayscale" and
resized to match Kindle Signature's screen size)
sounds/grandfatherclock: Grandfather Clock .wav files.
https://freesound.org/people/joedeshon/packs/7926/
homeauto: IKEA home automation scripts.
https://github.com/mattias73andersso...era-client-poc
(converted to bash(1) to eliminate dependence on python)
bin:/sunrise-sunset.awk: Used to identify and wait for sunrise/sunset.
https://github.com/blue-sky-r/sunrise-sunset
(used by the home automation software to turn off/on
lights at sunrise and sunset).