CATALOG

1. Analysis of scenario pain points and needs

Let’s talk about the actual scene at the hospital guidance desk first – nurses are asked hundreds of times a day, "How to get to Department XX" and "Which floor is the blood draw on?", and their throats are about to smoke. Especially during peak hours, there is a circle of people in front of the consultation desk, and the nurse has to shout at the top of her voice repeatedly, which is tiring and easy to mishear.

At this time, if a voice speaker can be used to automatically broadcast guidance information, such as "Please go to the blood drawing room on the second floor," or "Please turn left to the pediatric clinic," it will not only free up manpower, but also improve patient experience.

This 40W wall-mounted voice broadcast speaker from Thingboot can solve this problem. The power of 40W is enough to cover open areas such as halls and corridors, and the sound is clear and not harsh.. The key isOpen HTTP interfaceYes, that is to say, you can completely control it with the code you write..

Now I will talk about how to connect it to your project from a practical perspective.

2. Preparation: What you need to get

Before you start writing code, you must first complete a few preparations:

1. Get the device ID

Each speaker has a unique device ID when it leaves the factory, which is usually found on the label attached to the device casing or can be seen by logging into the Thingboot IoT console.. This ID is the person you want to "call", there can be no mistake.

2. Get the API key (AppID and AppSecret)

Log in to the Thingboot Open Platform and create your application. The system will assign a pair of keys:

  • AppID: Equivalent to your application ID number

  • AppSecret: Equivalent to your application password,Don’t leak it to the front end

3. Connect the speaker to the Internet

This 40W speaker supports both wired and WiFi networking methods. The hospital environment uses a wired network version, so the signal is more stable. After connecting to the Internet, the speaker will actively establish a long-term connection with the cloud and maintain a "standby" state.

4. Confirm that your project can send HTTP requests

No matter you are using Java, Python, PHP, or front-end JavaScript/WeChat applet, as long as you can send HTTP requests, you can adjust this interface. The threshold is very low and there is almost no learning cost.

3. Core interface: How to make the speaker "speak"

Thingboot provides a standard HTTP interface, and the core request address looks like this

https://api.thingboot.com/{Your AppID}/device/control/?sign={Signature}&ts={Timestamp}

Signature algorithm (a little convoluted, but you can reuse it once you write it right)

The signature is used to prevent others from calling your device at will. The algorithm is:

sign = MD5( MD5(AppSecret) + ts )

Step by step disassembly:

  1. First perform MD5 encryption on your AppSecret to get a 32-bit string

  2. Splice the result of the previous step with the current timestamp (for example1734567890)

  3. Do MD5 again on the entire concatenated string.

For example, suppose AppSecret isabc123, the timestamp is1734567890The first step: MD5(abc123) =202cb962ac59075b964b07152d234b70Step 2: Splicing to get202cb962ac59075b964b07152d234b701734567890Step 3: MD5 again to get the final sign

The timestamp ts must also be included in the URL as a parameter to facilitate the server to verify the timeliness (generally valid within 5 minutes).

Issue a broadcast command (let the speaker speak)

The request method uses POST, and the parameters can be placed in the body. It is recommended to use JSON format.

Here'splay:gbk:16It is a broadcast command, and the following string is what you want the speaker to say. It supports Chinese, numbers, and English, and it will automatically read aloud in natural voice, not a mechanical robot voice..

Other useful commands (not just broadcasting)

In addition to broadcasting, this speaker also supports some auxiliary control commands

OrdereffectExample
volumeAdjust volume (0-100){"volume":80}
speedAdjust speaking speed{"speed":50}
voiceSwitch tone (male and female voices){"voice":1}
stopStop current broadcast{"stop":1}

For example, if you want to turn down the volume at noon, just send it{"volume":30}That’s it.

4. Practical docking: how to write code in different scenarios

Scenario 1: Java backend call (suitable for traditional web systems)

Many hospital HIS systems are written in Java and are easy to integrate. You can do it with OkHttp or Unirest

Scenario 2: WeChat mini program call (suitable for hospital public accounts/mini programs)

If your hospital has its own mini program, the patient’s medical treatment instructions will be pushed directly to the speaker after registration, and the experience will be very good.. butNote: The signature must be calculated on the backend and the AppSecret cannot be exposed on the frontend.

The correct approach is: the applet calls your own back-end interface, the back-end calculates the signature and then adjusts the core step interface.

Scenario 3: Python quick script (suitable for testing or light integration)

If you want to verify quickly, you can do it with a few lines of code in Python:

5. The complete business process of the guidance desk scenario

Putting the above technical points together, a complete voice guidance process at the guidance desk should be as follows:

  1. Patient registration/check-in: The patient completes registration at the self-service machine or window, and the system generates a medical record

  2. Trigger broadcast: Your back-end business logic judgment - for example, the patient's check-in is successful, or the call system's turn is

  3. Call interface: The backend calculates the signature, initiates a request to Thingboot API, and lets the speaker broadcast "Please XX to XX department"

  4. Speaker response: The speaker receives the command, synthesizes the voice in real time and broadcasts it.

  5. (Optional) Receive receipt: If you need to confirm whether the patient has heard it, you can subscribe to Thingboot’s message push to know whether the device has been successfully executed.

After actual testing, the delay from calling the interface to the sound coming from the speaker is about80-120 milliseconds, basically no feeling of waiting.

6. Several pitfalls (real experience)

1. Network planning is important

Hospital intranets are usually relatively closed. If the speaker uses WiFi, make sure the network between it and your server is smooth. preferredCable network version, connected to the hospital’s intranet switch, much more stable.

2. Send asynchronous messages to confirm the broadcast status

The return of 200 from the HTTP interface only means that the cloud platform has received the instruction, but it does not mean that the speaker is actually playing - what if the speaker goes offline? If you need to confirm the broadcast results, you can configurePush message, the device will actively notify your server whether it succeeds or fails..

3. Consider the problem of polyphonic characters in advance

Some medical terms may be ambiguous, such as "stroke," and the speaker may pronounce it "zú zhōng" instead of "cù zhòng." The solution is: replace it with homophones in the text, or add phonetic pronunciation at the end, such as "brain stroke (promoting bell)".

4. Support privatized deployment and make data more secure

If the hospital is particularly sensitive to data security and does not allow data to leave the intranet, Thingboot also supportsPrivate deployment——You deploy the message server in your own computer room, the speakers are only connected to the intranet, and all data is not stored in the hospital area..

5. Can control multiple devices at one time

If you install multiple speakers in a hall, you can use commas to separate multiple device IDs in the device parameter. One command allows all speakers to broadcast at the same time.. However, a maximum of 100 units at a time is generally sufficient.

7. Summary

Connect Thingboot's 40W wall-mounted voice broadcast speaker to the hospital guidance system, which is essentiallyCalling an HTTP interface——Get the device ID, calculate the signature, and send a POST request.

However, in order to implement a complete "diagnostic voice guidance" function, it is also necessary to consider details such as the triggering logic of broadcast timing, multi-phonetic word processing, network stability, and whether to receive device receipts.

Officially provides complete interface documentation and technical support, if you encounter problems during the docking process, you can contact their engineers directly. It is said that they will provide full guidance from selection to debugging..