CATALOG

This is a solution for connecting with Thingboot smart air conditioner remote control to achieve "mobile phone control + status feedback". I will help you talk about this thoroughly in the order of "overall principle -> interface docking -> status feedback logic -> avoiding pitfalls".

Solution: Mobile air conditioner remote control and status feedback system based on Thingboot open interface

1. Pain point: Why must the "status feedback" be resolved after the air conditioner remote control is connected?

"Status feedback" simply means, is the air conditioner on or off now? Is the temperature 26 degrees or 24 degrees?

The most common pitfall is: the user clicks "Shut Down" on the mobile phone, and the interface shows that the air conditioner is turned off. But due to poor WiFi signal, misaligned infrared, or the air conditioner crashes, the air conditioner is actually still on. As a result, the user thought it was turned off and went on a trip, leaving the air conditioner on for a week.

this isThe command was issued, but the equipment did not execute it..

Thingboot’s open interface clearly states:The API returns 200, which only means that the platform has received the instruction and issued it to the device. It does not mean that the air conditioner has actually been executed.. Therefore, we must have a mechanism to confirm the status.

2. Overall structure: What do you need to prepare?

  1. hardware:ThingbootSmart air conditioner remote control(It’s that little device with an infrared transmitter).

  2. platform: Thingboot Open Platform (obtain AppID and AppSecret).

  3. your mobile phone: Your App or mini-program.

Operation process:Mobile App -> (send commands) -> Thingboot Cloud -> air conditioner remote control (receive commands) -> infrared transmitter -> air conditioner

Status feedback path:Air conditioner (running status) -> Air conditioner remote control (sensing current/power? Or just one-way infrared?)Note: Ordinary infrared remote controls are one-way, and the air conditioner will not tell the remote control "I am off". We need to compensate for this through logic.

3. Specific docking steps

1. Preparation: Get the key

First, get yourAppIDandAppSecret.The signature algorithm is:sign = md5(md5(key) + timestamp). Just encapsulate this in the code, mainly for safety.

2. Core functions: How to control the air conditioner with your mobile phone?

we want to call"Send commands to the device"interface.

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

  • Request method:POST (recommended, longer parameters are better).

  • Key parameters

    • device: The ID of your air conditioner remote control (can be found on the device casing or console).

    • order: This is a JSON string that tells the remote control what infrared code to send.

Example: Java/Python/JS logic pseudocode

3. Key difficulty: How to implement "status feedback"?

As mentioned above, Thingboot's equipment only returns "command has been delivered". In order to get the real air conditioner status, we have three levels of solutions:Use in sequence

Solution A: Rely on the device to proactively report (most recommended)Thingboot’s smart air conditioner remote control actually has a built-inInfrared code libraryandfeedback mechanism.when you send{"power":1}, the remote control emits an infrared code.If your air conditioner is a newer brand on the market (such as Gree, Midea, etc.), the remote control will turn on"Infrared return code"or"Power detection"Function.

  • logic: After the remote control transmits the code, it will monitor whether the air conditioner emits a "beep" reply sound or current fluctuations.

  • docking: You need to subscribe to ThingbootDevice status push(via MQTT or HTTP callback).

  • result: When the air conditioner is actually turned on, the cloud will push you a messagestatus: onlineOr specific temperature data, the mobile interface will then update the check mark.

Plan B: Polling query (a cover-up plan, suitable for old air conditioners without feedback)If your air conditioner is older and does not support status return, then you need to uselogically consistent.

  • Issue instructions: Send a command on the mobile phone, and the interface immediately turns gray or displays "Executing...".

  • delayed feedback:Set a timer (eg 5 seconds). Don't show success immediately.

  • No exception prompt: If no error report is received from the device within 5 seconds (offline), we will default to air conditionerExecuted.

  • Notice: This situation requires a little design on the UI, such as displaying "Signal has been sent" instead of "Air conditioner has responded".

Option C: Virtual mapping + sensor assistanceUtilize the Thingboot ecosystemTemperature and humidity sensor.

  • principle: If you issue a "cooling to 24 degrees" command. After 10 minutes, you check the temperature of the temperature and humidity sensor.

  • logic: If the temperature drops, it means the air conditioner is working; if the temperature does not change or even rises, it means the air conditioner is not turned on or the setting is wrong.

  • this is aClosed loop verification, although sometimes used in automation scenarios.

4. A slightly colloquial "Guide to avoid pitfalls"

  1. Misunderstanding about "200 OK"A common mistake for novices is to see the interface return 200 or{"code":200}, a pop-up window "Operation Successful" appears.Never!It is clearly written in the document: "200 only means that the platform has received the command...the device may be offline.".Correct approach: Received 200, just said "command has been issued". You have to wait until you receive the pushed "Execution Successful" event to be considered truly successful.

  2. Gateway problemIf the remote control is connected to 2.4G WiFi, the signal is very good. But if you put it in a metal cabinet or in a corner, the WiFi will be weak.There is one in the interface parametersgateway, if the signal is not good, you can specify the gateway to forward. If the device is offline, you will receive504error code.

  3. Repeat commandThe user taps three times in succession to "cool down". Remember to do it on the front endThrottle. Because once there are too many infrared emissions, the air conditioner may not understand it (some air conditioners beep three times to change the temperature). It is best to disable the button for 1 second each time the mobile phone sends a command.

  4. Private deploymentIf this is a solution for a large customer (such as a hotel), the customer is worried about data security. Thingboot device supportPrivatizationdeploy. You can connect all the data to the customer's own server instead of going to Thingboot's public cloud, so the delay is lower and more secure.

5. Summarize the code logic

If you were to write code now, the process would look like this:

  1. User clicks "Start"->The interface displays Loading.

  2. Call core step interface-> get{"code":200}(If an error is reported, the user will be prompted that the network is abnormal).

  3. Enable MQTT monitoring(Or wait for HTTP callback):

    • if receiveddevice_statusfor1, Loading becomes "on" and displays green status.

    • If no message is received within 5 seconds, it will prompt "The device may be offline, please check the remote control network" and the status will be grayed out.

  4. Refresh interface: Always keep the phone interface status = the last confirmed actual device status.

With this combo, your mobile app can not only control the air conditioner, but alsoAccurately tell users whether the air conditioner is obedient or not. This is basically the common practice for smart home apps currently on the market.

遥控器产品方案:
学校教室空调控制:怎么把空调远程指令发送器2集成到自己的项目中
查看 >>
店铺空调设备控制:怎么将空调模式温度控制器集成到软件项目中
查看 >>
如何在智能化改造空调场景中集成智能硬件以实现空调开关机控制
查看 >>
怎样对接智能红外空调遥控器以实现本地按键控制空调
查看 >>
怎样二次开发空调自动化控制模块来实现红外信号转发
查看 >>
空调场景方案:
怎样在智能办公设备电源控制中接入智能硬件来实现空调电源控制
查看 >>
如何在民宿房间空调控制中对接智能硬件以实现定时任务控制空调
查看 >>
智能化改造空调场景:如何把智能空调控制器2对接到自己的项目中
查看 >>
怎么在实验室空调温控场景中中接入智能硬件以实现HTTP接口控制空调设备
查看 >>
如何在共享台球室灯光空调控制中接入智能设备以实现远程控制16路线路
查看 >>
反馈用途方案:
如何在共享自习室照明门禁控制中接入智能硬件来实现灯光门禁状态反馈控制
查看 >>
如何在共享充电站照明管理中对接智能硬件来实现照明状态反馈控制
查看 >>
怎么在办公室门禁系统控制中集成智能硬件以实现开门状态反馈控制
查看 >>
怎样接入2200W智能通断器AC1以实现线路状态反馈控制
查看 >>
如何对接24 路智能分体远程多通道控制器以实现线路状态反馈控制
查看 >>