Tag Archives: Thingbox on the Pi – suitable for advanced users or not?


tmpAE2DUpdate 03/01/2016 17:00: 

I spent (wasted) much of New Year’s Eve and New Year’s Day setting up a brand new “Jessie” installation on a Raspberry Pi 2,  at the end of which I had managed to put 2 copies of Node-Red on the same machine, the sound would not come out of the 3.5” adaptor (yes, I’d messed with Raspi-Config) and the serial adaptor would not appear. Previous installations in “Wheezy” had worked fine – but this one – using “Jessie” was determined to be a pain in the bum.

(For the uninitiated, “Wheezy” and “Jessie” are code-names for versions of “Raspbian” – the operating system used on the Rasberry Pi computers).

ThingboxAnd so it was that someone in the blog pointed me to ThingBox – a package I’d looked at ages ago and which I’d previously dismissed as it was a little simple. For my purposes I needed a lot of software on the Pi (much of which subsequently proved to be un-necessary such as the full-blown MYSQL database).

I decided to look again.

Well, things have moved on. I’m not entirely sure they’ve used “Jessie” as the www directory is still /var/www – but I digress.

Installing “ThingBox” which is a combination of operating system, various tools and a special-purpose “Node-Red” – designed for non-programmers – is all quite simple really. Grab a 16GB SD card, grab the .IMG file from their website, install the .img file using Win32DiskManager or whatever is your favourite tool for blowing images. Plug in the Internet lead and speaker cable – add power and wait.

In about 30 seconds or so – you’re done with phase one – a fully working Node-Red installation.

You don’t even have to go looking for ThingBox as it appears on your network as “http://thethingbox.local/

I had my reservations – this was not designed for “experts” and I wondered if it would be too restrictive.

If you want to go tinkering with WinSCP to remote access the actual operating system – the username is root and the password is rasberry – and it soon became clear that I would need this – as I could see no sign of a database and today I use SqlLite3.

MP3, sound, serial, PI IO etc are all on there and working and two of those had been my problem to start with. My owb nodes are missing as are a couple of others for speech etc but now it is even easier to install these as the guys who developed ThingBox have added tools to do this.

I need SQLITE3 and so I went about installing that using WinSCP and my normal “script” – suffice it to say that this killed ThingBox – because it installed PHP or at least put Apashe back in charge of Port 80 – so – I went into the ThingBox config file at /root/thethingbox/thethingbox.js and sure enough they had set the system to use port 80 rather than the normal 1880 – I initially set it back to 1880 but then decided it would be a much better idea to set Apache to port 81 and leave ThingBox alone. That worked.

Thingbox worked perfectly – as did SQLITE3 (the node has to be installed manually in a terminal – the usual “npm install…” then I figured as I’d make a batch file to install that, I may as well have the batch file install SQLITE and all my nodes.

I also installed node-red-contrib-ui – it appeared in the editor but would not work in the normal address of thethingbox.local:1880/ui – or even thethingbox.local/ui  which was a worry until blog reader LEORRR pointed out that changing that to /api/ui works just fine.

There is a tool within the package for installing nodes - you don’t even have to go to the command line – which is always a good thing. But for whatever reason it would not accept the  SQLITE3 node – thankfully that went in the normal way from the the command line – hence my idea to use a script – necessary anyway to speed up implementation in the event of an update to ThingBox.

I appear to have a working setup with very little effort and with more working nodes than I’d managed myself.

The file /root/thethingbox/thethingbox.js looked remarkably like the normal settings.js for Node-Red and so I went in and had a tinker. I’ve just copied the relevant bits here and marked in RED the ones I changed.

    functionGlobalContext: {
        settings: settings_ttb
        ,userDir: userDir
        ,settingslib: require('/root/thethingbox/settingsttb.js')
        ,wpi: require('node-red/node_modules/wiring-pi') // https://www.npmjs.com/package/wiring-pi
        ,CryptoJS: require('node-red/node_modules/crypto-js') // https://www.npmjs.com/package/cryptojs



    adminAuth: {
        type: "credentials",
        users: [{
           username: "admin",
            password: "$2a etc etc etc",
            permissions: "*"

    httpNodeAuth: {user:"user", pass:"63255 etc etc etc"}

I added in my normal security (only works with recent versions of Node-Red) as you see above and a couple of useful includes (assuming MOMENT has been added also by NPM)

Well, it all works  - BUT for the httpNodeAuth. The editor asks for a login password as normal – and that’s great, but critically the UI does NOT ask for a password – I still have no idea why not.

So clearly if the designers make significant changes, a script is going to be needed to automate putting my stuff back in (easy) but that security for the UI needs sorting.

I left lots of questions with the designer and eventually he came back to me but he was heading off to some exhibition so I don’t expect to hear from him for a few days. He agrees that UI is important so it may be we can sort this out with Andrei (UI) involved  - I don’t want to distract him right now as he’s going to work on using .PNGs in the UI and that’s important too.

In summary: If the issue of the UI password can be resolved (this would apply to any other package sitting on top of Node-Red – web page etc… and see below for reasons for failure -  provided there are no hidden demons I have yet to discover,  this looks like a reasonable way to get Node-Red up and running. Well done to the people at theThingBox.io for what must have been quite a lot of work.

Bugs/Issues: Although I can open up a terminal and type “reboot” – there still seems to be to shut the package down – but see further down – I came up with a solution.

The security for UI needs sorting and I noticed issues with the SOUND and VOLUME nodes. The SOUND node states that one of the outputs activates when the sound is finished. It does NOT.. it comes back before the end. I installed and used MPG123 and fired that off via an EXEC node instead – that works a treat. Finally VOLUME – might just be me but I could not see how to change the volume – there’s a slider that does not seem to do much. Perhaps someone can enlighten me on that. Opening a terminal and typing …amixer set PCM 0, 100% sorts it out but that’s hardly satisfactory – nor permanent for starters. I tried that in an EXEC node – nothing.

When installing SQLITE it is necessary to change 2 references to port 80 to 81 in /etc/apache2/ports.conf and one reference in /etc/apache2/sites-enabled/000-default

And I found a rather crude solution to turning the Pi off – one that lends itself to automation..  In the Node-Red editor – add an EXEC node and in there, (un-tick the box for appending) – put “shutdown –h now” without the quotes.  Send any input to that EXEC box and the system will shut down entirely leaving only the PI red light on. Simples.

Just about got a script working to take the pain away. The ONLY thing I’ve not been able to crack is putting password security back onto /api/ui – and it turns out that isn’t going to work as Thingbox is not using the latest Node-Red yet (it is also using Wheezy not Jessie (thanks for that, Dave).

I assuming SOUND will get fixed and that there really is a use for that VOLUME control.