ThingLayer: An open source real-time web interface for IoT


(Jody) #1

Continuing the discussion from Enhanced Web Interface Demo:

As promised I have opened the source for ThingLayer.

You will need to install the ThingLayer SmartApp and configure it to send data your own firebase instance which can be found here. You will need to edit a single line at the very end with the name of your firebase instance.

Controlling appliance module thru windows (command line)
Kuna Motion Detection with DD-WRT
Best way to collect logs from the hub?
Feature Request: Light, plug, switch monitoring
ROUNDUP: Data Logging and Charting Solutions
Playing around with Amazon Echo (technical interface discussion)
2D/3D Dashboard
Playing around with Amazon Echo (technical interface discussion)
How to migrate the database from the smart thing to my own database server?
(Eric R) #2

I’ve got the server running, but when I try to connect to ST, I get the following error:

Any ideas on how to fix it?

(Jody) #3

@baldeagle072 Did you enable oAuth in the SmartApp? You also need to apply your oAuth by creating a file config/application.yml

(Jody) #4

@baldeagle072 some things I have not tested:

I have not tried to have two “ThingLayer” apps installed at the same time. If you had been using my server before, this could be causing a conflict.

You might need to change the namespace and name of your ThingLayer SmartApp. The oAuth settings and name space can all be found under the edit app page.

(Eric R) #5

I didn’t think of that. I will try that when I get home

(Eric R) #6

Ok, I got it working. I thought I had enabled oauth, but apparently I didn’t press update. Now, I cant open the “Locations” tab. In the browser console, I’m getting the error: “GET http://IP:3000/assets/ 404 (Not Found)”

(Jody) #7

The error is not going to break anything. Pull in the latest changes and it should work.

(Andrew Maiman) #8

Thanks for open sourcing it! This looks very promising.

I managed to get it running on my server, but I’m running into a few problems. The install doc didn’t mention the need for redis-server, but I got errors on the dashboard page until I installed and activated that.

I made an assumption that ST_CLIENT_ID and ST_CLIENT_SECRET meant what I get when I enable OAuth on the SmartApp, since I didn’t see any other SmartThings API keys in my developer console. It appears to be working with those values.

I’ve successfully connected to SmartThings, imported my devices, and set up locations and zones. I’m able to control switches from the ThingLayer web page, as well.

If I attempt to edit a location, I get this error:

If I attempt to view the temperature of my Nest thermostat, this error appears:

I also noticed that instead of showing kWh for energy, it appears to be using “%” as the unit, instead:

Should the events or messages tables in the MySQL database be populating with data? They’re still empty, so far.

Let me know if there’s anything that I’m doing wrong or what I can do to help with debugging. I unfortunately do not yet have a lot of experience with Ruby, but this is a good learning opportunity.

I have it running on a Google Compute Engine f1-micro instance at the moment that I use for some of my other home automation stuff. I have port 3000 firewalled off and am accessing it through an SSH port forward until I figure out how to get SSL/TLS working on the ruby web server. (Looks like I can use thin, but haven’t had time to figure out how to make it use my certificate, yet.)

(Jody) #9

Correct. I will update the docs with the suggestions you have made here.

Do you have the firebase key/secret specified? Also you need to specify your firebase root uri.

The % showing instead of kWh is due to the device type for your energy monitor. It should be providing a unit. I am looking for better ways for this to “fail gracefully” when the device type does not provide a unit of measurement.

So far in the open source version all of the events are left in firebase. For a single user install, this should not impact your performance. I have a mechanism that will move data from the firebase store over your own sql for archival purposes, but that too is a work in progress.

(Andrew Maiman) #10

I have the Firebase URI specified. Does the Firebase secret go in the SECRET_KEY_BASE constant? (Wasn’t sure if that was for the Firebase secret or for the key generated from rake secret.) Either way, I still get the errors from above when I click on my thermostat or attempt to edit a zone/location.

It looks like the unit is making it into Firebase from the device:

(Jody) #11

@amaiman You may have found a bug. I will be pushing a fairly major update to the master branch this week. I will test for the behavior you are seeing on my code.

SECRET_KEY_BASE is from running rake secret.

(Andrew Maiman) #12

Thanks; I’ll set it back to that, then. Where should I put the Firebase secret? It looks like by default Firebase is configured to allow full access without credentials.


Jody, great work!! I think I am going to create a Docker image of your application for folks to use and deploy within their own Docker environments. I will work on it over the next couple weeks and then get back to you. A Docker image would be so much cleaner and easier to maintain (it get’s rid of a lot of questions that could come up). I don’t mind owning the tasks and forking the GitHub project into it. What are your thoughts towards this approach? Do you like the idea…or has anyone else done this with your project? The usefulness (in my personal situation) is that I can run the Docker images in a Snappy Ubuntu instance on a Raspberry Pi2MB. $35 and a couple of Docker images later (only a few seconds once it’s registered through the Docker Registry Hub) and there they’ll have it! :smile:

(Jody) #14

I have thought about it, just never got around to doing it. If you want to dockerize it, go ahead. That’s why I shared the source. I am currently working on another major update, and things just keep getting in the way of release. I hope to have it out in the next couple of weeks.


Awesome…I’ll follow the GitHub repo. If you could just keep any dependency issues updated, that would be really helpful. Again…great job…this looks very promising!

(Jody) #16

@v1k0d3n @amaiman @baldeagle072 and others.

I have started implementing the major refactors to ThingLayer. Over the weekend charting data and some other features may not work as I implement the migration. Here is a list of bug fixes feature upgrades and other changes.

  • Complete refactor of firebase integration: Firebase will now only be used for real-time events. Your event history will be stored in mysql. If you are hosting your own server this means your data privacy is increased.

  • Fixed some spelling errors and other typographical glitches.

  • Export function for downloading your data as a CSV

  • Full event list with search

  • Comparative charting

  • Charts for more data type like locks and contacts

  • Support for new devices

  • Speed improvements from refactor

  • Full screen mode

  • Better account removal process (all child objects created by a user will be destroyed if user deletes account)

  • Installation docs with screenshots

  • More interface tweaks

Please feel free to submit pull requests or bug reports to:


I will pull later today. Have you implemented on your website as well on I have been testing up there, but planning on completing the docker image buildout soon. I want to build it out with Vagrant a couple of times first though. Promising project! Keep up the good work. :smile:

(Jody) #18

I have created a responsive web interface for smart things and a few other services. I made a demo video but it appears the audio was dropped somewhere on the way to youtube, but you can get a basic idea of what the app does.

  • Works as a dashboard (runs on tablets, android boxes, computers, etc)
  • Voice command interface that does not require programming
  • Real time updates without refreshing
  • Zones with scenes/presets
  • Customizable dashboards for every room in your house
  • Charts and Graphs for your device history
  • and more

Here is the audioless video, I am making more videos and will upload them this week. If anyone is interested in trying it out just let me know.

live demo

(Steven Weinstein) #19

I would like to try this out!! Please let me know what I need to do. This looks great!!


(Darryl) #20

Isnt that ultimately… this?: ActiON, aka Web Dashboard 3.0 are these different projects?