├── LICENSE ├── README.md ├── assets ├── front.jpg └── inside.jpg ├── extensions └── homeassistant │ ├── config.sh │ ├── config.xml │ ├── daemon.sh │ ├── error.png │ ├── low_battery.png │ ├── menu.json │ ├── rtcwake │ ├── script.sh │ ├── startup.sh │ ├── utils.sh │ └── wifi.png └── kite └── onboot └── homeassistant.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sebastian Schubotz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kindle 4 Non Touch Home Assistant Lovelace Dashboard 2 | 3 | This repository gives details about how I built my own Home Assistant dashboard using an old Kindle 4 non touch. 4 | 5 | A lovelace UI panel of your Home Assistant instance is rendered to an image and polled from a jailbroken Kindle 4 on a regular basis. 6 | 7 | ![Outside photo](https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/main/assets/front.jpg) 8 | 9 | ## Software 10 | 11 | I keep this short as I think this should be pretty straight forward. 12 | 13 | 1. Set up [Home Assistant](http://home-assistant.io/) on the platform of your choice. 14 | 1. Set up the rendering software i.e. using docker, [see my hass-lovelace-kindle-screensaver](https://github.com/sibbl/hass-lovelace-kindle-screensaver/) repository. 15 | 16 | Hints: 17 | 18 | 1. there's an [`eink` HA theme](https://github.com/sibbl/hass-lovelace-kindle-screensaver/blob/main/lovelace-eink-theme.yml) inside the rendering software repository which you can configure for your newly created panel. 19 | 2. I recommend installing this [kiosk mode extension](https://github.com/NemesisRE/kiosk-mode) (i.e. via [HACS](https://hacs.xyz/)) to remove the UI app header bar. 20 | 21 | **Finally**, You should end up with a URL pointing to the exposed port of the rendering docker container to configure this on your kindle as described in the following section. 22 | 23 | This URL needs to be plain HTTP as no TLS or SSL is supported by the Kindle 4. If your server is HTTPS only (which is a good thing!), I recommend using a free CDN like [Hostry](https://www.hostry.com). 24 | 25 | ## Hardware 26 | 27 | While the software part should be the same for other Kindle models like the newer Paperwhites, the following section specifically addresses the Kindle 4 non touch. I've also primarily built it for an always powered device, but I assume it might be easily adapted to a battery powered use. PRs are welcome! 28 | 29 | If you're using a Paperwhite, it's probably better to use the [online screensaver extension](https://www.mobileread.com/forums/showthread.php?t=236104). It uses features like `rtcwake` and `upscript` which are not available on the Kindle 4 NT out of the box. 30 | 31 | Thus, a bit more work was necessary to get a reliable solution for a good Kindle 4 experience. 32 | 33 | 1. Jailbreak your Kindle 4 Non Touch [as described here](https://www.mobileread.com/forums/showthread.php?t=191158). 34 | 1. Install USBNetwork so that you can SSH into your device. [See download including instructions here](https://www.mobileread.com/forums/showthread.php?t=88004). 35 | 1. Install Mobileread Kindle Kit (MKK) so that KUAL can be used. [See download including instructions here](https://www.mobileread.com/forums/showthread.php?t=233932). 36 | 1. Copy KUAL v1 azw file into `/mnt/us/documents` [as described here](https://www.mobileread.com/forums/showthread.php?t=203326). 37 | 1. Install kite so that we can start our script on each boot. [See download including instructions here](https://www.mobileread.com/forums/showthread.php?t=168270) - you can simply use [this prebuilt package for K4](https://www.mobileread.com/forums/showpost.php?p=2373973&postcount=73) OR SSH into your device and run the `kite.sh` from the `kite.gz` download. 38 | 1. Clone this repository. **Important for Windows users**: ensure that the `*.sh` files have LF line endings and NOT CRLF. 39 | 1. Set the variables inside this repository's `extensions/homeassistant/config.sh`. 40 | - If you want to run the device on battery, I recommend increasing the `INTERVAL` (so that it suspends longer) and decrease `DELAY_BEFORE_SUSPEND` so that the (artificial) delay between drawing the image and suspending is as low as possible. But please keep in mind that this wasn't what I've built the script for. E.g. the online screensaver extension supports configuring a scheduler to run less frequent at night and save battery. 41 | 1. Copy `homeassistant` and `kite` folders from this repository into `/mnt/us/` on the device. 42 | 1. Reboot your device and the script should run 2 minutes after booting up via kite. That's it. 43 | 44 | ### Changing config or debugging 45 | 46 | There are two possibilities to SSH into your Kindle to change your config or debug if something didn't work as expected. 47 | 48 | 1. The `extensions/homeassistant/startup.sh` sleeps 2 minutes until it starts the daemon on boot. On boot, you have time to SSH into your kindle. 49 | 1. After drawing the image, the `extensions/homeassistant/script.sh` sleeps a short time until it suspends - see the `DELAY_BEFORE_SUSPEND` config option. This gives you time to SSH into your device and stop the daemon using `sh /mnt/us/extensions/homeassistant/daemon.sh stop`. 50 | 51 | For debugging purposes, `LOGGING` can be configured to `1` so that an extended log is written to `extensions/homeassistant/homeassistant.log`. 52 | 53 | ## Photo frame 54 | 55 | Similarly to [this project](https://marios-blog.com/2020/01/22/digitaler-bilderrahmen-mit-kindle-paperwhite/), I've bought a 13x18 cm photo frame from an online store over here in Germany. 56 | 57 | My wife and I removed the front cover of the Kindle 4 and also decided to remove the mainboard from the frame as there wasn't enough space to plug a Micro USB cable into the device's bottom while keeping it centered. A 90 degree adapter might be a better choice, also depending on the exact size of the frame. 58 | 59 | The following photo should demonstrate it. The connectors beetween the battery and screen are the most important, the ones of the side buttons are not required. Of course, the photo also clearly indicates that we're both software developers... 60 | 61 | ![Inside photo](https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/main/assets/inside.jpg) 62 | 63 | ## My sources and similar projects 64 | 65 | - The rtcwake binary inside `extensions/homeassistant` was taken from [this post from Stefan Strobel](https://www.mobileread.com/forums/showpost.php?p=3009582&postcount=36). 66 | - [nicoh88's kindle-kt3_weatherdisplay_battery-optimized](https://github.com/nicoh88/kindle-kt3_weatherdisplay_battery-optimized) is the origin of most code and the images. 67 | - [Mario's adaptations](https://marios-blog.com/2020/01/22/digitaler-bilderrahmen-mit-kindle-paperwhite/), which is based on nicoh88's repository. 68 | - Even for non-Germans I recommend scrolling through the article as it also shows a different approach to the photo frame. 69 | 70 | The following two projects were my inspiration and I've also used them for quite some time. However, manually rebooting or charging the device was necessary too often and would've never gotten an approval by my parents. 71 | 72 | - [Online screensaver extension](https://www.mobileread.com/forums/showthread.php?t=236104) 73 | - [FHEM Kindle Display](https://wiki.fhem.de/wiki/Kindle_Display) 74 | -------------------------------------------------------------------------------- /assets/front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/assets/front.jpg -------------------------------------------------------------------------------- /assets/inside.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/assets/inside.jpg -------------------------------------------------------------------------------- /extensions/homeassistant/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | INTERVAL=60 # (sec) - how often to update the script 4 | IMAGE_URI="http://example.org/test.png" # URL of image to fetch. Keep in mind that the Kindle 4 does not support SSL/TLS requests 5 | CLEAR_SCREEN_BEFORE_RENDER=0 # If "1", then the screen is completely cleared before rendering the newly fetched image to avoid "shadows". 6 | INTERVAL_ON_ERROR=30 # In case of errors, the device waits this long until the next loop. 7 | BATTERYALERT=15 # if the battery level is equal to or below this threshold, a info will be displayed 8 | BATTERYLOW=5 # if the battery level is equal to or below this threshold, the "please charge" image will be shown and the device will sleep for a long time until it checks again (or boots up and starts the script again) 9 | BATTERYSLEEP=3600 # 1 day sleep time when Battery Level is equal or below the "BATTERYLOW" threshold, see above. 10 | PINGHOST="www.google.com" # which domain (or IP) to ping to check internet connectivity. 11 | ROUTERIP="192.168.0.1" # router gateway IP. The Kindle appears to sometimes forget the gateway's IP and we need to set this manually. 12 | LOGGING=1 # if enabled, the script logs into a file 13 | DELAY_BEFORE_SUSPEND=10 # seconds to wait between drawing image and suspending. This gives you time to SSH into your device if it's inside the photo frame and stop the daemon 14 | RESTART_POWERD_THRESHOLD=50 # restart powerd if battery percentage is below this value, if a power source is connected and the charging current is negative 15 | 16 | NAME=homeassistant 17 | NAMEOLD=homeassistant_old 18 | SCRIPTDIR="/mnt/us/extensions/homeassistant" 19 | LOGFILE="${SCRIPTDIR}/${NAME}.log" 20 | 21 | NET="wlan0" 22 | 23 | LIMG="${SCRIPTDIR}" 24 | LIMGBATT="${SCRIPTDIR}/low_battery.png" 25 | LIMGERR="${SCRIPTDIR}/error.png" 26 | LIMGERRWIFI="${SCRIPTDIR}/wifi.png" 27 | 28 | TMPFILE="${SCRIPTDIR}/cover.temp.png" 29 | SCREENSAVERFILE="${SCRIPTDIR}/cover.png" 30 | 31 | USE_RTC=1 # if 0, only sleep will be used (which is useful for debugging) 32 | RTC=1 # use rtc1 by default 33 | -------------------------------------------------------------------------------- /extensions/homeassistant/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home Assistant 5 | 0.1 6 | sibbl 7 | HomeAssistant 8 | 9 | 10 | menu.json 11 | 12 | 13 | -------------------------------------------------------------------------------- /extensions/homeassistant/daemon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DAEMON_PATH="/mnt/us/extensions/homeassistant" 4 | 5 | DAEMON="./script.sh" 6 | DAEMONOPTS="" 7 | 8 | NAME=homeassistant 9 | DESC="Home Assistant daemon" 10 | PIDFILE=${DAEMON_PATH}/$NAME.pid 11 | SCRIPTNAME=/etc/init.d/$NAME 12 | 13 | case "$1" in 14 | start) 15 | printf "%-50s" "Starting $NAME..." 16 | cd $DAEMON_PATH 17 | PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!` 18 | #echo "Saving PID" $PID " to " $PIDFILE 19 | if [ -z $PID ]; then 20 | printf "%s\n" "Fail" 21 | else 22 | echo $PID > $PIDFILE 23 | printf "%s\n" "Ok" 24 | fi 25 | ;; 26 | status) 27 | printf "%-50s" "Checking $NAME..." 28 | if [ -f $PIDFILE ]; then 29 | PID=`cat $PIDFILE` 30 | if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then 31 | printf "%s\n" "Process dead but pidfile exists" 32 | else 33 | echo "Running" 34 | fi 35 | else 36 | printf "%s\n" "Service not running" 37 | fi 38 | ;; 39 | stop) 40 | printf "%-50s" "Stopping $NAME" 41 | PID=`cat $PIDFILE` 42 | cd $DAEMON_PATH 43 | if [ -f $PIDFILE ]; then 44 | kill -HUP $PID 45 | printf "%s\n" "Ok" 46 | rm -f $PIDFILE 47 | else 48 | printf "%s\n" "pidfile not found" 49 | fi 50 | ;; 51 | 52 | restart) 53 | $0 stop 54 | $0 start 55 | ;; 56 | 57 | *) 58 | echo "Usage: $0 {status|start|stop|restart}" 59 | exit 1 60 | esac -------------------------------------------------------------------------------- /extensions/homeassistant/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/extensions/homeassistant/error.png -------------------------------------------------------------------------------- /extensions/homeassistant/low_battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/extensions/homeassistant/low_battery.png -------------------------------------------------------------------------------- /extensions/homeassistant/menu.json: -------------------------------------------------------------------------------- 1 | { 2 | "items": [ 3 | {"name": "Home Assistant", 4 | "items" : [ 5 | {"name": "Run", "priority":0, "action": "script.sh"} 6 | ] 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /extensions/homeassistant/rtcwake: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/extensions/homeassistant/rtcwake -------------------------------------------------------------------------------- /extensions/homeassistant/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # load config 4 | if [ -e "config.sh" ]; then 5 | source ./config.sh 6 | else 7 | logger "Could not find config.sh in $(pwd)" 8 | echo "Could not find config.sh in $(pwd)" 9 | exit 10 | fi 11 | 12 | # load utils 13 | if [ -e "utils.sh" ]; then 14 | source ./utils.sh 15 | else 16 | logger "Could not find utils.sh in $(pwd)" 17 | echo "Could not find utils.sh in $(pwd)" 18 | exit 19 | fi 20 | 21 | kill_kindle 22 | customize_kindle 23 | 24 | GLOBAL_ERROR_COUNT=0 25 | 26 | while true; do 27 | echo "Starting new loop" 28 | logger "START NEW LOOP" 29 | 30 | logger "Set CPU scaling governer to powersave" 31 | echo powersave >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 32 | 33 | logger "Set prevent screen saver to true" 34 | lipc-set-prop com.lab126.powerd preventScreenSaver 1 35 | 36 | echo "Check battery level" 37 | 38 | CHARGING_FILE=`kdb get system/driver/charger/SYS_CHARGING_FILE` 39 | IS_CHARGING=$(cat $CHARGING_FILE) 40 | CHECKBATTERY=$(gasgauge-info -s | sed 's/.$//') 41 | CHECKCHARGECURRENT=$(gasgauge-info -l | sed 's/mA//g') 42 | 43 | logger "Battery: isCharging=${IS_CHARGING} percentage=${CHECKBATTERY}% current=${CHECKCHARGECURRENT}mA" 44 | 45 | if [ ${IS_CHARGING} -eq 1 ] && [ ${CHECKBATTERY} -le ${RESTART_POWERD_THRESHOLD} ] && [ ${CHECKCHARGECURRENT} -le 0 ]; then 46 | logger "Restarting powerd" 47 | /etc/init.d/powerd restart 48 | fi 49 | 50 | if [ ${CHECKBATTERY} -le ${BATTERYLOW} ]; then 51 | logger "Battery below ${BATTERYLOW}" 52 | eips -f -g "${LIMGBATT}" 53 | ./rtcwake -d rtc$RTC -s $BATTERYSLEEP -m mem 54 | sleep 30 # waiting time when charging until battery level is higher than "BATTERYLOW" otherwise it will fall into sleep again 55 | else 56 | logger "Remaining battery ${CHECKBATTERY}" 57 | fi 58 | 59 | ### activate wifi 60 | logger "Enabling and checking wifi" 61 | lipc-set-prop com.lab126.wifid enable 1 62 | 63 | echo "Check wifi connection" 64 | WLANNOTCONNECTED=0 65 | WLANCOUNTER=0 66 | PINGNOTWORKING=0 67 | PINGCOUNTER=0 68 | ERROR_SUSPEND=0 69 | 70 | ### wait for wifi 71 | while wait_wlan; do 72 | if [ ${WLANCOUNTER} -gt 5 ]; then 73 | logger "Trying Wifi reconnect" 74 | /usr/bin/wpa_cli -i $NET reconnect 75 | fi 76 | if [ ${WLANCOUNTER} -gt 30 ]; then 77 | logger "No known wifi found" 78 | logger "DEBUG ifconfig $(ifconfig ${NET})" 79 | logger "DEBUG cmState $(lipc-get-prop com.lab126.wifid cmState)" 80 | logger "DEBUG signalStrength $(lipc-get-prop com.lab126.wifid signalStrength)" 81 | eips -f -g "${LIMGERRWIFI}" 82 | WLANNOTCONNECTED=1 83 | ERROR_SUSPEND=1 #short sleeptime will be activated 84 | break 1 85 | fi 86 | let WLANCOUNTER=WLANCOUNTER+1 87 | logger "Waiting for wifi ${WLANCOUNTER}" 88 | sleep $WLANCOUNTER 89 | done 90 | 91 | if [ ${WLANNOTCONNECTED} -eq 0 ]; then 92 | logger "Connected to wifi" 93 | 94 | ### lost standard gateway if wifi is not available 95 | GATEWAY=$(ip route | grep default | grep ${NET} | awk '{print $3}') 96 | logger "Found default gateway ${GATEWAY}" 97 | if [ -z "${GATEWAY}" ]; then 98 | route add default gw ${ROUTERIP} 99 | logger "Default gateway lost after sleep" 100 | logger "Setting default gateway to ${ROUTERIP}" 101 | fi 102 | 103 | echo "ping" 104 | 105 | ### wait for working ping 106 | while wait_ping; do 107 | if [ ${PINGCOUNTER} -gt 5 ]; then 108 | logger "Trying Wifi reconnect" 109 | /usr/bin/wpa_cli -i $NET reconnect 110 | fi 111 | if [ ${PINGCOUNTER} -gt 10 ]; then 112 | logger "Ping not working" 113 | logger "DEBUG ifconfig $(ifconfig ${NET})" 114 | CMSTATE=$(lipc-get-prop com.lab126.wifid cmState) 115 | logger "DEBUG cmState ${CMSTATE}" 116 | logger "DEBUG signalStrength $(lipc-get-prop com.lab126.wifid signalStrength)" 117 | eips -f -g "${LIMGERRWIFI}" 118 | PINGNOTWORKING=1 119 | ERROR_SUSPEND=1 #short sleeptime will be activated 120 | break 1 121 | fi 122 | let PINGCOUNTER=PINGCOUNTER+1 123 | logger "Waiting for working ping ${PINGCOUNTER}" 124 | logger "Trying to set route gateway to ${ROUTERIP}" 125 | route add default gw ${ROUTERIP} 126 | sleep $PINGCOUNTER 127 | done 128 | 129 | if [ ${PINGNOTWORKING} -eq 0 ]; then 130 | logger "Ping worked successfully" 131 | 132 | echo "Downloading and drawing image" 133 | DOWNLOADRESULT=$(wget -q "$IMAGE_URI" -O $TMPFILE) 134 | logger "Download result ${DOWNLOADRESULT}" 135 | echo $DOWNLOADRESULT 136 | if $DOWNLOADRESULT; then 137 | mv $TMPFILE $SCREENSAVERFILE 138 | logger "Screen saver image file updated" 139 | if [ ${CLEAR_SCREEN_BEFORE_RENDER} -eq 1 ]; then 140 | eips -c 141 | sleep 1 142 | fi 143 | eips -f -g ${SCREENSAVERFILE} 144 | else 145 | logger "Error updating screensaver" 146 | if [ ${CLEAR_SCREEN_BEFORE_RENDER} -eq 1 ]; then 147 | eips -c 148 | sleep 1 149 | fi 150 | eips -f -g ${LIMGERR} #show error picture 151 | ERROR_SUSPEND=1 #short sleep time will be activated 152 | fi 153 | 154 | rm ${TMPFILE} -f 155 | logger "Removed temporary files" 156 | 157 | if [ ${CHECKBATTERY} -le ${BATTERYALERT} ]; then 158 | eips 2 2 -h " Battery at ${CHECKBATTERY}%, please charge " 159 | fi 160 | fi 161 | fi 162 | 163 | sleep $DELAY_BEFORE_SUSPEND 164 | 165 | echo "Calculate next timer and going to sleep" 166 | 167 | if [ ${ERROR_SUSPEND} -eq 1 ]; then 168 | let GLOBAL_ERROR_COUNT=GLOBAL_ERROR_COUNT+1 169 | TODAY=$(date +%s) 170 | WAKEUPTIME=$((${TODAY} + ${INTERVAL_ON_ERROR} - ${DELAY_BEFORE_SUSPEND})) 171 | logger "An error has occurred, will try again on ${WAKEUPTIME}" 172 | 173 | if [ ${GLOBAL_ERROR_COUNT} -ge 10 ]; then 174 | logger "REBOOT BECAUSE OF 10 ERRORS" 175 | reboot 176 | fi 177 | 178 | if [ ${USE_RTC} -eq 1 ]; then 179 | ./rtcwake -d rtc$RTC -s $INTERVAL_ON_ERROR -m mem 180 | else 181 | sleep $INTERVAL_ON_ERROR 182 | fi 183 | else 184 | GLOBAL_ERROR_COUNT=0 185 | TODAY=$(date +%s) 186 | WAKEUPTIME=$((${TODAY} + ${INTERVAL} - ${DELAY_BEFORE_SUSPEND})) 187 | logger "SUCCESS, will update again on ${WAKEUPTIME}" 188 | 189 | if [ ${USE_RTC} -eq 1 ]; then 190 | ./rtcwake -d rtc$RTC -s $INTERVAL -m mem 191 | else 192 | sleep $INTERVAL 193 | fi 194 | fi 195 | 196 | done 197 | -------------------------------------------------------------------------------- /extensions/homeassistant/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sleep 120 3 | sh /mnt/us/extensions/homeassistant/daemon.sh start -------------------------------------------------------------------------------- /extensions/homeassistant/utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | kill_kindle() { 4 | /etc/init.d/framework stop >/dev/null 2>&1 5 | /etc/init.d/cmd stop >/dev/null 2>&1 6 | /etc/init.d/phd stop >/dev/null 2>&1 7 | /etc/init.d/volumd stop >/dev/null 2>&1 8 | /etc/init.d/tmd stop >/dev/null 2>&1 9 | /etc/init.d/webreader stop >/dev/null 2>&1 10 | killall lipc-wait-event >/dev/null 2>&1 11 | } 12 | 13 | customize_kindle() { 14 | mkdir /mnt/us/update.bin.tmp.partial -f # prevent from Amazon updates 15 | touch /mnt/us/WIFI_NO_NET_PROBE # do not perform a WLAN test 16 | } 17 | 18 | wait_wlan() { 19 | return $(lipc-get-prop com.lab126.wifid cmState | grep CONNECTED | wc -l) 20 | } 21 | 22 | wait_ping() { 23 | CONNECTED=0 24 | /bin/ping -c 1 $PINGHOST >/dev/null && CONNECTED=1 25 | return $CONNECTED 26 | } 27 | 28 | logger() { 29 | MSG=$1 30 | 31 | # do nothing if logging is not enabled 32 | if [ "x1" != "x$LOGGING" ]; then 33 | return 34 | fi 35 | 36 | # if no logfile is specified, set a default 37 | if [ -z $LOGFILE ]; then 38 | $LOGFILE=stdout 39 | fi 40 | 41 | echo $(date): $MSG >>$LOGFILE 42 | } 43 | -------------------------------------------------------------------------------- /extensions/homeassistant/wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sibbl/hass-lovelace-kindle-4/5661d250a8d92d05770ea7f84b9dde62c44addfe/extensions/homeassistant/wifi.png -------------------------------------------------------------------------------- /kite/onboot/homeassistant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sh /mnt/us/extensions/homeassistant/startup.sh & --------------------------------------------------------------------------------