Instruction conversion method and device of home equipment, electronic equipment and medium

CN122534147APending Publication Date: 2026-08-07GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GREE ELECTRIC APPLIANCE INC OF ZHUHAI
Filing Date
2026-07-06
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]但当新增的家居设备采用的通信协议没有被录入通信协议规范库,或是第三方控制设备不具备红外线功能时,则无法对该家居设备进行控制

Benefits of technology

本发明实施例通过监听控制设备向家居设备发送的通信数据,通信数据包括指令序列,对多个指令序列进行分析处理,确定指令序列中哪些字段代表参数部分而无需人工查阅协议相关文档。再获取家居设备接收通信数据后的状态变化信息,将参数字段的字段值与状态变化信息进行匹配,建立参数字段的字段值与状态变化信息之间的映射关系。将指令参数字段的具体值与家居设备实际发生的状态变化进行匹配关联,从而确定每个指令序列的功能含义。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122534147A_ABST
    Figure CN122534147A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of instruction conversion method of home equipment, belong to home equipment field, method includes: the communication data that control equipment is sent to home equipment is listened to, communication data includes instruction sequence;Multiple instruction sequences are analyzed and handled, determine the parameter field of instruction sequence;State change information after home equipment receives communication data is obtained;The field value of parameter field is matched with state change information, and the mapping relationship between them is established;Receive the instruction information for controlling home equipment;According to instruction information and mapping relationship, determine the instruction sequence corresponding to instruction information;Instruction sequence is sent to home equipment, to control home equipment to execute corresponding operation.The embodiment of the application is by automatically analyzing the parameter field in instruction, and the mapping relationship between function semantics and parameter field is established, so that subsequent direct conversion through the mapping relationship obtains corresponding instruction sequence can realize the control of home equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of home appliance technology, and in particular to a method, apparatus, electronic device, and readable storage medium for converting instructions for home appliances. Background Technology

[0002] With the rapid development of smart home technology, intelligent control of home appliances has become an important means of improving the convenience of life. Users can send control commands to home appliances such as air conditioners, lights, and smart curtains through various control devices such as remote controls and voice assistants to control these appliances. However, different manufacturers and models of home appliances often use different custom communication protocols, and their command formats and parameter encoding methods vary greatly, making it difficult for third-party control devices to achieve compatible control.

[0003] In related technologies, a communication protocol specification library is built by collecting communication protocol specifications from various home appliances to adapt to different home appliances and complete control operations as much as possible. Alternatively, for third-party control devices with infrared functionality, infrared code learning technology can be used to record the infrared signals of the control home appliances and directly complete the control operations.

[0004] However, if the communication protocol used by the newly added home device is not recorded in the communication protocol specification library, or if the third-party control device does not have infrared functionality, then the home device cannot be controlled. Summary of the Invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a method, apparatus, electronic device and readable storage medium for converting instructions for home appliances that overcomes or at least partially solves the above problems.

[0006] In a first aspect, embodiments of the present invention provide a method for converting instructions for home appliances, the method comprising: The monitoring control device sends communication data to the home appliance, the communication data including a sequence of instructions; Analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequences, wherein the instruction structure includes parameter fields; Obtain the status change information of the home device after receiving the communication data; The field values ​​of the parameter fields are matched with the state change information to establish a mapping relationship between the field values ​​of the parameter fields and the state change information; Receive instruction information for controlling the home appliances; Based on the instruction information and the mapping relationship, determine the instruction sequence corresponding to the instruction information; The instruction sequence is sent to the home appliance to control it to perform the corresponding operation.

[0007] Optionally, the instruction structure may further include fixed fields; The step of determining the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship includes: The state change information corresponding to the instruction information is determined as the target state change information; Based on the target state change information and the mapping relationship, determine the field values ​​of the parameter fields corresponding to the target state change information; Based on the instruction structure, the values ​​of the fixed field and the parameter field are combined to obtain the instruction sequence corresponding to the instruction information.

[0008] Optionally, the instruction sequence includes multiple bytes; the step of analyzing and processing multiple instruction sequences to determine the instruction structure of the instruction sequence includes: Determine the frequency of occurrence of byte values ​​appearing on the same byte in the multiple instruction sequences; If the frequency of the same byte value occurring on a byte is greater than the first frequency, then the byte is determined to belong to a fixed field; If, among all the byte values ​​that appear on a byte, the byte value with the highest frequency of occurrence has a frequency lower than the second frequency, then the byte is determined to belong to the parameter field; the second frequency is lower than the first frequency.

[0009] Optionally, the step of matching the field values ​​of the parameter fields in the instruction sequence with state change information to establish a mapping relationship between the field values ​​of the parameter fields and the state change information includes: For multiple instruction sequences, a candidate mapping relationship is established between the field values ​​of the parameter fields and the state change information of the corresponding instruction sequences; When the number of times a candidate mapping relationship is established between the field value of the same parameter field and the same state change information reaches a preset number, the mapping relationship between the field value of the parameter field and the state change information is determined.

[0010] Optionally, the method further includes: After sending the instruction sequence to the home appliance, monitor whether the status change information of the home appliance matches the instruction information; If the status change information of the home appliance does not match the instruction information, it is determined to be a control error; If the number of control errors reaches a preset number, the mapping relationship corresponding to the instruction information is deleted.

[0011] Optionally, the method further includes: Continuously acquire the status information of the home appliances; The communication data also includes time information; the determination of the status change information of the home device after receiving the communication data includes: Based on the time information of the communication data, the first state information of the home device before receiving the communication data and the second state information after receiving the communication data are determined from the continuously acquired state information of the home device. The state change information is determined based on the first state information and the second state information.

[0012] Optionally, the method further includes: When a firmware upgrade event for the home device is detected, the multiple mapping relationships are verified. If the number of failed mapping relationships reaches a preset number, the mapping relationship for the home appliance is deleted and re-established.

[0013] Optionally, continuously acquiring the status information of the home appliances includes: Obtain the status sequence broadcast by the home device; the status sequence includes a status field; Obtain the mapping relationship between the field values ​​of the status field and the status of the home devices; Based on the status field and the mapping relationship between the field value of the status field and the status of the home device, the status of the home device corresponding to the status field is determined, and status information is generated.

[0014] Optionally, the method further includes: Obtain device status description information provided by the user, which is used to indicate the state of the home device after executing the instruction sequence; Obtain the state sequence of the home device after executing the instruction sequence; Analyze and process multiple state sequences to determine the state fields in the state sequences; The field value of the status field is matched with the device status description information to determine the mapping relationship between the field value of the status field and the status of the home device indicated by the device status description information.

[0015] Secondly, embodiments of the present invention provide an instruction conversion device for home appliances, the device comprising: A communication data monitoring module is used to monitor the communication data sent by the control device to the home appliance, the communication data including a sequence of instructions; The instruction sequence analysis module is used to analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequence, wherein the instruction structure includes parameter fields; A status change information acquisition module is used to acquire status change information of the home device after receiving the communication data; The mapping relationship establishment module is used to match the field values ​​of the parameter fields with the state change information and establish a mapping relationship between the field values ​​of the parameter fields and the state change information. The instruction information receiving module is used to receive instruction information for controlling the home appliances; An instruction sequence determination module is used to determine the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship; The instruction sequence sending module is used to send the instruction sequence to the home appliance to control the home appliance to perform corresponding operations.

[0016] Optionally, the instruction structure may further include fixed fields; The instruction sequence determination module includes: The target state change information determination submodule is used to determine the state change information corresponding to the instruction information as the target state change information. The parameter field value determination submodule is used to determine the field value of the parameter field corresponding to the target state change information based on the target state change information and the mapping relationship. The instruction sequence combination submodule is used to combine the field values ​​of the fixed field and the parameter field according to the instruction structure to obtain the instruction sequence corresponding to the instruction information.

[0017] Optionally, the instruction sequence includes multiple bytes; the instruction sequence analysis module includes: The frequency determination submodule is used to determine the frequency of occurrence of byte values ​​appearing on the same byte in the multiple instruction sequences; The fixed field determination submodule is used to determine that a byte belongs to a fixed field if the frequency of occurrence of the same byte value on a byte is greater than a first frequency. The parameter field determination submodule is used to determine that the byte belongs to the parameter field if the frequency of the most frequent byte value among all byte values ​​appearing on a byte is less than the second frequency; the second frequency is less than the first frequency.

[0018] Optionally, the mapping relationship establishment module includes: The candidate mapping relationship establishment submodule is used to establish a candidate mapping relationship between the field values ​​of the parameter fields and the state change information of the corresponding instruction sequences for multiple instruction sequences; The mapping relationship determination submodule is used to determine the mapping relationship between the field value of the parameter field and the state change information when the number of times the field value of the same parameter field establishes a candidate mapping relationship with the same state change information reaches a preset number.

[0019] Optionally, the device further includes: The status change matching module is used to monitor whether the status change information of the home device matches the instruction information after the instruction sequence is sent to the home device. The control error determination module is used to determine a control error if the status change information of the home device does not match the instruction information. The mapping relationship deletion module is used to delete the mapping relationship corresponding to the instruction information if the number of control errors reaches a preset number.

[0020] Optionally, the device further includes: The status information acquisition module is used to continuously acquire the status information of the home appliances; The communication data also includes time information; the state change information acquisition module includes: The status information determination submodule is used to determine, based on the time information of the communication data, the first status information of the home device before receiving the communication data and the second status information after receiving the communication data from the continuously acquired status information of the home device; The state change information determination submodule is used to determine the state change information based on the first state information and the second state information.

[0021] Optionally, the device further includes: The verification processing module is used to verify multiple mapping relationships when a firmware upgrade event for the home device is detected. The mapping relationship reconstruction module is used to delete and re-establish the mapping relationship for the home device if the number of failed verifications of the mapping relationship reaches a preset number.

[0022] Optionally, the status information acquisition module includes: A status sequence acquisition submodule is used to acquire the status sequence broadcast by the home device; the status sequence includes a status field. The mapping relationship acquisition submodule is used to obtain the mapping relationship between the field value of the status field and the status of the home device; The status information generation submodule is used to determine the status of the home device corresponding to the status field based on the status field and the mapping relationship between the field value of the status field and the status of the home device, and to generate status information.

[0023] Optionally, the device further includes: The device status description information acquisition module is used to acquire device status description information provided by the user. The device status description information is used to indicate the status of the home device after executing the instruction sequence. The state sequence acquisition module is used to acquire the state sequence of the home device after executing the instruction sequence; The state field determination module is used to analyze and process multiple state sequences to determine the state fields in the state sequences; The status mapping relationship determination module is used to match the field value of the status field with the device status description information to determine the mapping relationship between the field value of the status field and the status of the home device indicated by the device status description information.

[0024] Thirdly, embodiments of the present invention provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the instruction conversion method for home devices as described in the first aspect.

[0025] Fourthly, embodiments of the present invention provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the instruction translation method for home appliances as described in the first aspect.

[0026] The embodiments of the present invention have the following advantages: This invention, in its embodiments, monitors communication data sent from a control device to home appliances. This communication data includes command sequences. Multiple command sequences are analyzed and processed to determine which fields represent parameter components without requiring manual review of protocol documentation. Next, the status change information of the home appliances after receiving the communication data is acquired. The values ​​of the parameter fields are matched with this status change information to establish a mapping relationship between the parameter field values ​​and the status change information. Finally, the specific values ​​of the command parameter fields are matched and associated with the actual status changes of the home appliances to determine the functional meaning of each command sequence.

[0027] Building upon this foundation, when subsequent commands for controlling home appliances are received, the corresponding command sequence is determined based on the command information and the mapping relationship. This command sequence is then sent to the home appliances to control them and execute the corresponding operations. By monitoring the communication data between the control device and the home appliances, the parameter fields in the command structure are automatically analyzed, and their values ​​are matched with actual device state changes. This establishes a mapping relationship between functional semantics and the parameter fields of the command sequence. This allows for control of the home appliances when subsequent commands with user intent are received, without prior knowledge of the home appliances' communication protocols; the corresponding command sequence can be directly derived through this mapping relationship. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 This is a flowchart illustrating the steps of a home appliance instruction conversion method provided in an embodiment of the present invention; Figure 2 This is a structural block diagram of an instruction conversion device for home appliances provided in an embodiment of the present invention. Detailed Implementation

[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0031] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0032] With the rapid development of smart home technology, intelligent control of home appliances has become an important means of improving the convenience of life. Users can send control commands to home appliances such as air conditioners, lights, and smart curtains through various control devices such as remote controls and voice assistants to control these appliances. However, different manufacturers and models of home appliances often use different custom communication protocols, and their command formats and parameter encoding methods vary greatly, making it difficult for third-party control devices to achieve compatible control.

[0033] In related technologies, a communication protocol specification library is built by collecting communication protocol specifications from various home appliances to adapt to different home appliances and complete control operations as much as possible. Alternatively, for third-party control devices with infrared functionality, infrared code learning technology can be used to record the infrared signals of the control home appliances and directly complete the control operation. However, if the communication protocol used by a newly added home appliance is not recorded in the communication protocol specification library, or if the third-party control device does not have infrared functionality, then the home appliance cannot be controlled.

[0034] This invention pertains to the application of emerging software and new information technology services in the smart home field, specifically involving protocol adaptation and command conversion software technology in smart home scenarios. One of the core concepts of this invention lies in automatically analyzing and determining the parameter fields in the command sequence, and then establishing a mapping relationship between functional semantics and parameter fields. This allows for the control of home devices when subsequent user-intentioned command information is received, without prior knowledge of the communication protocol of the home devices; the corresponding command sequence can be directly converted through this mapping relationship.

[0035] Figure 1 This is a flowchart of the steps of a home appliance instruction conversion method provided in an embodiment of the present invention.

[0036] like Figure 1 As shown, the method may specifically include the following steps: Step 101: Monitor the communication data sent by the control device to the home appliance, the communication data including a sequence of instructions; In this embodiment of the invention, home appliances refer to electrical devices with communication interfaces that can be controlled remotely or locally, such as air conditioners, air purifiers, fans, electric curtains, and smart lights. Control devices refer to devices capable of sending control commands to home appliances, such as remote controls, wired controllers, smart panels, and mobile phones. Communication between the control device and the home appliances occurs via wired bus or wireless signals. Communication data refers to the raw binary data frames transmitted between the control device and the home appliances, including instruction sequences. The format, length, and verification method of these data frames may vary depending on the manufacturer or model. As an example, the instruction sequence could be 0xA1 0x05 0x01 0x00 0xFF.

[0037] It is worth noting that the application scenario of this invention is when a third-party control device needs to control home appliances. It can first listen to the communication data sent by other control devices to the home appliances, thus providing a data foundation for subsequent command conversion. For example, a user's home has an air conditioner (home appliance) installed, along with its original remote control (control device). The user wants to use a smart gateway (third-party control device) in their home to control the air conditioner.

[0038] As an example, if a smart gateway is used as the implementing entity of the method of this invention, it can connect in parallel to the communication bus, such as UART, between other control devices and home appliances, thereby monitoring the communication data sent by the control devices to the home appliances. This monitoring refers to capturing signals on the bus in read-only mode, without changing the original communication path or interfering with the communication content.

[0039] Step 102: Analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequences, wherein the instruction structure includes parameter fields; After obtaining multiple instruction sequences, statistical analysis is performed on them to automatically identify the compositional patterns of the instruction sequences, especially to delineate the parameter fields for subsequent mapping relationships.

[0040] In some embodiments, the instruction sequence comprises multiple bytes; In some embodiments, step 102 specifically includes the following sub-steps: Sub-step S11: Determine the frequency of occurrence of byte values ​​appearing on the same byte in the plurality of instruction sequences; Different manufacturers or models of home appliances may use different instruction formats, but an instruction sequence usually includes: a fixed instruction header, one or more variable parameter fields, and an optional fixed terminator. Therefore, this invention considers performing byte-by-byte frequency analysis on multiple instruction sequences as samples to analyze and identify the instruction structure of the instruction sequence.

[0041] Starting from byte 0, for each byte position, count all byte values ​​that appear at that position in all instruction sequences, and calculate the proportion of the occurrences of each byte value to the total number of samples at that position as the occurrence frequency.

[0042] As an example, there are N instruction sequences. For position i, we count the byte value distribution of the N instructions at that position to obtain the frequency of each byte value v, f(v) = count(v) / N.

[0043] Sub-step S12: If the frequency of occurrence of the same byte value on a byte is greater than the first frequency, then the byte is determined to belong to a fixed field; The first frequency is a relatively high preset frequency, such as 90%. When the frequency of a specific byte value at a certain byte position exceeds 90%, it can be understood that the byte remains almost unchanged in all instruction sequences, and therefore the byte is determined to belong to a fixed field.

[0044] As an example, there are 100 instruction sequences. At position 0, the byte value 0xA1 appears 98 times, with a frequency of 98%, which is greater than the first frequency of 90%. Therefore, position 0 is determined to be a fixed field, and its field value is fixed as 0xA1.

[0045] Sub-step S13: If, among all the byte values ​​that appear on a byte, the frequency of the byte value with the highest frequency is less than the second frequency, then the byte is determined to belong to the parameter field; the second frequency is less than the first frequency.

[0046] The second frequency is a preset frequency that is lower than the first frequency. For example, the second frequency can be set to 70%. When the frequency of the byte value that appears most frequently at a certain byte position is also lower than the second frequency, it can be understood that the byte varies greatly in different instruction sequences, and therefore the byte is determined to belong to the parameter field.

[0047] As an example, there are 100 instruction sequences. At position 4, the byte values ​​0x01, 0x02, 0x03, and 0x04 appear 32, 28, 25, and 15 times respectively. The highest frequency of occurrence is 32%, which is less than the second highest frequency of 70%. Therefore, position 2 is determined to be a parameter field.

[0048] Step 103: Obtain the status change information of the home device after receiving the communication data; In order to establish a mapping relationship between the parameter fields of the command sequence and the specific control functions, it is necessary to obtain the state changes of the home appliances after receiving the command sequence. The state change information describes the state changes that occur in the home appliances after executing the command, such as the temperature dropping by one degree or the mode switching from cooling to heating.

[0049] In some embodiments, the communication data further includes time information; In some embodiments, step 103 specifically includes the following sub-steps: Sub-step S21: Based on the time information of the communication data, determine the first state information of the home device before receiving the communication data and the second state information after receiving the communication data from the continuously acquired state information of the home device; During operation, the gateway continuously records the status information of home devices and their corresponding timestamps. When the gateway receives communication data sent to the home devices by other control devices, it retrieves the most recent status information before that moment from the continuously recorded status information based on the time information of the communication data, and retrieves the status information after that moment for a period of time, such as 3 seconds, as the second status information.

[0050] As an example, the gateway maintains a state information cache queue. When a sequence of instructions is received, its timestamp is determined to be T. The state information whose timestamp is less than and closest to T is retrieved from the cache queue as the first state information. Simultaneously, a timer is set to retrieve the last state information whose timestamp falls within the range (T, T+Δt) from the cache queue at time T+Δt, for example, Δt = 3000 milliseconds, as the second state information.

[0051] Sub-step S22: Determine the state change information based on the first state information and the second state information.

[0052] The second state information is compared with the first state information to determine the difference between them, thus obtaining state change information. State change information can be represented as temperature difference, the mode before and after a mode switch, etc., and a mapping relationship is subsequently established between the functional meaning of the subsequent instruction sequence and the instruction sequence itself.

[0053] As an example, if the first state information is cooling mode 26℃ and the second state information is cooling mode 27℃, then the state change information is that the temperature increases by 1℃.

[0054] In some embodiments, the method further includes: continuously acquiring status information of the home device; In some embodiments, continuously acquiring the status information of the home device includes the following specific steps: Obtain the status sequence broadcast by the home device; the status sequence includes a status field; Obtain the mapping relationship between the field values ​​of the status field and the status of the home devices; Based on the status field and the mapping relationship between the field value of the status field and the status of the home device, the status of the home device corresponding to the status field is determined, and status information is generated.

[0055] In real-world applications, home appliances such as air conditioners periodically broadcast their current status to the communication bus, for example, sending a status data frame every 500 milliseconds. This status sequence is the raw byte sequence of the status data frame, which may include status fields indicating temperature, mode, fan speed, on / off status, etc. The gateway connects to the bus in parallel and obtains these status sequences in read-only mode.

[0056] In some embodiments, the mapping relationship between the field value of the status field and the status of the home device is determined in the following manner: Obtain device status description information provided by the user, which represents the state of the home device after executing a sequence of instructions; obtain the state sequence of the home device after executing the sequence of instructions; analyze and process multiple state sequences to determine the state fields in the state sequences; match the field values ​​of the state fields with the device status description information to determine the mapping relationship between the field values ​​of the state fields and the state of the home device indicated by the device status description information.

[0057] In practical applications, users can provide device status descriptions after performing certain operations on home appliances via mobile apps or web interfaces. For example, after a user sets an air conditioner to heating mode using a remote control, they can select the "Heating Mode" tab on the app. This tab serves as the device status description, which is then recorded by the gateway. Simultaneously, the gateway also acquires the status sequence broadcast by the home appliances after this operation.

[0058] By collecting state sequence samples under different states through the above steps, and then performing byte-by-byte comparative analysis on these sequences, we can compare which byte positions have changed in the states represented by different state description information, thereby determining the state fields in the state sequence.

[0059] As an example, when the device status description information is cooling, the status sequence is A2 0C 1A 01 02 00 FFFF; when the device status description information is heating, the status sequence is A2 0C 1A 02 02 00 FF FF; when the device status description information is air supply, the status sequence is A2 0C 1A 03 02 00 FF FF. Therefore, comparative analysis shows that position 3 is a status field, specifically a status field reflecting the air conditioning mode.

[0060] Next, the values ​​of the status field are matched with the device status description information to determine the mapping relationship between the status field values ​​and the status of the home appliances indicated by the device status description information. Therefore, when a new status sequence is subsequently obtained, the status of the home appliances corresponding to the status field in that status sequence can be directly determined based on this mapping relationship, thus generating status information.

[0061] Step 104: Match the field values ​​of the parameter fields with the state change information to establish a mapping relationship between the field values ​​of the parameter fields and the state change information; After determining the parameter fields in the instruction sequence and the state change information corresponding to each instruction sequence through the previous steps, this step associates and matches the two to establish a mapping relationship between the instruction sequence and the specific functional semantics.

[0062] In some embodiments, step 104 specifically includes the following sub-steps: Sub-step S31: For multiple instruction sequences, establish a candidate mapping relationship between the field values ​​of the parameter fields and the state change information of the corresponding instruction sequences; Because bus communication may be subject to interference or fluctuations in the air conditioner's own state, this invention considers that the reliability of a single matching result may be low. Therefore, a multiple verification mechanism is adopted. Only when the same mapping relationship appears multiple times simultaneously is it determined to be a stable mapping relationship.

[0063] For each collected instruction sequence, the gateway extracts the field value of its parameter field, which can be a value consisting of one or more bytes. At the same time, it obtains the state change information corresponding to the instruction sequence, and then associates the two to form a candidate mapping relationship.

[0064] In practical applications, candidate mappings can be temporarily stored as key-value pairs. Specifically, the gateway can maintain a mapping table to record the state change information corresponding to each parameter field value and its occurrence count. When processing a new instruction sequence, the gateway searches the mapping table based on the instruction's parameter field value. If the key already exists in the table, it checks whether the current state change information matches the record in the table; if they match, the mapping count is incremented; if they do not match, a conflict is recorded; if the key does not exist in the table, a new candidate mapping is created.

[0065] Sub-step S32: When the number of times a candidate mapping relationship is established between the field value of the same parameter field and the same state change information reaches a preset number, the mapping relationship between the field value of the parameter field and the state change information is determined.

[0066] The specific value of the preset number of times can be set according to the actual situation, and this invention does not impose any restrictions on it. As an example, if the preset number of times is 3, then only when the mapping between the same parameter field value and the same state change information appears repeatedly 3 times will the candidate mapping relationship be recognized as a formal mapping relationship for use in subsequent instruction conversion.

[0067] Step 105: Receive instruction information for controlling the home appliances; After establishing the mapping relationship between parameter field values ​​and state change information in the preceding steps, it can be understood that the gateway has basically acquired the ability to understand command semantics. It can then enter the control phase, where the gateway receives control requests from upper-layer applications or user interfaces, that is, command information used to control the home appliances.

[0068] It should be noted that the command information is a high-level control command independent of the underlying communication protocol. As an example, the command information could be a control command issued by the user through a mobile application or a control command generated by a voice assistant after parsing the user's voice. Unlike the underlying command sequence, the command information received in this step is independent of the specific communication protocol. That is, the upper-layer application issuing the command information does not need to know whether the air conditioner uses a UART bus or infrared remote control, nor does it need to understand the meaning of a certain value in the command; it only needs to send a semantic control request. The gateway, acting as an intermediate layer, is responsible for converting the high-level command information into a low-level command sequence, thus ensuring compatibility with the differences in protocols among various home appliances.

[0069] In practical applications, instruction information can uniformly adopt a structured data format, such as JSON or XML. As an example, an instruction message might be JSON: { "cmd": "set_mode", "value": "heat"}.

[0070] Step 106: Determine the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship; In some embodiments, the instruction structure further includes fixed fields; As can be understood, fixed fields are the parts of the instruction sequence whose values ​​remain unchanged, such as the instruction header and end-of-line character. Once the parameter field values ​​are determined, the complete instruction sequence can be obtained by simply concatenating the fixed fields with the parameter fields in sequence.

[0071] In some embodiments, step 106 specifically includes the following sub-steps: Sub-step S41: Determine the state change information corresponding to the instruction information as the target state change information; The gateway first parses and processes the received command information to determine its control intent and converts it into standardized state change information, which serves as the target state change information for this command conversion. For example, the command information might be: "Set the temperature to 24℃." The gateway needs to consider the actual state of the current home appliances to determine the required state change. If the current temperature is 26℃ and the command information requests a setting of 24℃, then the target state change information is determined to be: "Decrease the temperature by 2℃."

[0072] Sub-step S42: Based on the target state change information and the mapping relationship, determine the field value of the parameter field corresponding to the target state change information; In the mapping relationship between the field values ​​of the instruction sequence parameter fields and the state change information established in the previous steps, query the state change information that matches the target state change information and retrieve the field values ​​of the corresponding parameter fields.

[0073] Sub-step S43: Based on the instruction structure, combine the field values ​​of the fixed field and the parameter field to obtain the instruction sequence corresponding to the instruction information.

[0074] After obtaining the parameter field values ​​corresponding to the target state change information, the fixed field values ​​and parameter field values ​​are combined in sequence according to the instruction structure determined in the previous steps to obtain a complete instruction sequence.

[0075] Step 107: Send the instruction sequence to the home appliance to control the home appliance to perform the corresponding operation.

[0076] After determining the instruction sequence corresponding to the instruction information, the gateway sends the instruction sequence to the communication link, where it is received and executed by the home appliance to achieve the user's desired control effect. In practical applications, when the communication link is a wired bus such as UART, the gateway can output each byte of the instruction sequence to the bus sequentially through its UART transmit pin.

[0077] This invention applies a novel information technology service method to the protocol analysis and instruction conversion of home appliances. By learning the communication protocols of home appliances through software methods, it enables adaptive control of devices with unknown protocols, solving the problem of being unable to control corresponding home appliances due to an incomplete communication protocol specification library.

[0078] In some embodiments, the method further includes: After the instruction sequence is sent to the home appliance, the system monitors whether the status change information of the home appliance matches the instruction information. If the status change information of the home appliance does not match the instruction information, it is determined to be a control error. If the number of control errors reaches a preset number, the mapping relationship corresponding to the instruction information is deleted.

[0079] After the gateway sends the command sequence, it continues to acquire the status information of home devices and observes whether the status of the home devices has changed as expected within a reasonable time window, such as within 3 seconds after sending the command. When a discrepancy is detected between the actual status change and the expectation, a control error is identified and recorded. When the number of control errors reaches a preset number, the mapping relationship corresponding to that command information is deleted.

[0080] In one embodiment, the gateway maintains a reliability counter for the mapping relationship between each parameter field value and state change information. The initial reliability can be set to 0 or a positive value. If the control is successful, the reliability of the corresponding mapping relationship is increased by 1; if the control fails, the reliability of the corresponding mapping relationship is decreased by 1. When the reliability reaches the set lower limit, the mapping relationship is determined to be unreliable and is deleted from the mapping relationship table.

[0081] In some embodiments, the method further includes: When a firmware upgrade event for the home device is detected, multiple mapping relationships are verified. If the number of failed verification mapping relationships reaches a preset number, the mapping relationships for the home device are deleted and re-established.

[0082] During the long-term use of home appliances, there may be situations where it is necessary to upgrade the device firmware. However, firmware upgrades may change the instruction format, parameter encoding rules, or status feedback method of the device's communication protocol, which may lead to the failure of established mapping relationships.

[0083] To address this, the present invention considers detecting firmware upgrade events of the home appliances. Specifically, the gateway can periodically query the firmware version number of the home appliances via a dedicated command. When the version number is found to be inconsistent with the previously recorded version number, it is determined that a firmware upgrade has occurred. Alternatively, the gateway can continuously monitor the status sequence broadcast by the home appliances. If it finds significant changes in the length of the status data frame or the values ​​of fixed fields, and these changes remain stable across multiple consecutive samples, it is determined that a firmware upgrade or protocol change may have occurred.

[0084] Upon detecting a firmware upgrade event, the gateway performs verification. Specifically, it selects a portion of the mapping relationships from the current mapping table, actively sends the corresponding command sequence, and then determines whether the actual state change matches the expected value in the mapping relationship. If they match, the verification is considered successful; otherwise, it is considered a failure.

[0085] If the number of failed verifications of the mapping relationship reaches a preset number, it is considered that the firmware upgrade has indeed caused a large-scale change in the protocol, and the mapping relationship for the home device is deleted and re-established.

[0086] This invention, in its embodiments, monitors communication data sent from a control device to home appliances. This communication data includes command sequences. Multiple command sequences are analyzed and processed to determine which fields represent parameter components without requiring manual review of protocol documentation. Next, the status change information of the home appliances after receiving the communication data is acquired. The values ​​of the parameter fields are matched with this status change information to establish a mapping relationship between the parameter field values ​​and the status change information. Finally, the specific values ​​of the command parameter fields are matched and associated with the actual status changes of the home appliances to determine the functional meaning of each command sequence.

[0087] Building upon this foundation, when subsequent commands for controlling home appliances are received, the corresponding command sequence is determined based on the command information and the mapping relationship. This command sequence is then sent to the home appliances to control them and execute the corresponding operations. By monitoring the communication data between the control device and the home appliances, the parameter fields in the command structure are automatically analyzed, and their values ​​are matched with actual device state changes. This establishes a mapping relationship between functional semantics and the parameter fields of the command sequence. This allows for control of the home appliances when subsequent commands with user intent are received, without prior knowledge of the home appliances' communication protocols; the corresponding command sequence can be directly derived through this mapping relationship.

[0088] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0089] Figure 2 This is a structural block diagram of an instruction conversion device for home appliances provided in an embodiment of the present invention.

[0090] like Figure 2 As shown in the figure, the instruction conversion device for home appliances provided in this embodiment of the invention may specifically include the following modules: The communication data monitoring module 201 is used to monitor the communication data sent by the control device to the home appliance, the communication data including a sequence of instructions; The instruction sequence analysis module 202 is used to analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequence, wherein the instruction structure includes parameter fields; The status change information acquisition module 203 is used to acquire status change information of the home device after receiving the communication data; The mapping relationship establishment module 204 is used to match the field value of the parameter field with the state change information and establish a mapping relationship between the field value of the parameter field and the state change information. The instruction information receiving module 205 is used to receive instruction information for controlling the home appliances; The instruction sequence determination module 206 is used to determine the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship; The instruction sequence sending module 207 is used to send the instruction sequence to the home appliance to control the home appliance to perform corresponding operations.

[0091] In some embodiments, the instruction structure further includes fixed fields; The instruction sequence determination module includes: The target state change information determination submodule is used to determine the state change information corresponding to the instruction information as the target state change information. The parameter field value determination submodule is used to determine the field value of the parameter field corresponding to the target state change information based on the target state change information and the mapping relationship. The instruction sequence combination submodule is used to combine the field values ​​of the fixed field and the parameter field according to the instruction structure to obtain the instruction sequence corresponding to the instruction information.

[0092] In some embodiments, the instruction sequence includes multiple bytes; the instruction sequence analysis module includes: The frequency determination submodule is used to determine the frequency of occurrence of byte values ​​appearing on the same byte in the multiple instruction sequences; The fixed field determination submodule is used to determine that a byte belongs to a fixed field if the frequency of occurrence of the same byte value on a byte is greater than a first frequency. The parameter field determination submodule is used to determine that the byte belongs to the parameter field if the frequency of the most frequent byte value among all byte values ​​appearing on a byte is less than the second frequency; the second frequency is less than the first frequency.

[0093] In some embodiments, the mapping relationship establishment module includes: The candidate mapping relationship establishment submodule is used to establish a candidate mapping relationship between the field values ​​of the parameter fields and the state change information of the corresponding instruction sequences for multiple instruction sequences; The mapping relationship determination submodule is used to determine the mapping relationship between the field value of the parameter field and the state change information when the number of times the field value of the same parameter field establishes a candidate mapping relationship with the same state change information reaches a preset number.

[0094] In some embodiments, the apparatus further includes: The status change matching module is used to monitor whether the status change information of the home device matches the instruction information after the instruction sequence is sent to the home device. The control error determination module is used to determine a control error if the status change information of the home device does not match the instruction information. The mapping relationship deletion module is used to delete the mapping relationship corresponding to the instruction information if the number of control errors reaches a preset number.

[0095] In some embodiments, the apparatus further includes: The status information acquisition module is used to continuously acquire the status information of the home appliances; The communication data also includes time information; the state change information acquisition module includes: The status information determination submodule is used to determine, based on the time information of the communication data, the first status information of the home device before receiving the communication data and the second status information after receiving the communication data from the continuously acquired status information of the home device; The state change information determination submodule is used to determine the state change information based on the first state information and the second state information.

[0096] In some embodiments, the apparatus further includes: The verification processing module is used to verify multiple mapping relationships when a firmware upgrade event for the home device is detected. The mapping relationship reconstruction module is used to delete and re-establish the mapping relationship for the home device if the number of failed verifications of the mapping relationship reaches a preset number.

[0097] In some embodiments, the status information acquisition module includes: A status sequence acquisition submodule is used to acquire the status sequence broadcast by the home device; the status sequence includes a status field. The mapping relationship acquisition submodule is used to obtain the mapping relationship between the field value of the status field and the status of the home device; The status information generation submodule is used to determine the status of the home device corresponding to the status field based on the status field and the mapping relationship between the field value of the status field and the status of the home device, and to generate status information.

[0098] In some embodiments, the apparatus further includes: The device status description information acquisition module is used to acquire device status description information provided by the user. The device status description information is used to indicate the status of the home device after executing the instruction sequence. The state sequence acquisition module is used to acquire the state sequence of the home device after executing the instruction sequence; The state field determination module is used to analyze and process multiple state sequences to determine the state fields in the state sequences; The status mapping relationship determination module is used to match the field value of the status field with the device status description information to determine the mapping relationship between the field value of the status field and the status of the home device indicated by the device status description information.

[0099] As the apparatus embodiment is basically similar to the method embodiment, it is described in a relatively simple manner. For relevant details, please refer to the description of the method embodiment.

[0100] This invention also provides an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the various processes of the instruction conversion method embodiments of the above-described home device and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0101] It should be noted that the electronic devices in the embodiments of the present invention include the mobile electronic devices and non-mobile electronic devices described above.

[0102] This invention also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described home appliance instruction conversion method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0103] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0104] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0105] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0108] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0110] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0111] The foregoing has provided a detailed description of the instruction conversion method, apparatus, electronic device, and computer-readable storage medium for home appliances provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for converting instructions for home appliances, characterized in that, The method includes: The monitoring control device sends communication data to the home appliance, the communication data including a sequence of instructions; Analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequences, wherein the instruction structure includes parameter fields; Obtain the status change information of the home device after receiving the communication data; The field values ​​of the parameter fields are matched with the state change information to establish a mapping relationship between the field values ​​of the parameter fields and the state change information; Receive instruction information for controlling the home appliances; Based on the instruction information and the mapping relationship, determine the instruction sequence corresponding to the instruction information; The instruction sequence is sent to the home appliance to control it to perform the corresponding operation.

2. The instruction conversion method for home appliances according to claim 1, characterized in that, The instruction structure also includes fixed fields; The step of determining the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship includes: The state change information corresponding to the instruction information is determined as the target state change information; Based on the target state change information and the mapping relationship, determine the field values ​​of the parameter fields corresponding to the target state change information; Based on the instruction structure, the values ​​of the fixed field and the parameter field are combined to obtain the instruction sequence corresponding to the instruction information.

3. The instruction conversion method for home appliances according to claim 2, characterized in that, The instruction sequence comprises multiple bytes; the analysis and processing of the multiple instruction sequences to determine the instruction structure of the instruction sequence includes: Determine the frequency of occurrence of byte values ​​appearing on the same byte in the multiple instruction sequences; If the frequency of the same byte value occurring on a byte is greater than the first frequency, then the byte is determined to belong to a fixed field; If, among all the byte values ​​that appear on a byte, the byte value with the highest frequency of occurrence has a frequency lower than the second frequency, then the byte is determined to belong to the parameter field; the second frequency is lower than the first frequency.

4. The instruction conversion method for home appliances according to claim 1, characterized in that, The step of matching the field values ​​of the parameter fields in the instruction sequence with the state change information to establish a mapping relationship between the field values ​​of the parameter fields and the state change information includes: For multiple instruction sequences, a candidate mapping relationship is established between the field values ​​of the parameter fields and the state change information of the corresponding instruction sequences; When the number of times a candidate mapping relationship is established between the field value of the same parameter field and the same state change information reaches a preset number, the mapping relationship between the field value of the parameter field and the state change information is determined.

5. The instruction conversion method for home appliances according to claim 1, characterized in that, The method further includes: After sending the instruction sequence to the home appliance, monitor whether the status change information of the home appliance matches the instruction information; If the status change information of the home appliance does not match the instruction information, it is determined to be a control error; If the number of control errors reaches a preset number, the mapping relationship corresponding to the instruction information is deleted.

6. The instruction conversion method for home appliances according to claim 1, characterized in that, The method further includes: Continuously acquire the status information of the home appliances; The communication data also includes time information; the determination of the status change information of the home device after receiving the communication data includes: Based on the time information of the communication data, the first state information of the home device before receiving the communication data and the second state information after receiving the communication data are determined from the continuously acquired state information of the home device. The state change information is determined based on the first state information and the second state information.

7. The instruction conversion method for home appliances according to claim 1, characterized in that, The method further includes: When a firmware upgrade event for the home device is detected, the multiple mapping relationships are verified. If the number of failed verifications of the mapping relationship reaches a preset number, the mapping relationship for the home device is deleted and re-established.

8. The instruction conversion method for home appliances according to claim 6, characterized in that, The continuous acquisition of the status information of the home devices includes: Obtain the status sequence broadcast by the home device; the status sequence includes a status field; Obtain the mapping relationship between the field values ​​of the status field and the status of the home devices; Based on the status field and the mapping relationship between the field value of the status field and the status of the home device, the status of the home device corresponding to the status field is determined, and status information is generated.

9. The instruction conversion method for home appliances according to claim 8, characterized in that, The method further includes: Obtain device status description information provided by the user, which indicates the state of the home device after executing the instruction sequence; Obtain the state sequence of the home device after executing the instruction sequence; Analyze and process multiple state sequences to determine the state fields in the state sequences; The field value of the status field is matched with the device status description information to determine the mapping relationship between the field value of the status field and the status of the home device indicated by the device status description information.

10. A command conversion device for home appliances, characterized in that, The device includes: A communication data monitoring module is used to monitor the communication data sent by the control device to the home appliance, the communication data including a sequence of instructions; The instruction sequence analysis module is used to analyze and process multiple instruction sequences to determine the instruction structure of the instruction sequence, wherein the instruction structure includes parameter fields; A status change information acquisition module is used to acquire status change information of the home device after receiving the communication data; The mapping relationship establishment module is used to match the field values ​​of the parameter fields with the state change information and establish a mapping relationship between the field values ​​of the parameter fields and the state change information. The instruction information receiving module is used to receive instruction information for controlling the home appliances; An instruction sequence determination module is used to determine the instruction sequence corresponding to the instruction information based on the instruction information and the mapping relationship; The instruction sequence sending module is used to send the instruction sequence to the home appliance to control the home appliance to perform corresponding operations.

11. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the instruction translation method for home appliances as described in claims 1-9.

12. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the instruction translation method for home appliances as described in claims 1-9.