Wall-mounted Dashboards (part 2)

Tablet firmware and software.
 2020-03-14

This is the second article in a series of articles about my DIY approach to wall-mounted home automation dashboards. See the first part for initial planning, hardware, mounting and power supplies.

A big disappointment

My initial idea was to build an intercom system with these tablets. This turned out to be a bad idea, for two reasons:

  • Tablet’s microphone and speaker quality: They were pretty bad! I did some initial testing with various open-source Android softphones, and you had to stand pretty close to the tablet for the mike to pick up anything reliably, and the speakers were pretty weak! The fact that they are on the back of the tablet, facing the wall, didn’t help at all.

  • Bad usability: We (the parents) realized that we don’t really want to speak with our kids over the intercom, we want to call them, so they come to us, so we can speak face-to-face.

So we had a change of plans: the dashboard would have a button to ring a bell in kids’ rooms, and they were required to come down immediately after turning the bell off. This works surprisingly well (especially if we call them for dinner and not to do the dishes).

Software on the tablet

Since the tablet sole purpose is now to just show a web app (the dashboard), we don’t need much here:

  • Titanium Backup: I wasn’t looking forward to set up 7 tablets in exactly the same way, so I rooted them all and used a backup program to copy the configuration and all the software from one “master” tablet to all the others. The only thing that differs is the dashboard URL: each room has a different dashboard.

  • Fully Kiosk Browser: This app is amazing! It shows one URL in a full-screen mode, and locks the tablet pretty tight: you cannot exit it (without a pin), it can also disable volume and power buttons, it can leave the tablet “always on”, etc. Very powerful, and it fits my use case perfectly. It is not free, but not too expensive either.

  • Tasker: I needed certain automatic actions to happen on these tablets, and Tasker does such a job perfectly. See below for details.

Minimal brightness

The tablets are always on, and the screens are too bright for bedrooms during the night. Using “standard” Android means to tweak the brightness, you can go down to about 20%, but it’s still too bright. After a bit of poking around, I found a way to control the LCD backlight LED brightness directly, using the Linux driver: you just need to write a decimal between 0 and 255 to /sys/class/leds/lcd-backlight/brightness (this is obviously very hardware-specific).

How I set it up in Tasker

A. Created simple day / night mode profile to set a variable night_mode to 1 between 10pm and 7am and to 0 otherwise.

B. Created a Tasker profile to monitor /sys/class/leds/lcd-backlight/brightness file for changes. Every time it changes, the following “set brightness” script is run:

1. Wait: 2 seconds
2. Read file: `/sys/class/leds/lcd-backlight/brightness` to `current_brightness` variable
3. If "current_brightness == 20 || ((current_brightness == 3) && (night_mode != 1))":
    Run shell "echo 10 > /sys/class/leds/lcd-backlight/brightness"
4. If "current_brightness == 20 || ((current_brightness == 10) && (night_mode == 1))":
    Run shell "echo 3 > /sys/class/leds/lcd-backlight/brightness"

This script turns down the brightness to 10% during the day (down from Android’s standard 20% “idle” brightness), and down to 3% during the night. It does this every time day/night mode changes, and every time Android itself turns down the brightness to 20% when the tablet goes into idle mode.

Additional quirks and minor tweaks

The tablets work mostly OK, but since they are on 24/7, I did face some occasional issues: the tablets would lock up once in a while, and the Wi-Fi would disconnect randomly every few weeks on some tablets. I solved this also with Tasker:

Rebooting the tablet on a schedule

I set up each tablet to run svc power reboot shell command with root permissions every day at 10am. This gracefully reboots the whole Android system (there are many online instructions on how to reboot, but most of them describe “hard” reboot which will cause issues if you do it every day).

“Fixing” the Wi-Fi

I just ping the local router IP address, and the command fails, turn the Wi-Fi off, wait 3 seconds, and turn it back on. This simple script fixes it:

# The exclamation mark below negates the results, so further commands run only if ping fails.
Run Shell: "! ping -c 10.8.8.8" 
Wifi: "Set off"
Wait: "3 seconds"
Wifi: "Set on"

What’s next?

Part 3: Web app for the dashboard.

See also

Automating "lunch" Slack status

Set my Slack status from the Home Automation dashboard.

Wall-mounted Dashboards (part 1)

Initial planning, hardware, mounting, power supplies.