1
10 Comments

Tech people: I need your suggestions

I am working in my project about smart TVs that will be placed in some points of my city. Those points display content uploaded by my customers to my app, which is made in Ruby on rails.

The appoach I have used for the TVs, is a raspberry PI which load a view full screen on start. Problem is... if sometimes does not load correctly, then the only option is a manual restart... that is not a choice.

I have been considering to do a little client which just ask for the JSONs and make like a little game with some visual libraries (PyGame, Ruby2d..etc). The advantages would be full control and the posibility to implement a so-called 'manual caché' that will help me to spend less money on AWS.

The question is: How can I do that as easy as possible? Any suggestion? Any bad or good aspect I have not considered?

PD: I have tech background but not consider myself really a professional, but an ethernal hack-ish amateur.

Thanks in advance :)

posted to Icon for group Ideas and Validation
Ideas and Validation
on January 3, 2020
  1. 1

    Some kind of heart beat perhaps?

    Two parts:
    1)
    A small program on the pi that hits an end point on your server every minute asking the question... Should I restart... Your server responds with No if all is good, yes + a URL if an error is detected and the pi restarts with a specific url to load...

    Every URL you load in the browser runs a small Javascript function at the end of the load process... that Javascript ajax calls an endpoint on the server to say it loaded ok and is at the end of your load...

    When you get a url request, you time the reception of the Acknowledge message sent by part 2. If it is not received in a reasonable time, next time part 1 calls, you return YES to the reboot question and the board reboots loading the URL you sent it...

    Naturally, if you get the Acknowledge message from part 2, then you just keep answering NO to the reboot request in 1 and all is good... You can also periodically just sent a reboot to all your devices to just reset them once a day... to clear any memory leaks that could accumulate and freeze the board...

    This is all software... there are other ideas with hardware circuits that could reset the board unless its timer is reset... would require a browser extension or something... Many way to skin that cat...

    Hope this helps

    1. 1

      Thank you very much.

      After considering all options I could get, I think I will implement your strategy in 2 phases. The first one, the heart beat as way to know in the dashboard if there is trouble (in the beginning, the pilot is so small that I can go physically), and after having more info and experince, maybe I will do as you say. How would you do this little application? Python maybe?

  2. 1

    A bash script that confirms the bowser is running correctly?

    Then you can regularly check every 30 minutes, not just on load. Also, a bash script could ping an API for you to identify any TVs not running or running with errors.

    1. 1

      I would need to check that the page has loaded correctly in the browser. Is it possible to do this? I think that to do that on bash is way beyond my knowledge.

      I thought something similar making little POST (kind of ping) with TV number, status and son on.

      1. 1

        You could also just have good error monitoring and use process monitor that retries startup on an uncaught error.

      2. 1

        Many years ago...

        For entertainment I wrote a bash script that took a screenshot every 30 seconds. At the end of 1 week it automatically compiled the screenshots into a video of my computer for the last week. Wouldn't be too terribly hard to take a screenshot and automatically upload it (ssh->scp) to a server for you to then review and confirm working. The next step would then be automated analysis that automatically confirms the screenshot against a test image so then you wouldn't have to manually look at each image, but that's the next step.

        My email & Twitter are in my profile and I can probably help on this if you need it.

        1. 1

          Thanks so much.

          In mi mind, check a 200 code would be alright, but I can do that in JS, not in bash with the browser in the middle.

          Also, nowadays python has cover the same areas than Bash but simplier and with plenty of easy libs.

          1. 1

            Yes, I always skip Python because I don't know it well (plan to learn in 2020).

            The only caution I have against checking the HTTP code in JS is if the initial JS doesn't load then you can't run that check.

            It'd be easy enough to ping an API then write on the API side an SQL/Python that does "SELECT tv-name WHERE tv-name NOT IN (SELECT tv-name WHERE date > NOW()-5mins)". I.E. A sub-select that then highlights TV's that have not pinged in the last 5 minutes and therefore are not running properly.

  3. 1

    Why not use a browser that loads a web app?

    1. 1

      Because if for whatever cause fail to load the first time the js, the browser will show that there was a mistake, but it won't be possible to refresh via code.

  4. 1

    This comment was deleted 5 years ago.

Trending on Indie Hackers
I spent $0 on marketing and got 1,200 website visitors - Here's my exact playbook User Avatar 58 comments Veo 3.1 vs Sora 2: AI Video Generation in 2025 🎬🤖 User Avatar 29 comments Codenhack Beta — Full Access + Referral User Avatar 21 comments I built eSIMKitStore — helping travelers stay online with instant QR-based eSIMs 🌍 User Avatar 20 comments 🚀 Get Your Brand Featured on FaceSeek User Avatar 18 comments Day 6 - Slow days as a solo founder User Avatar 16 comments