Close
0%
0%

Kindle as a home automation controller/sensor

Make your kindle interacts with your home automation

Similar projects worth following
Add your kindle in your home automation scenario : a controller or a sensor or both :-)

The Chain of Command

In order to make the kindle interacts with your home automation system, you have to :

  1. guess what both globally and precisely user is going to do
  2. imagine a way to transmit user's precise choice to an underlying piece of software
  3. trigger command when user's precise choice corresponds to a home automation instruction.

Obviously, Kindle already has a web navigator which could be used to command your home automation.


Obviously it's not what I'm aiming.

I want Kindle interacts - as a controller or as a sensor - with home automation smoothly, discretely.


Detection of user movement

Prepare the kindle

For the moment Kindle must be jailbreaked, the easiest way to do what we have to is through wifi and ssh. You can also use usb network and ssh, but keep in mind the Kindle have to be connected to your home automation a priori via wifi.

Getting kindle status

Kindle underlying system is a Linux distribution. You can see by yourselves that id, uname, df, dh, cp and bash are available.

The first think to do is looking inside logs. dmesg gives a lot of interesting stuff but nothing seems to help us guessing what user is actually doing.

If dmesg is our first shot, the second shot is spying in /var/log. So we run tail -f /var/log/* and observe this :

[root@kindle root]# tail -f /var/log/*
==> /var/log/udhcpc.log <==
Sending discover...
Offer from server xxx.xxx.1.1 received
Sending select for xxx.xxx.1.110...
Lease of xxx.xxx.1.110 obtained, lease time 43200

==> /var/log/wpa_supplicant <==

==> /var/log/wtmp <==
ttymxc0mxcLOGIN���U~~~reboot2.6.31-
(…) snip (…)
��U���0pts/0ts/0root192.168.1.203���U[T
==> /var/log/messages <==
150807:032805 powerd[2354]: I def:suspenddelta:sec=1890, cap=-1, mAh=-1, volt=-16, bp=-16:Suspend delta
150807:032805 syslog-ng[29521]: new configuration initialized

==> /var/log/messages <==
150807:032809 powerd[2354]: I lipc:evts:name=battLevelChanged, origin=com.lab126.powerd, fparam=59:Event sent

Still no usable information… But, we have not physically interact with kindle !

Observing user interactions

The command tail -f writes to your screen all the content of all files in /var/log in continue.

At this level I advise you to reset the terminal of ssh to only show what is new to logs file.

With your kindle in hand do regular things you always do. Like opening an ebook, a PDF, return to home screen, call parameters et cætera.

And now magic happened :

[root@kindle root]# tail -f /var/log/*
==> /var/log/messages <==
150807:034115 cvm[3363]: I FrameworkKeyEventDispatcher:USER_HARDKEY_PRESS:KeyPressed=Home:User pressed Home button
150807:034115 cvm[3363]: I BookletManager:SwitchingBooklets:from=Bookworm,to=Home:
150807:034115 cvm[3363]: I WebServicesImpl:UploadAnnotations::first journal empty
150807:034115 cvm[3363]: I Reader:SYNC LPR:position=374292:Send LPR to server
150807:034115 cvm[3363]: I HTMLBookViewer:Information::HTMLBookViewer closeBook save last read position 374292
150807:034115 webreader[3181]: I def:commandHandlerFunc:Received command: /command/close_uri, msg=0x298a58 :
150807:034115 webreader[3181]: I def:processCommandHandler:Response sent for this request, msg=0x298a58, time=1.863037 :
150807:034115 cvm[3363]: I HTMLBookViewer:Information::Request to close 9dabdc03-04c7-4ba7-b361-e64526ddd7f5 is processed successfully
150807:034115 cvm[3363]: I lipc:gsp:prop=orientation, source=com.lab126.system:Get string property
150807:034115 cvm[3363]: W SystemBarImpl:SPIN:spinCount=0:count <=0 when stopSpinner() called
150807:034115 cvm[3363]: I MainView:Information::The WiFi dialog has been previously shown.
150807:034116 cvm[3363]: I HTMLJsonSidecarFile:Information::Delayed Write to sidecar file
150807:034118 cvm[3363]: I GUIManager:HomeViewSwitch:view=CollectionView:
150807:034119 cvm[3363]: I FrameworkKeyEventDispatcher:USER_HARDKEY_PRESS:KeyPressed=Home:User pressed Home button
150807:034119 cvm[3363]: I BookletManager:SwitchingBooklets:...
Read more »

  • 1 × Kindle 4 This is a classic Kindle 4 from Amazon
  • 1 × MSP430 Evaluation, Demonstration Kits, Boards and Modules / Evaluation Kits, Boards and Modules
  • 1 × USB cable Electronic Components / Misc. Electronic Components

  • 1
    Step 1

    Ebook Tools

    Prepare an ebook with one of the tool above

    • Calibre (overkill for a mobi but perfect for azw3 generation)
    • One of the numerous online ebook converters.

    Keep in mind : only mobi or azw3. Other (pdf, txt) appear weirdly in log.

    You can also pick one of mine in my repo.

  • 2
    Step 2

    Kindle Toolchain

    Download kindle toolchain ( = all the tools to compile source code). Here is the toolchain i used Samsheff's for linux. You can build your own on Mac OS, and maybe on Windows.

    If you build your own toolchain, consider enabling C99.

    I strongly recommend you to use the same directory you use in step 1 and in this case :

    ~/dev-kindle/ $ git clone https://github.com/samsheff/Amazon-Kindle-Cross-Toolchain

  • 3
    Step 3

    Cloning my repo

    If you plan to only test, I suggest to clone my repo on /tmp/ because it's wiped on reboot.

    $ cd /tmp/
    Otherwise, if you plan to hack my stuff use your development directory.
    $ mdir ~/dev-kindle/  
    $ cd ~/dev-kindle/

    Then clone my github repo :

    ~/dev-kindle/ $ git clone https://github.com/cekage/kindle-home-automation

View all 17 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates