CATALOG

Equipment room lighting control seems simple, but through Thingboot's open interface, it can be very elegantly integrated into existing software projects. The following is a practical solution, I hope it can help you implement it quickly.

1. Why did we choose this hardware?

In the computer room, we often need to remotely restart the server and check the status of the equipment, but lighting is often ignored. Traditional computer room lighting is either an ordinary panel, which is always on when people are walking around, wasting electricity; or it is sound and light control, but it is not easy to use in a computer room with buzzing servers.

Our goal is to bring "machine room lighting" into software control. Whether it is an energy-saving strategy (automatically turning off the lights when no one is around) or a linked alarm (remotely turning on the lights when a fault occurs to facilitate maintenance), the hardware needs to be connected to the Internet first.

In terms of model selection, Thingboot’s"Smart touch wall switch (1 way)"Very suitable for this scene

  • 1 way control: Just control a certain group of light strips or main lighting in the computer room, no more, no less.

  • No gateway required: Directly connected to WiFi 2.4G. The computer room already has signals, so there is no need to buy an additional gateway, saving trouble and money.

  • direct replacement: Standard 86 panel, just remove the original switch, connect two wires, and tighten the screws to fix it. The electrician can do it in a few minutes.

2. Preparation: Get the "ID Card" of the device

To integrate the switch into your software project, whether it is a Java backend, Python script, or Node.js, you need to get two things first:

  1. Device ID: After the switch is installed, you can see a series of numbers in the backend of Thingboot, such as820720. This string of numbers is the unique ID card of this lamp. When your software sends a command, you must specify who it is sent to.

  2. AppID and development password (App Secret): If your software project wants to connect to Thingboot's cloud platform, you need to log in to the backend to create an "application", and the system will assign you an ID and key.. This is equivalent to your login credentials for your software.

a little trick: There are many equipments in the computer room, so the naming of equipment should be standardized. For example, directly note "South Area-Cabinet A-Lighting" to avoid confusion of multiple devices in the future.

3. Core steps: How does the software issue commands?

The core of this plan isHTTP interface. To put it bluntly, your software does not need to care about the underlying complex wireless protocols. It only needs to make a request to Thingboot's cloud like you usually access web links..

Specifically, we need to do aHTTP POSTask.

1. Request address (URL)

http(s)://api.thingboot.com/{Your AppId}/device/control/?sign={Signature}&ts={Timestamp}

There are two parameters here:

  • ts: Current timestamp. In order to prevent others from forging requests, the interface comes with a time verification.

  • sign:sign. This is to ensure security. The "development password" and "timestamp" are mixed together and encrypted..

2. Request body (Body)

This is the specific action you want to perform. For our 1-way switch, the code is as follows:

explainpower1It represents the No. 1 switch on this wall.1Represents "on", if filled in0It's "off".

4. Practical code demonstration (taking Node.js as an example)

Suppose we want to write a scheduled task to automatically turn off the lights in the computer room after get off work.

Just run this script and your software will turn off the lights in the computer room. In the same way, putpower1Change to1Just turn on the light.

5. Advanced gameplay: Make lighting smarter

With basic switching capabilities, we can do some tricks to make computer room management cooler:

1. Moving ring linkage alarm

When your dynamic environment monitoring system detects that the temperature in the computer room is too high or there is water leakage,Automatically trigger lights onAnd push a message to the operation and maintenance: "In case of emergency, the lights have been turned on automatically, please check immediately." With bright light, it is convenient and safe for maintenance personnel to enter and operate.

2. Infrared/human body induction linkage

If you find it troublesome to turn the lights on and off manually, you can connect an infrared sensor. The logic is: the sensor detects someone -> your backend receives the event -> the backend sends a command to the switch ->"Turn on the lights". The person leaves and the delay is 5 minutes ->"Turn off the lights". In this way, the computer room truly realizes "the lights turn on when people come and turn off when people leave".

3. Power-on default status setting

The computer room occasionally loses power. This switch supports setting the state after power outage recovery. Set to "Keep lights off after power outage is restored". Otherwise, when the power is restored in the middle of the night, the computer room lights suddenly turn on, which may scare people and mistakenly think that someone has entered, which will also waste electricity.

4. Status feedback and recording

Record the switch status into the database. When making reports for operation and maintenance at the end of the month, pull up the data and take a look: "Someone entered the computer room at 3 o'clock in the morning this week?" - The audit log can help you trace the operation records.

6. Common pitfalls and pit avoidance guide

  1. Intranet or external network?Thingboot's interface can be used on the public network and also supports privatized deployment of local area networks.. If your software server is inside the computer room, deploy a privatized version and transmit commands through the intranet, with lower latency (80-120ms) and not occupying the company's public network bandwidth..

  2. What should I do if my device is offline?WiFi devices occasionally drop out. interface returncode 200It only means that the command was sent, not that the device executed it.. If you need to confirm whether the light is on, you need to enable cloud message push, subscribe to device status change events, or poll to query the device status.

  3. Wiring safetyThe power boxes in the computer room are all 380V or 220V. The modified switch must be powered off! This switch is usually connected toL (FireWire)L1 (live wire out/light control wire)andN (zero line). If there is no neutral line, you need to confirm it before buying the corresponding version. This must be paid attention to.

Connecting a light in the equipment room to the software may seem like a trivial matter, but it is the "stepping stone" to the intelligent transformation of the entire computer room. Through Thingboot's open and standard HTTP interface, not only 1-way switch, but also 4-way and 8-way controllers can be expanded in the future. The code logic is basically the same and only needs to be changed.deviceandpowerParameters are enough.