1. Scenario pain points and solution ideas
Let’s first talk about why we do this. Nowadays, many scenes are becoming "unmanned" - parking lots, charging stations, shared conference rooms, self-service gyms, smart construction sites... People are not present, but reminders are still necessary.
For example: when the charging pile is full, the car owner needs to be reminded to move the car, when the shared conference room is reached, people are urged to leave, and when someone breaks into a dangerous area of the construction site, the police need to be called - do these problems rely on App push? If the user doesn’t look at the app, it’s useless. By text message? The cost is high and you have to wait.
The most direct and effective solution is to let the sound column on the scene speak for itself.
Thingboot's 60W smart voice column is, to put it bluntly, a large speaker connected to the Internet. It is waterproof and dustproof, and is suitable for outdoor and industrial scenes. You just need to give it an HTTP request and it will convert the text into speech and play it out. The core idea is just one sentence:Your business system triggers events → calls the Thingboot open interface → live broadcast of the sound column.
2. Preparation: Get three things
Before you get started, prepare these things:
hardware itself: 60W smart voice column, connect it to the Internet (supports WiFi 2.4G or wired Ethernet)
AppID and AppSecret: Log in to the Thingboot console and find it in "Development Settings"
Device ID: In the device list of the console, or directly look at the label on the speaker casing
With these three things in place, you can start adjusting the interface.
3. Core integration: How to make the sound column "open"
3.1 Basic interface process
This set of interfaces of Thingboot uses the standard HTTP protocol. As long as your system can send HTTP requests, you can use it, regardless of the language - Java, Python, PHP, Go, Node.js will all work..
The core request address looks like this:
POST http(s)://api.thingboot.com/{your AppID}/device/control/?sign={signature}&ts={timestamp}There are two things that need to be calculated dynamically:
ts:Current Unix timestamp (seconds)
sign: Signature, the algorithm is
md5(md5(AppSecret) + ts)
3.2 The simplest broadcast command
If you want the sound column to speak, please bring it in the Bodydevice(device ID) andorder(command) will do:
Here's"play:gbk:16"It means: play with GBK encoding, volume 16 (maximum 9? The example in the document here is 16, the actual volume range is generally 0-9, please refer to the product manual)
3.3 Code examples in each language
PHP version
Python version
3.4 Batch control of multiple devices
If you have multiple sound columns in a venue (for example, a large parking lot is divided into ABCD areas), you can issue commands to multiple speakers at one time:
Supports up to 100 units at a time.
4. Advanced gameplay: not just "talking"
It's not enough to be able to speak. In real projects, these control abilities must be matched:
4.1 Adjust volume and change tone
Supports switching between male and female voices, and the intonation and speaking speed can be adjusted.
4.2 Stop broadcasting/interrupt
If you need to interrupt the broadcast midway, send a stop command:
4.3 Add a prompt tone before speaking
It is suitable for scenes such as cashier announcements and doorbell reminders. Make a "ding dong" sound before speaking:
Built-in 5 kinds of ringtones, 5 kinds of prompt sounds, 5 kinds of warning sounds.
5. High availability advancement: Don’t let your broadcast be "lost"
5.1 Synchronous vs Asynchronous
To put it simply: HTTP request returns 200, which only means that Thingboot’s platform has received your instruction.It doesn't mean that the sound column is actually broadcast.——What if the sound column is disconnected?
So if you need to confirm that "it has been broadcast", there are two options:
Option A (simple): No confirmation——Suitable for unimportant reminders, it doesn’t matter whether they are played or not.
Solution B (reliable): receive asynchronous push——Let the Thingboot platform send you a message notification after the device is successfully executed. You need to configure a URL for receiving messages in the console.
5.2 Check that the device is online before issuing
If the requirements are relatively high, you can check the device status first and then send it online:
POST /device/status/?sign={sign}&ts={ts}
{"device": "Device ID"}When the device is online and then issues commands, you feel more confident.
5.3 Traceability with business ID
If you are worried that the logs are not correct, you canorderRigaextraFields:
thisextraIt will be returned as is in the asynchronous push, making it easier for you to associate the business order number..
6. Examples of actual implementation scenarios
The first scenario: unattended charging pile
Trigger: Vehicle is detected as fully charged
Action: Call the interface → The sound column plays "Owners of Beijing A12345, your vehicle is fully charged, please drive away in time to avoid space occupation fees"
Advanced: If you haven’t left after 20 minutes, play it again, with the volume increased.
Second scenario: Shared conference room/study room
Trigger: 5 minutes before the end of the appointment
Action: Announce "The current conference room will be closed in 5 minutes, please pack your belongings"
End time: Announce "The time has expired, the door lock will be closed soon"
The third scenario: construction site/warehouse dangerous area
Trigger: Infrared sensor detects an intruder
Action: Immediately broadcast "Attention, you have entered the dangerous area, please leave immediately" (add warning sound)
Synchronously push the administrator App
Scene 4: Smart parking lot exit
Trigger: Scan code to pay successfully
Action: Announce "Payment successful, please walk slowly" and give the gate opening signal at the same time
7. A little reminder
The interface call is not completed instantly, and the network delay of 50-200ms is normal. If you need voice to be strictly synchronized with a certain action (such as saying "Welcome" when opening the door), send the command 200-300ms in advance, or make it into serial logic - wait for the callback to be successful before executing the action.
In addition, the 60W sound column is suitable for outdoor/industrial scenes. If it is used indoors, don’t turn the volume too high. Level 9 is enough to stun people..
Finally, summarize: To put it bluntly, integration is a three-step process—get the AppID and device ID, calculate the signature, and send an HTTP request. The complexity lies in when to broadcast, what to broadcast, and how to ensure that it is broadcast. These need to be designed based on your business scenario. The interface design of Thingboot is relatively clean and the documentation is clear. You should be able to run through the demo in half a day.