This is an article about the solution of integrating Thingboot 8-channel remote AC and DC output controller into the computer room equipment control system. I will try my best to write in a more technical and practical way, with a "teaching you step by step" tone, but not too boring like a textbook.
1. Why does the computer room need it? Let’s talk about the pain points first
Friends who have done computer room operation and maintenance all know that they are most afraid of being woken up by a phone call in the middle of the night saying "the business is down." In many cases, it is not actually the server that crashes, but that a certain switch crashes, the industrial computer is stuck, or a certain cooling fan stops spinning.
What is the traditional solution?Take a taxi to the computer room, unplug it, and plug it in again.Just to press the reset button, I have to go back and forth for an hour or two, and I still have to travel and spend time.
If there is a system that can make yourThe server directly sends the command "Turn off the power of this device and then on again" through the API., isn’t it great?
This is what we are going to talk about today -Thingboot 8-channel remote AC and DC output controller.
To put it bluntly, this device is a "networked, 8-way independently controllable smart strip/switch". it supportsAC and DC, which means that you can not only control ordinary 220V AC (servers, switches), but also control DC 12V/24V equipment (access locks, sensor power supplies, LED indicators). Most importantly, it providesOpen HTTP API interface, you can "glue" it directly into your own existing operation and maintenance system.
2. Preparation: What to do first after getting the equipment?
Before writing code, pave the hardware "road" first.
Physical wiring: This step is very simple. Connect the 12V power supply to the controller and connect it to the Wi-Fi in your computer room (it supports 2.4G).
Register and add: Go to the Thingboot official website to register an account, and add the device to your workbench in the "Internet of Things Console".
Get key: This is the most important! In the "Development Settings" of the console, find yourAppIDandAppSecret. This is equivalent to the "account password" of your system, which must be brought when calling the interface..
a little tip: If the computer room is too big and the Wi-Fi signal is not good, you can consider using a wired gateway or placing the device in a location with a better signal. After all, the premise of remote control is "online".
3. Core integration: How to "stuff" it into your project?
This is the highlight of today. No matter whether your backend is written in Python, Java, PHP or Go, as long as it can make HTTP requests, it will work.
1. Understand its "secret code" (signature mechanism)
Thingboot's interface pays more attention to security, so it has a signature (Sign) mechanism. It looks complicated, but the logic is actually very simple, just three steps:
first step: put your
AppSecretPerform an MD5 encryption.Step 2: Add the encrypted result to the currentTimestamp (ts).
Step 3: MD5 the put together thing again.
The benefits of doing this: Even if someone catches your network packet, they can't calculate the correct Sign without the original Secret, so the security is relatively high.
2. Control code actual combat (pseudocode logic)
Suppose we want to controlRoute 1Interface restart a router (power1set to0Yes,1is on).
interface addresshttps://api.thingboot.com/{your AppID}/device/control/?sign={calculated signature}&ts={current timestamp}
RequestBody(JSON)
If you want to write a function in Python, it might look like this
If you are using PHP, the principle is the same, that isSignature calculation + POST datathese two steps.
3. Advanced gameplay: batch control
If you want to control 8 channels to restart at the same time, you don't need to send 8 requests, it is too slow.Use directlybatchOrder:
If your device has a "break before make" reset logic, there is also a dedicatedresetcommand, you can set the interval in milliseconds, which is very suitable for cold restarting the server..
4. The first actual scenario: automatic repair of server faults
This is the most commonly used scenario in the computer room.
Integrated logicIn your monitoring system (Zabbix, Prometheus or self-developed inspection script), add a "self-healing" trigger.
For example: Ping gateway fails -> fails 3 times in a row -> the device is determined to be suspended.perform action
Call the above
rebootMethod, close the corresponding interface.Wait 10 seconds (to let the capacitor discharge).
Restart the interface.
value: Change operation and maintenance from "7x24 hours on call" to "process work orders during the day", and shorten the fault recovery time from 1 hour to 1 minute.
5. The second actual scenario: multi-device linkage and temperature control
If your computer room has relatively high environmental requirements, for example, there are old equipment that are afraid of heat, or you need to open the door remotely.
Integrated logicLink this 8-way controller with the temperature and humidity sensor in your computer room.
Trigger condition: The temperature sensor reports > 35°C.
perform action: The controller automatically turns on the power supply of No. 8 (external industrial exhaust fan).
Trigger condition: The temperature returns to normal.
perform action: Cut off the 8th power supply.
This is not just "remote control", this is true "automated control". At the API level, your program is just a simple conditional judgment:if temp > 35: requests.post(…, {"power8": 1})
6. Several pit avoidance guides
During the integration process, you can pay a little attention to these points:
Do not exceed the load limit: A single channel supports a maximum resistive load of 2200W.If it is an inductive load such as a motor or LED light, the starting current is very large and the power must be discounted (within 350W). There is no problem in connecting to the server. An intermediate relay is required to connect to the outdoor unit of the air conditioner.
Asynchronous processing: The interface returning 200 only means "the command platform has received it", but does not mean "the device has acted". If the device happens to be disconnected from the Internet, the command will be invalid.Rigorous approach: After calling the interface, check the device status again, or enable the platform's message push to confirm the execution result..
LAN control: If you don’t want data to go through the external network, Thingboot’s solution actually supportsPrivate deploymentand LAN controlled. In a LAN environment, HTTP commands can be sent directly locally without going through the cloud platform, resulting in lower latency and more suitable for production environments that are sensitive to data security.
DC scenario: If you are controlling DC equipment (such as 12V electromagnetic locks, LED light strips), remember to selectDC voltage versioncontroller, don’t buy the AC version.
7. Summary
In general, the technical threshold for integrating Thingboot's 8-channel controller into a computer room project is actually not high. The core is to get the two keys (AppID/Secret) and splice an HTTP request to the API document.
It is equivalent to giving your server program a pair of "hands", so that the code no longer just operates data, but can directly operate the power switch of the physical world. Whether it is used to automatically restart a crashed industrial computer or to regularly switch on and off lighting and heat dissipation in a computer room, it is a cost-effective choice.