My Blog‎ > ‎

A secured gateway to home-brewed HA

posted Aug 8, 2017, 3:41 PM by Pratik Panchal   [ updated Aug 8, 2017, 3:52 PM ]
Welcome to the latest article of bowl-of-IOT. Exciting developments since last time. 

IOT is still in early stages. And the ONE thing that I despise is the security. There are no industry standards that promises the security of that home-brewed smart device connected to the world, sitting in your living room. 

Although there are workarounds. And I'm sure, we'll have a good solution soon. 

But meanwhile, here is the Particle Photon - tadaaaa! 

The Web API calls to this board is secured and based on the 32 bit keys unique to your account. And your account is protected. Pretty secured for my needs.
On the other side of the router, when I look at my internal 192.168.x.x network; things are pretty unsecured. 

That's where the arduino-like code for particle photon comes into play. The ease with which the Particle board can talk with the internal devices is totally worth the workaround:

    // Make request to ESP board
    sprintf(publishString,"IP: %d.%d.%d.%d",ESP_SERVER_IP[0],ESP_SERVER_IP[1],ESP_SERVER_IP[2],ESP_SERVER_IP[3]);
    Particle.publish("Attempting connection to server",publishString); //+ESP_SERVER_IP[1]+"."+ESP_SERVER_IP[2]+"."+ESP_SERVER_IP[3]));
    
    while (!client.connect(ESP_SERVER_IP, ESP_SERVER_TCP_PORT) && (connectRetries++ <= MAX_CONNECT_RETRIES)) {
        delay(500);
    }

And Voila!!
Suddenly I can make secured web based calls to control my internal unsecured ESP boards. Not only that, devices like Google Home and Amazon Alexa can now control bunch of my internal devices via IFTTT (another service I'm in love with). 


A block diagram of how everything is put together:
Block diagram - secured gateway to my HA


The little ESP end-node running the home-brewed unsecured web server to control the GPIOs.
Note the wires - they are going to the actual solid state relays (again home-made :) )
The ESP end-node


And the shiny new Google Home to control one, and all!

Comments