I was running with my buddy Priit, when I accidentally dropped my trusty Nexus 5 phone and cracked its screen. The screen had fractures, but was still perfectly legible; and the hardware still functioned. So, instead of throwing it away, I gave it a new life on my wall, as a personal “HUD” screen, showing relevant info such as weather, time and bus schedules.
The first revision was just a hacked-together
It fetched relevant data from publicly available API-s and displayed it out. The page took as little work as possible,
to get the prototype usefulness validated.
As I was already running a in-home Openshift3 cluster, deploying it into a Nginx stateless web container was a non-issue and after two nights of hacking I had a functional prototype.
- Display current time using moment.js
- Show current weather and the forecast for the next three hours using data from OpenWeatherMap API
- Show the departure times (using real-time GPS predictions) of busses from my nearest stop using the undocumented and quite horrible CSV “API” from Tallinn city
- Always-on screen on dark background
The solution was quick to implement and worked; providing useful information when I was heading out. However, as quick PoC-s often do, it had its problems:
- The codebase was a mess - literally hacked together into a couple of files. It needed refactoring and “beautification” before I dared show it to anyone
- All config was hardcoded
- It was not very modular nor expandable (with new features)
- After a couple of months, I learned what screen burn-in means
Screen burn-in: the outlines of previous content are visibly “burned in”.
I was satisfied that the concept worked and provided value; time to refactor.
I ordered a cheap-ish, but still good quality (excellent, large screen!) tablet from China -Teclast T10. This gave me larger screen real-estate and also a better quality (and not broken) touch-screen.
I rewrote the code from zero and split the project into two parts: screen-frontend (Vue.js) and screen-backend (Python / Flask). This allowed me to do it in a API-first manner and also keep everything nice and apart.
I removed most of the hardcoded values (weather station to use, bus stop ID-s) from the code, which makes it more portable and - in theory - allows others to benefit from the project, although this is not a goal in itself.
I switched to weather data provider to the national weather service, because they have local data (although in XML…) and audio reports.
http://www.ilmateenistus.ee/ilma_andmed/xml/hoiatus.php API respond with
HTTP 404 for valid queries is beyond me.
Whoever developed that endpoint owes me 30 minutes of lost time.
I solved the screen burn-in problem by keeping the screen OFF most of the time. The tablet turns the screen ON automatically for five minutes when the front-facing camera detects motion. This saves the screen, some power and also keeps the ambient light low at night. This can be done with the Fully kiosk browser.
- Show current time
- Show current weather + forecast for the next couple of days
- Play weather forecast in audio form (audio provided by the national weather service)
- Highlight and display weather alerts for my area, if there are any
- Show bus schedule in real-time
- Track investments
- Turn screen ON only if motion is detected
Tentative future plans include refactoring the codebase some more (don’t look at my variable names…) and adding more features, for example a tab that shows readings from home IoT sensors.
As the tablet is running its original Chinese firmware, I don’t consider it a “trusted” device: it could be doing much more than only detect motion with its camera. Hence, I will either try to flash stock Android to it (tried once, failed, any links to tutorials for this specific model are appreciated) or more likely, use my PFSense & IoT WiFi to block its access to the outside Internet.
- Python / Flask experience
- Open source credz (both the backend and frontend are in GitHub)