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.


Monday, 24 June 2019

Sintron IOT - How to embed Smart Plug & Smart Device into website pages


Below is one example to show you how to embed the Sintron Smart Device to your webpage. you can click and see how it reacts. this would require you to have some basic HTML skills, and put the javascript in. the html and javascript as below:

Sintron Smart Plug / Outlet Website embeded Click the button to trigger the light from Sintron Smart Plug.

below is a video to show how it works:

Download HTML Sample

please remember to change the turn on and turn off command to be yours:

  function officelighton(){
        var url = ""


  function officelightoff(){
        var url = ""

then copy & paste the code to your website ( in between <body> of html ). then it should work.


Wednesday, 5 June 2019

How to use iPhone Siri Home Kit with Sintron Device. ( ST-027 Plug & ST-029 Wall switch ) -- with raspberry Pi

difficulty level: Medium

note: Sintron Device Has the version without Logo on product itself. so it's good for developer to build and sell to customers.

video for demo here:

Most of Plugs can support Amazon Alexa and Google Home. but almost non of them still can't support iPhone Siri Home Kit yet. ( June 2019 )

Sintron Device : for example ( ST-027 Plug & ST-029 Wall switch ) do have the ability to be embedded this function for iPhone Users.

this is also a good information for you to help your customer or family to build safe Smart Home. only need to use HomeKit app built-in the iOS, and combine all things there. no need to use multiple apps.

easy and quick to control.

if needed, you can also contact us to support you and customize what you need. we hope to work with you to build your customer's smart home too.



1. Sintron Device ( ST-027 Plug & ST-029 Wall switch Series ) of course.
2. Raspberry Pi board.

1. some basic linux command experience.

Theory before we start: Sintron Device doesn't not connect to iOS device directly, so that we need to use a hub ( raspberry pi in this case ) and help us to communicate between Sintron Device and iOS. so first we will install "homebridge" software and also plugin to raspberry pi. then also use the app Sintron provided. then they will combine together.

this article would assume you are familiar with linux/raspberry pi and command line.
if you are not familiar with this, you can also purchase SD card with pre-installed system directly. then you can skip All Steps below.

buy here.( will update the link soon )

you can also download our pre-installed system and flash it to SD card directly. then you can skip Step 1 ~ Step 5.

download system file ( will update the link soon )

and of course if you would like to do it from scratch, please check below :

Step 1: turn on the Raspberry Pi with raspbian system. you can check the installation guide from official raspberry pi

*connect the ethernet cable or get wifi connected first.
* use SSH to connect to raspberry pi, so that you can copy command & paste directly. How to SSH to server from
*log in and Open terminal  ( if you are using GUI Desktop.)
*then you will see :

Step 2. install necessary software 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

these might take some minutes.

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

$ sudo npm cache clean -f

$ sudo npm install -g n

$ sudo n stable

$ sudo reboot

(ps. you can check "npm -v" and "node -v" to check the version of the npm and nodejs )

Step 4. Install the "Homebridge" and Plugin:

$ sudo apt-get install libavahi-compat-libdnssd-dev

$ sudo npm install -g --unsafe-perm homebridge

$ sudo npm install -g homebridge-http-switch

$ sudo npm install pm2 -g

Step 5. try to run "homebridge" for the first time

$ homebridge

you will see QR code ( don't do anything first ) :

ok, so far so good. let's terminate this app first by :       "control" + "c"

Step 4. Download Sintron nodejs app:

$ wget

(a little bit too long for a blog, don't miss the last letter "p" )

$ unzip

Step 5. All prepared !  Let's get them running !!

run sintron app:

$ pm2 start sintron_homebridge_server/sintron_homebridge_server.js

it would show:

Step 6. Prepare config.json file for homebridge.

before we run homebridge, we need to add a config.json file to system.

choose the example that suits the quantity you have. for example, if you have 2 pcs of Sintron Device, you can download the " 2 device config.json" 

then open it with  "plain text" editor.

REALLY IMPORTANT: You must use a "plain text" editor to create or modify config.json. Do NOT use apps like TextEdit on Mac or Wordpad on Windows. Apps like these will corrupt the formatting of the file in hard-to-debug ways. free Atom text editor is recommended.


the example you downloaded would look like this format.


  "bridge": {
    "name": "Sintron Device",
    "username": "AE:72:E6:5D:1D:83",
    "port": 51826,
    "pin": "897-23-872"

  "accessories": [
      "accessory": "HTTP-SWITCH",
      "name": "fan",

      "onUrl": {
        "url": "http://localhost:4000/?host=google&username=sintron&auth=81aa151057ed4cd1ba76bb6d54483092&led=D13&pin=D14&action=on"
      "offUrl": "http://localhost:4000/?host=google&username=sintron&auth=81aa151057ed4cd1ba76bb6d54483092&led=D13&pin=D14&action=off",

      "statusUrl": {
        "url": "http://localhost:3000/?host=google&username=sintron&auth=81aa151057ed4cd1ba76bb6d54483092&led=D13&pin=D14&action=off",
        "method": "GET"

      "pullInterval": 50000,

      "debug": true




please replace the "onUrl" , "offUrl" and "statusUrl" for your own Sintron device.
( this is using one device as an example, for multi quantity, please change the "onUrl" , "offUrl", "statusUrl" one by one )

for example, if your Sintron Device turn on command is:

then you change it to : localhost:4000


and then put it back to "onUrl", 

the same to "offUrl"

if your Sintron device turn off command is:

-->then you change it to : localhost:4000


put it back to "offUrl" too.

and for statusUrl. you can change onUrl from : localhost:4000 to localhost:3000. 


--> change it to:


put it back to "statusUrl"

now we have the config.json customized with your Sintron device.


let's put it into system:

$ nano ~/.homebridge/config.json

then paste the config.json you just customized and "ctrl" + "O"  to save it.

Step 7. Get homebridge running. ( finally ! )

$ nohup homebridge >homebridge-sintron.out &

running it in background

$ cat homebridge-sintron.out

then you would see QR code again, it's running now !

1) make sure your iOS device connect to the same router as the raspberry pi.

Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

then you should be able to see the device show up in your HomeKit app, and you can control it now !

video for how to scan and control here:



1) Home app shows i can't add duplicate device.
it's possible you already scanned before, so there's a record.
try to clear the record and run again:

$ sudo rm -r ~/.homebridge/persist/  

2) after some periods it doesn't work anymore.

try to restart it, and launch the apps again:

$ pm2 start sintron_homebridge_server/sintron_homebridge_server.js

$ nohup homebridge >homebridge-sintron.out &


for any questions, you can comment below or send email to :



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...