CATALOG

This is a technical solution for connecting Thingboot 15W smart voice wall-mounted speakers to the office software system. We use a more colloquial way to talk about the complete process from hardware configuration to code implementation.

Solution: Let the speakers in the office pantry "grow brains"

Keywords:#Thingboot#OpenInterface#VoiceBroadcast#TimingTask#DeviceControl

1. Scenario pain points and solutions

In many companies, HR or administration often encounter this kind of demand: when it is tea time, I want everyone to receive fruits; or when it is almost time to get off work, I want to remind everyone to turn off the air conditioner and lights. The traditional way is to send messages in the group, but there are always people who don't read them.

Our idea is to have the one hanging on the wall of the pantryThingboot 15W smart voice wall-mounted speaker, turning into an IoT device with a "mouth". By docking itopen interface, your OA system, logistics applet or even a simple timing script can let it "speak" when the time comes.

2. Hardware preparation: selection and networking

According to the official manual of Thingboot, this 15W wall-mounted speaker model is usuallyUNI-YY-YX-BG-15W.

  • Connection method: It usesWiFi 2.4GNetworking, no need to buy additional gateway, just plug in the power and you can configure the network.

  • core competencies: it supportsText-to-speech (TTS). That is to say, you don’t need to record in advance, you just need to tell it a text (such as "Milk tea is here"), and it can read it in standard pronunciation.

Operation steps:

  1. Power up the speakers.

  2. Use Thingboot's merchant backend or network distribution app to connect it to the company's WiFi.

  3. write it downDevice ID——This is the "ID card" that controls it, usually a string of numbers.

3. Access logic: How to tell it to "open"?

Thingboot's interface is designed to be relatively friendly. You don't need to go through complicated SDKs. You only need to be able to send HTTP requests..

Basic principlesThat is, your server sends an HTTPS command to the Thingboot cloud platform, and the cloud platform pushes it to the speaker.

  • interface address: http(s)://api.thingboot.com/{your AppID}/device/control/

  • Request method: POST (JSON format recommended)

  • Required parameters

    • device: The device ID you just remembered.

    • order: What do you want it to do? For broadcasting requirements, the usual command format is like this:{"content":"what you want to say"}.

Give an example (pseudocode/command line concept):Suppose you want to remind everyone to hold a meeting at 15:00 in the afternoon. In fact, your server sends the following piece of data to the Thingboot Cloud platform at this time:

The tip here is that if the text is very long or has special symbols, the official documentation mentions wrapping the order into a JSON string, or submitting it directly using the POST form..

4. Practical implementation of software project integration (step by step)

Assuming you already have a backend management system (whether it's Java, Python or PHP), the integration process only takes about 30 minutes.

Step 1: Encapsulate HTTP request toolYou need to write a function in the code that is responsible for issuing instructions. Thingboot's interfaces uniformly use signature (Sign) authentication, mainly to prevent the interface from being swiped by others.

  • Parameter splicing: Sort all parameters (device ID, command content, timestamp Ts) alphabetically, and add AppSecret to calculate the Sign.

  • Make a request: Put the calculated Sign and Ts behind the URL, and add JSON in the Body.

Step Two: Dealing with the "Broadcast" ScenarioIf your company has more than one speaker (for example, one in the large office area and one in the tea room), there are two ways:

  1. Loop call: Get the device ID list of all speakers, write a loop, and issue commands one by one.

  2. Device grouping (recommended): Add these speakers to a group called "whole-floor broadcast" in the Thingboot backstage. and then callGroup control interfacegroup/control.

    • At this time, you don’t need to care about how many devices there are, just face onegroup_idSend a command and the speakers of the entire group will sound.

Step 3: Set up scheduled tasksThis is the solution for "scheduled broadcast".

  • In your backend code (such as Spring Boot's@Scheduledor PythonAPScheduler), write a timing method.

  • Trigger time: For example, setting a cron expression0 30 11 * * *(11:30 p.m. daily).

  • perform action: Call the HTTP request written in the first step and send the text "It's lunch time, please bring your meal cards" to the speaker.

Step 4: Handling asynchronous feedback (advanced)Sometimes after you send a command, how do you know whether the speaker has gone off? Thingboot supportAsynchronous message push.You can configure a public network callback address (Webhook). When the speaker successfully broadcasts or goes offline, the Thingboot Cloud Platform will push a message to this address. In this way, you can see whether the broadcast command is "successful" or "timed out" in the system..

5. Actual application scenario simulation

The first scenario: system linkage warningAssume that the operation and maintenance system monitors that the server CPU is too high. In the past, text messages were sent, but now you can add one to the logic: call the Thingboot interface -> let the pantry speaker broadcast "Operation and maintenance colleagues, please pay attention, the server load is too high, please check the computer room."

The second scenario: waking up after lunch breakThere is no need to buy a separate alarm clock device. Set a scheduled task at 13:30 from Monday to Friday through the software, and the speaker will automatically broadcast: "The lunch break is over, please adjust your status and continue to work hard in the afternoon."

The third scenario: Takeaway/express arrival reminderConnect a button to the access control or visitor system. The front desk clicks on the computer, or the interface is triggered when a visitor rings the doorbell, and the pantry speaker will shout: "There are visitors/takeaways at the front desk, please ask the relevant personnel to collect them." This is more direct than @everyone in the group.

6. Precautions

  1. Network stability: The speaker relies on WiFi. If the company network is frequently disconnected, the experience will be affected. The good news is that this speaker supports setting up to 5 WiFi groups and will automatically switch to the one with the best signal..

  2. text format: If it is numbers or English, convert it to uppercase or Chinese in the code before broadcasting to prevent the speaker from reading it as "loose English" (for example, "15W" may be pronounced as "yiwu", it is best to convert it to "fifteen watts").

  3. executive feedback: The interface returns Code 200, which only means that the command is issued successfully, but does not mean that the speaker is ringing. In rare cases, the speaker may be offline, so if this notification is very important (such as a fire drill), cooperate with the message push mechanism to confirm the device status..

Summarize

Connecting this 15W wall-mounted speaker to the software project actually means"Timing/triggered event" + "HTTP request"process. Thingboot's interface encapsulates complex hardware communications relatively cleanly. For developers, just call the "send voice" interface just like calling an interface for sending text messages.