Is it possible to connect the WebThings gateway to an external app (MIT App Inventor)?


I was wondering if the WebThings Gateway has an addon which let you connect to the WebThings gateway via an external app created with for example the MIT App Inventor or Thunkabe.

I have already created a system where an app (created with the MIT App Inventor) could sent data to a database (in my case Google Firebase), this database would then sent the data to a microcontroller with build-in WiFi module (ESP8266).

I want to keep the data to myself instead of using a middleman.
That is why I want to recreate this system by replacing Google Firebase with the WebThings Gateway. But in order to do so, I need to find a way to connect the WebThings gateway to an external app. The communication between the gateway and the ESP is pretty much sorted using the ESPHome addon.

Does anyone know how I could manage this? Workarounds are also welcome!

These 2 suggestions are definately work-around hacks that I’ve implemented in my home to control a legacy X10 CM15 controller and X10 devices using Mochad.

  1. Run Program addon. This program does as you may expect and runs a program. In my WT, it communicates to the mochad process to turn X10 lights on/off. I was never able to figure out how to create a single thing that executed run program that could determine if it was an on or off event so I needed to create 2 things, one for on and one for off events. You get the idea though.

  2. You can remotely use cURL (for example) to trigger thing property changes. I wrote a program to monitor the output of X10 Mochad controller for events, and when detected, it sends cURL commands to WT to alter property values e.g.: on/off.

I’ve also used the Virtual Thing addon to create virtual buttons associated to rules. These virtual buttons are triggered by X10 button presses or when you click them on the WT gui…

Ideally, there probably is a better addon or API that you could model after that someone may suggest…

I wrote an X10 Mochad addon that took numerous months to replace option 1 above. It took me repeated attempts to educate myself though. If your fluent in node, JS interprocess communication, and know Web Things design then you may have an easier time. I started by doing a “git clone” of Run Program (ability to exec programs) and X10 CM11 (web thing examples) and merged them together. After extensive learning and rewriting them it seems to work…

I’m not sure what it is you want the app to do, but I think the short answer is yes, an app can communicate with the WebThings Gateway via its API, no add-on is required.

The API is documented here, and you can use OAuth to authenticate your app with a gateway.

What kind of data are you wanting to send to a device? The gateway doesn’t have a service for storing arbitrary data like Firebase, but you can set properties of devices via the Web Thing API for example.