Build your own energy-efficient Jenkins Monitor

Jul 10, 2015

Well, maybe not directly related to OX, but for sure to tech and to development! And of course, you can also run OX App Suite or OX Drive this way.

I wanted to give some of our old monitors a new life by becoming 24/7 Jenkins monitors. But how to make them display a web page? There are many ways to do that, but I was looking for a solution which is inexpensive, yet energy-efficient.

The Amazon Fire TV Stick seems to be a perfect match: It’s just a small stick you place directly into the HDMI port, it’s inexpensive, quite powerful, but still extremely energy-efficient. From what I heard, power consumption is only around 2W.

Out of the box, the Fire TV Stick doesn’t let you do what you need. There is no Browser available in the Amazon App Store for Fire TV, and once you managed to get one, additional surprising hurdles show up.

Here is my step-by-step guide to install and configure everything you need. It applies to the Fire TV (aka AFTV) as well as to the Fire TV Stick.

 

Preparations

Connect your Fire TV Stick to the monitor, and perform the basic configuration if not done yet, for example the Amazon account and network settings.

Your Jenkins Monitor should be visible all the time, so disable the screen saver:

  • <em>Settings / Display & Sounds / Screen Saver / Start Time => Never</em>

We need to use the Android Debug Bridge (aka ADB) to perform advanced tasks, so enable it:

  • Settings / System / Developer Options => Enable “ADB debugging”

This is probably only needed, if your Apps later want to update automatically – let’s enable it just in case:

  • Settings / System / Developer Options => Enable “Apps from Unknown Sources”

 

Getting the Apps you need

We need to install apps via Side Loading. There are different ways to do side loading, I decided to use the ADB Method. On Windows, the 15 second ADB Installer will help you to quickly setup all the tools and drivers you need.

Please note that the Fire TV Stick and your computer running ADB must be inside the same network.

Figure out the IP address of your Fire TV:

  • Settings / System / About / Network

Now connect your computer to your Fire TV:

  • adb connect <ip address>, e.g. adb connect 192.168.0.99

You can download Apps via the web page APK Downloader v2, or install and extract it on an Android phone or tablet. Another option, and my preferred one, is to use the open source tool Raccoon.

Apps that you side loaded won’t appear on the Fire TV Main page, and you need to travel through multiple menu hierarchies. This is not very handy, so we first install the FireStarter to make life easier.

Download the FireStarter apk, and run

  • adb install <path-to>\FireStarter-v2.6.apk

Launch FireStarter once via the regular Fire TV menu, later it will start automatically after a reboot, and it will also launch when pressing the home button.

  • Settings / Applications / Manage Installed Applications => FireStarter => Launch Application

 

Navigating your Apps

Navigating Apps, which are typically not designed for being controlled with a TV remote, can sometimes be difficult, if not impossible. Let’s use an App on our phone to simulate a mouse or connect a Bluetooth mouse.

 

Simulating devices
  • Install Wukong TV Remote from Google Play or iTunes on your mobile
  • Run it and connect it to your Fire TV. Wukong will automatically install its counterpart on the Fire TV.

 

Connecting Bluetooth devices

Connecting a regular Bluetooth mouse or keyboard is meanwhile officially supported on the Fire TV, but still not on the Fire TV Stick. On a Fire TV look into Settings / Controllers and Bluetooth Devices. On a Fire TV Stick, do the following:

  • Download and install a Setting.apk. This one works fine for me
  • Run the “Bluetooth Settings” App, click “OK” on “Bluetooth”
    • Do not turn off Bluetooth, as this will also disable your Remote!
    • If you did by accident, use the Amazon Fire TV App on a mobile to control the Fire TV and turn on Bluetooth again
  • Prepare your Bluetooth device for pairing and click “Search for devices”
  • Find it in the list and click to pair

In some Apps, you will notice that you can’t scroll down with the remote and the keyboard. In this case, click somewhere with the mouse, it might sometimes need to be a clickable element. After that, you should be able to scroll up and down with the remote.

 

Finally(?) – the Browser

We need a web browser for displaying our Jenkins Monitor, so install Chrome or Firefox. Since Android does not offer you to toggle to full screen mode, but I want full screen, I did install Firefox and the Full Screen mobile Add-on. Be aware that the Full Screen Add-on will make your life difficult, if you later want to load another URL, as you will always need a physical mouse to disable full screen. If you want to avoid that hassle and don’t need full screen, consider to install Chrome instead. Chrome doesn’t waste so much space on the top compared to Firefox without Full Screen.

Full Screen Browser would be a nice option, because it offers full screen and auto refresh out of the box. Unfortunately, certain Jenkins pages will not work because CSS3 Flexbox is not supported.

To install Firefox (or any other browser), search for it in Raccoon and press download. The link on Raccoon’s download page helps you locating the apk on your computer.

Now let’s install it on the Fire TV Stick:

  • adb install <path-to>\ org_mozilla_firefox.apk

Navigate using the remote control, the phone app or the Bluetooth devices. Pressing Enter when the focus is on the URL bar will bring up the virtual keyboard. Simply use it, or make your life easier by using adb commands:

  • adb shell input text “https://my.jenkins.server/MyView”

For sending spaces, use %s. In a Windows shell you need to escape the % with another %, so use %%s.

Once the page is loaded, you can bookmark it by pressing the Menu button on the Remote. From there, you need a mouse (physical or virtual) to click the star symbol – seems it’s not possible to get there via the remote.

If you decided to use Firefox in Full Screen mode, install the Add-on via the Firefox UI. After that you can press the menu button on the remote, and activate Full Screen in the Firefox menu.

It might also be a good idea to do some Firefox configuration in Menu / Settings / Customize. Make “Bookmarks” the default page, maybe enable tab restauration so your last page loads after a restart. I didn’t find a way to configure a start page.

What about launching the Browser easily by pressing the home button on the remote twice? Just configure this in the FireStarter settings!

Now we have our Jenkins Monitor up and running. Done?

 

30 Minutes later

You look at your Jenkins monitor, and it’s not showing green or red bars. It is… blank! WTF?!

The Fire TV goes into sleep mode after 30 minutes, if the active application doesn’t tell the device not to do so. While a media player works fine (Kodi runs great on this device!), a browser doesn’t. Not sure why Amazon decided to do so. The device probably doesn’t consume measurable less power as it fully continues working and only turns off the video signal. And you can’t turn this “feature” off!

So we need another App which tells the Fire TV to stay alive – Stay Alive!

  • adb install <path-to>\com_synetics_stay_alive-49.apk

Given that the power consumption stays the same anyway, let’s simply stay alive forever, no matter of what App is active. Run Stay Alive!, and ignore the error message about Google Pay not being available. In the options, check “Enable selected Apps”, and choose “Keep screen on except for selected Apps”.

Don’t forget to start the App manually every time you restarted your Fire TV, or consider donating so you can activate the auto start.

 

Done

If everything went well, you are now done and your Jenkins Monitor will show you the current status all the time. The ugly truth. A lot of green bars, hopefully.

There are probably many other use cases that you now want your old monitors to cover – from now on, it should be easy for you to find and install the Apps you need.

If your monitor happens to have built-in speaker, what about letting it notify you and your team with a short alarm a few minutes before your Scrum Meeting? Alarm Droid allows you to setup a repeating alarm using your custom mp3 and lasting only for a specified amount of seconds.

Finally, consider disabling ADB debugging on the Fire TV for security reasons.

About the author

Malte Timmermann

Malte Timmermann

Head of Development OX Hamburg

Categories

Related Articles