Hello everyone, today let’s talk about something practical. Recently, many friends who are engaged in intelligent transformation have asked me: "Thingboot's 8-channel controller looks very powerful, but how do I connect it to my existing sensors or my own server to make it move on its own?"
Don’t worry, this solution is specifically designed to solve this problem. Let’s not deal with those empty theories, let’s just talk about people’s words and talk about practical things.
1. What exactly is this "8-way artifact" in our hands?
First of all, the "8-channel remote control device linkage module" you got (officially calledIntelligent universal controller | 8 channels, model: UNI-KZQ-TY-8), you can understand it as aSmart power strip with 8 switches, but these 8 switches are separate and hidden in the box.
What can it do?It can handle lights, motors, electromagnetic locks, water pumps...as long as it is an AC or DC load. If it is a high-power device, add an AC contactor in the middle, and it can also drive it..
How does it connect to the Internet?Going isWiFi 2.4G, this has a big advantage——No need to buy additional gateway, you can use the router at home/store to play with it.
What does it open?That's the point, it's all over youHTTP API interface. As long as you can make HTTP requests, you can command it whether it is Java, Python, PHP, or even Excel VBA..
2. Core gameplay: Opening up the "Ren and Governor's two channels" (interface docking)
To achieve linkage, you actually need to let the "sensor" or "your business system" tell the 8-way controller which way to open. The communication protocol usesHTTP, simple and direct.
Here is a small detail: Thingboot’s interface isFree foreverYes, you don’t have to worry about charging for the number of calls..
1. Preparation work (like cutting vegetables before putting them in the pot)
You have to go to Thingboot’s official website console first and write down these things:
AppID: Equivalent to your account ID.
AppSecret: Equivalent to your password (don’t reveal it).
Device ID: It is the ID card of the 8-channel controller in your hand (usually affixed to the device case, or can be seen in the background after the network is configured).
2. Encrypted signature (to prevent villain tricks)
For the sake of security, the Thingboot interface needs to bring a dynamic one when requestingsign(sign). This algorithm is a bit convoluted, but it’s very simple once you understand it:
Step 1: Put yours first
AppSecretDo an MD5 encryption and get a 32-bit string.Step 2: Concatenate the string obtained above with the currenttimestamp(ts).
Step 3: Take this long string and encrypt it again with MD5.
In human words:
sign = md5( md5(AppSecret) + ts )
put thissignandtsAfter the URL, the platform will know "Oh, this is a legal instruction".
3. Get started directly: How to write control code? (Put the elephant in the refrigerator)
Our goal is to makeRoute 1Connected.
Request address
https://api.thingboot.com/{your AppID}/device/control/?sign={calculated signature}&ts={current timestamp}Request method:POST
Data content(Body)
Effect
{"power1": 1}= The first path is closed (open){"power1": 0}= The first path is disconnected (off)
If you want to operate several channels at the same time:
It's that simple, send an HTTP request and the light will turn on.
3. Practical drill: Realize "multi-device linkage control" (real cool operation)
Just pressing buttons with your hands is no fun, what we want isautomation. The so-called "linkage" means"If A happens, then B will be executed".
Here are two common ways to do it, depending on which one you like:
Option 1: Use cloud server (suitable for public network/cross-region control)
This is the most standard and flexible method, suitable for you to connect the device to your own mini program, APP or background system.
The process is like this:
Sensor trigger: For example, you connect a light sensor and detect that it is dark.
Data reporting: The sensor sends data to your server (or Thingboot’s cloud platform).
logical judgment: Your server background determines "illumination value < 10 lux".
Issue instructions: Your server, as a client, initiates the above HTTP request to Thingboot's API.
perform action: 8-way controller receives
{"power1": 1}, the corridor light is on.
The advantage of this solution is: Even if you are abroad, as long as you have Internet access, you can control it.
Option 2: LAN/privatization (suitable for factories/showrooms/scenarios with high stability requirements)
If you don’t want to go through the external network, or there is no external network in the factory workshop, you just want the ultimate speed and stability. Thingboot’s equipment isSupport LAN controlof.
How to do it?You connect the server (such as a Raspberry Pi or industrial computer) and the 8-way controller to the same router.Your server directly sends HTTP commands to the device through the intranet IP (the specific IP can be viewed in the background of the router, or obtained after the device is configured).Advantages: 0 delay, can be controlled even if the network is disconnected, data does not leave the factory, safe.
4. A few advanced tips (to help you avoid detours)
When actually working, there are a few details that you must pay attention to, otherwise it is easy to get into trouble:
About the logic of "linkage"
If it is just a simple "light turns on when someone comes and turns off when someone leaves", you can configure it directly in Thingboot's IoT console.Linkage rules, no need to write code.
If it is complex business logic (for example: scan code to pay successfully -> turn on the 5th channel -> time 1 hour -> turn off the 5th channel), then you need to connect to your payment system through API.
About "Batch Control"
What if you have dozens of these 8-way controllers and want to turn them all on with one click? No need to write loops, core steps
deviceParameters support passing multiple IDs, just separate them with commas.device="Device A, Device B, Device C", one request goes down and the whole place is electrified..
About "timing protection"
If you are controlling a motor or air conditioner, cutting off the power directly may damage the equipment. you can use
reset(Break first and then connect) orpoint(First make, then break) command, leaving buffer time for the device.
Summarize
Whether it is difficult or not to connect this thing, the key is three steps:
Distribution network: Connect the device to WiFi.
Get Key: Go to the background and copy down the AppID, Secret and device ID.
send request: Use HTTP POST with signature, facing
power1hair1or0.
After running through this process, all that's left is to use your imagination - whether it'sTime-of-use billing for shared tea rooms、Automatic irrigation of agricultural greenhouses,stillMultimedia linkage of sandbox models, this 8-way module can handle it. Go give it a try, and if you have any questions, feel free to read the official manual, which is more detailed.