Git Product home page Git Product logo

evalscreen's Introduction

evalscreen - check for aborted Chromium kiosk screen

Inspired by Scott Hanselmans wall mounted Family Calendar I installed a monitor with an attached Raspberry Pi Zero W 2 years back and been experimenting with various technical approaches to host the web page for this family board. Currently it is Blazor WebAssembly.

This app occasionally breaks (or has to recover from a wireless connection loss). Surely I will invest some time in the future to get down to the actual root cause of the problem, but until then I wanted to have a more or less intelligent way of refreshing when the kiosk app breaks.

setup required

  • Linux scrot utility to capture screen
  • Python 3 with PIL library installed to evaluate color of captured screen
  • xdotool to refresh Chromium page

shell script to drive the process

The script evalscreen.sh

  1. uses scrot to capture a low quality (20% is sufficient for evaluation) screen image
  2. runs image through Python script evalimage.py (see below)
  3. with Python script signals an error level not equal to 0 a refresh with xdotool is initiated

This script is scheduled each minute with cron:

# m h  dom mon dow   command
*/1 *   *   *   *    /home/pi/evalscreen/evalscreen.sh >> /home/pi/evalscreen/evalscreen.log 2>&1

Python script to evaluate the image

Based on this StackOverflow post I created this Python script evalimage.py that determines the most present color in the captured image. As my family board has a black background I assume when the most present color is not black, it is broken. When assumed broken it exits with error level 1.

cleaning up

Not to forget that the growing log file needs to be kept in check. For that I added a file /etc/logrotate.d/evalscreen:

/home/pi/evalscreen/evalscreen.log {
  rotate 12
  daily
  compress
  missingok
  notifempty
}

closing

After looking into the issue itself after some days it turned out that I just needed to do a clean reinstall of chromium-browser and rpi-chromium-mods.

evalscreen's People

Contributors

kaiwalter avatar

Stargazers

 avatar Jiho Lee avatar hayden avatar Karl Lindberg & Kilian Güntner avatar Sam Gross avatar

Watchers

James Cloos avatar  avatar

Forkers

paaland almedes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.