This blog is to help more developer to make use of Sintron Smart device and help developer's business to grow up

Thursday, 27 June 2019

How to use your own domain to control Sintron Smart Device ( ST-027 ST-029 etc..)

This Instruction shows how you can use your own domain to control the Sintron Smart Device.

if you are a developer or if you want to sell Smart Device to your customers. and you don't want them to find the source and real price. or you just want to make your own Smart Home products. this would be a good instruction for you.

if you only use iPhone Siri with Home Kit. you can check this blog too: How To Control Sintron Device with iPhone Home kit

ok, let's get started.

when you get the Sintron Device ST-027 / ST-029 etc... you will also get a API key ( from QR code )

also you will get the command link, for example :

( in this case, API is 81aa151057ed4cd1ba76bb6d54483092 )

and this article is going to show you how to make the link to be :

Method 1: Sintron already created this server for you, so just point your domain to this ip :

note: you can register a new domain for just a few bucks from etc..

( ps. we might change the ip once after one year, you can send us an email, and let us notify you before we change ip, the next time we change ip would be on  "1st Feb 2020" )

then you can use your own domain to control it.

you can try :

and see if it works:

the benefit of this method is, it's very easy for you to set up. but the downside is, you can only use "http", but can't use "https". if you would like to use https, please check method 2.

Method 2. you can also create your own server. 

Theory: we are going to run a server by node.js ( Sintron Provides the app ) in computer ( we choose linux in this example, you can also run it in windows etc..) , then point the domain to the server. then it would be ok. 

Step 1. you need to have your domain first. ( of course. ) , you can register one from etc..

Step 2. you need a cloud computer with linux system ( windows is also ok, but linux is more stable), you can register it from amazon aws or google cloud platform (GCP)
aws is free for 1 year, and GCP is free for $300. or you can also use your own linux computer.

please google how to create a VM instance, ubuntu 16.04 above is recommended.

Step 3. after you have a VM instance Ubuntu 16.04 or above.

please SSH connect to your VM instance.

and install necessary tools first.

in command line:

do not copy "$", this just shows it's the command.
press y & enter if you see any questions.

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install npm nodejs unzip nginx

these might take some minutes.

Step 4: update npm & nodejs to newer & stable version and then reboot:

$ sudo npm cache clean -f

$ sudo npm install -g n

$ sudo n stable

$ sudo npm install pm2 -g

$ sudo reboot

Step 5.

Sintron already created a node js app for you.

let's download it :

$ sudo git clone

$ cd Sintron-domain-transfer

$ sudo npm install request

Step 6. now that you already have the app, then you just need to deploy it. then it would be ok.

$ pm2 start domain_transfer.js 

ok, now the server is running ! and setup is completed !!

However, in the app, we are using port 8080 to run the server, so we need one more step. yes, we need to open port 8080 from firewall. otherwise firewall would block the connection.

Step 7. allow port 8080 from firewall.

let's use Google cloud platform as an example,

Network - VPC network - Firewall rules - create firewall rules

screenshot as below. and save it.

now it would work ! Congratulations!

you can try :

( note: only http, don't use https for now, we will need to install https certificate later, and remember to put 8080, we will also use nginx to forward the port, so later we don't need to specify 8080 too )

the next 2 steps, we are going to make them even better.

Step 8, forward http 80 port to local 8080 port.

for the webpage, we don't need to put :80 in the end, for example:, because by default browser would think it's port 80.

so we would like the url to become :

by using Nginx.

when receiving request from port 80 ( normal http request ), Nginx would bypass it to our server in 8080. this is how it works.

so we first edit the configuration file.

$ sudo nano /etc/nginx/sites-enabled/default

then put # in front of this line: index index.html index.htm index.nginx-debian.html;

#index index.html index.htm index.nginx-debian.html;

and also add this line :

proxy_pass http://localhost:8080;

then "ctrl O" to save it, "ctrl X" to leave the editor.

$ sudo fuser 80/tcp

just in case some other app might occupy port 80. we kill port 80 first.

$ sudo service nginx start

start the nginx now.

now you can see it is working with :

 sudo service nginx start

horrey !

Final Step .

now we are just missing one part. " HTTPS" for security.

i found this artical is very helpful.

then you will get the URL with HTTPS too now. it's all done !

if you have any questions, please feel free to post a comment below.

or if you would like to own your own server with your own ip, but still doesn't know how to create the server after this instruction. we can also help you to create it, you can contact us too.



Post a comment


Search This Blog

Powered by Blogger.

Blog Archive

Sintron ST-031 Open Source Smart Controller Instruction - how to DIY your smart plug / device

this is the instruction for Sintron ST-031 Smart controller. with this instruction. you will know how to use ST-031 to remote control with y...