Air conditioner control method and device based on encrypted token, equipment and medium
Patent Information
- Application Number
- CN202510974056.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2045-07-15
AI Technical Summary
[0003]本发明实施例提供了一种基于加密令牌的空调控制方法、装置、设备及介质,旨在解决现有技术中无法安全且简便地通过无线方式对空调进行控制的问题
[0009]本发明实施例提供了一种基于加密令牌的空调控制方法、装置、设备及介质。所述方法应用于微信小程序端时包括:接收并解析空调设备发放的广播包以获取空调位置信息,根据所述空调位置信息确定可控制空调设备;通过云服务器判断目标控制空调设备的目标广播包是否处于预设时效范围内,其中,所述目标控制空调设备由用户于所述可控制空调设备中进行选择;若所述目标广播包处于所述预设时效范围内,则将获取的用户信息与所述目标广播包中的设备信息进行关联,以完成配对;根据所述目标广播包中的加密令牌将用户控制指令进行加密得到加密控制指令,并根据所述加密控制指令控制已配对的所述目标控制空调设备。应用于空调设备端时所述方法包括:每间隔预设生成时间根据预设加密算法生成加密令牌,根据所述加密令牌以及设备信息生成广播包;通过预设发送方式将所述广播包进行广播;接收微信小程序端发送的加密控制指令,根据所述加密控制指令控制所述空调设备运行。本发明实施例通过空调设备端每间隔预设生成时间根据预设加密算法生成加密令牌并据此与设备信息生成广播包进行广播,微信小程序接收广播包以获取空调位置信息,确定可控制空调设备,以通过地理位置限制攻击距离,保护空调控制的安全性;再经云服务器判断用户所选目标控制空调设备的目标广播包是否处于预设时效范围内,以完成对设备的验证,若处于则关联用户信息与目标广播包中的设备信息完成配对,并根据目标广播包中的加密令牌加密用户控制指令以控制已配对设备,以在简化用户操作的同时确保控制指令的合法性,从而安全且简便地通过无线方式对空调进行控制。
Smart Images

Figure CN120538171B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of air conditioning control, and in particular to an air conditioning control method, apparatus, device, and medium based on encryption tokens. Background Technology
[0002] With the rapid development of technology, the smart home industry has ushered in unprecedented changes, and users' demand for convenient and secure device control is growing. However, current smart air conditioners on the market still have many shortcomings in their control methods. Most existing smart air conditioners use Bluetooth pairing technology, such as Bluetooth Low Energy communication, requiring users to perform cumbersome manual pairing operations. Furthermore, pairing information is at risk of being stolen, posing security risks to users. At the same time, while some air conditioners use continuous broadcast status data, the data is not encrypted and is easily intercepted, potentially leading to malicious control of the device, such as remote switching or temperature tampering. In addition, existing solutions have not effectively addressed the problem. Although some manufacturers use fixed keys to encrypt broadcast data, these keys remain unchanged over time and can still be cracked, making it impossible to securely and easily control air conditioners wirelessly using current technology. Summary of the Invention
[0003] This invention provides an air conditioner control method, apparatus, device, and medium based on encryption tokens, aiming to solve the problem that existing technologies cannot securely and easily control air conditioners wirelessly.
[0004] In a first aspect, embodiments of the present invention provide an air conditioner control method based on an encrypted token. When applied to a WeChat mini-program, the method includes: receiving and parsing a broadcast packet issued by an air conditioner to obtain air conditioner location information; determining a controllable air conditioner based on the air conditioner location information; determining, via a cloud server, whether a target broadcast packet for controlling the air conditioner is within a preset time frame, wherein the target air conditioner is selected by the user from the controllable air conditioners; if the target broadcast packet is within the preset time frame, associating the obtained user information with the device information in the target broadcast packet to complete pairing; encrypting the user control command according to the encrypted token in the target broadcast packet to obtain an encrypted control command, and controlling the paired target air conditioner according to the encrypted control command.
[0005] Secondly, embodiments of the present invention also provide an air conditioning control method based on an encrypted token. When applied to an air conditioning device, the method includes: generating an encrypted token according to a preset encryption algorithm at preset generation intervals; generating a broadcast packet according to the encrypted token and device information; broadcasting the broadcast packet through a preset sending method; receiving encrypted control instructions sent from a WeChat mini-program; and controlling the operation of the air conditioning device according to the encrypted control instructions.
[0006] Thirdly, embodiments of the present invention also provide an air conditioning control device based on an encrypted token, which includes a unit for performing the method as described in any of the first aspects, or includes a unit for performing the method as described in any of the second aspects.
[0007] Fourthly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0008] Fifthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the above-described method.
[0009] This invention provides an air conditioner control method, apparatus, device, and medium based on an encrypted token. When applied to a WeChat mini-program, the method includes: receiving and parsing a broadcast packet from an air conditioner to obtain air conditioner location information; determining a controllable air conditioner based on the location information; determining, via a cloud server, whether a target broadcast packet for controlling the air conditioner is within a preset timeframe, wherein the target air conditioner is selected by the user from among the controllable air conditioners; if the target broadcast packet is within the preset timeframe, associating the obtained user information with the device information in the target broadcast packet to complete pairing; encrypting the user control command using the encrypted token in the target broadcast packet to obtain an encrypted control command; and controlling the paired target air conditioner based on the encrypted control command. When applied to an air conditioner device, the method includes: generating an encrypted token according to a preset encryption algorithm at preset intervals; generating a broadcast packet based on the encrypted token and device information; broadcasting the broadcast packet using a preset sending method; receiving the encrypted control command sent from the WeChat mini-program; and controlling the air conditioner to operate according to the encrypted control command. In this embodiment of the invention, the air conditioning device generates an encryption token at preset intervals according to a preset encryption algorithm, and then generates a broadcast packet based on the token and device information. The WeChat mini-program receives the broadcast packet to obtain the air conditioning location information and determines that the air conditioning device can be controlled. This uses geographical location to limit the attack distance and protect the security of air conditioning control. The cloud server then determines whether the target broadcast packet of the user's selected target air conditioning device is within a preset time range to complete the device verification. If it is, the user information is associated with the device information in the target broadcast packet to complete the pairing, and the user control command is encrypted according to the encryption token in the target broadcast packet to control the paired device. This simplifies user operation while ensuring the legality of control commands, thereby enabling secure and convenient wireless control of the air conditioning. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating the application of the encrypted token-based air conditioning control method provided in this embodiment of the invention to a WeChat mini-program.
[0012] Figure 2 A schematic diagram of a sub-process of the air conditioning control method based on encryption tokens provided in this embodiment of the invention applied to a WeChat mini-program.
[0013] Figure 3 A schematic diagram of a sub-process of the air conditioning control method based on encryption tokens provided in this embodiment of the invention applied to a WeChat mini-program.
[0014] Figure 4 A schematic diagram of a sub-process of the air conditioning control method based on encryption tokens provided in this embodiment of the invention applied to a WeChat mini-program.
[0015] Figure 5 A schematic diagram of a sub-process of the air conditioning control method based on encryption tokens provided in this embodiment of the invention applied to a WeChat mini-program.
[0016] Figure 6 A schematic diagram of a sub-process of the air conditioning control method based on encryption tokens provided in this embodiment of the invention applied to a WeChat mini-program.
[0017] Figure 7 A schematic diagram illustrating the process of applying the encrypted token-based air conditioning control method provided in this embodiment of the invention to an air conditioning device.
[0018] Figure 8 A schematic block diagram illustrating the application of the encrypted token-based air conditioning control device provided in this embodiment of the invention to a WeChat mini-program.
[0019] Figure 9 A schematic block diagram illustrating the application of the encrypted token-based air conditioning control device in an air conditioning equipment, as provided in an embodiment of the present invention.
[0020] Figure 10 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0021] 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.
[0022] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0023] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0024] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0025] Please see Figure 1 , Figure 1 This is a flowchart illustrating the air conditioner control method based on encrypted tokens provided in this embodiment of the invention. The air conditioner control method based on encrypted tokens in this embodiment can be applied to air conditioner control scenarios within WeChat mini-programs. When a user enters the mini-program and receives a dynamic broadcast packet from the air conditioner, they transmit their location and broadcast packet information to the cloud for authentication. Based on the authentication result, the air conditioner is controlled. This method ensures control security by using geographical location restrictions and broadcast packet information, effectively preventing malicious attacks and data reuse.
[0026] Figure 1 This is a flowchart illustrating the application of the air conditioning control method based on encrypted tokens provided in this embodiment of the invention to a WeChat mini-program. As shown in the figure, the method includes the following steps S110-S140.
[0027] S110. Receive and parse the broadcast packet sent by the air conditioning equipment to obtain the air conditioning location information, and determine the controllable air conditioning equipment based on the air conditioning location information.
[0028] In this embodiment, the broadcast packet is a message format with a small data volume. The air conditioning device actively sends broadcast packets containing specific information to the surrounding environment according to preset rules and frequencies. After the terminal device (such as a mobile phone) where the WeChat mini-program is located has its corresponding Bluetooth function enabled, the mobile phone's Bluetooth module will capture these broadcast signals and transmit them to the WeChat mini-program for processing. The WeChat mini-program receives and parses the broadcast packets sent by the air conditioning device to obtain the air conditioning location information. Specifically, according to the signed communication protocol and rules, the broadcast packet is decoded and analyzed to extract the air conditioning location information. The air conditioning location information is obtained and encapsulated by the air conditioning's built-in positioning module and can be represented by latitude and longitude coordinates (such as 39.9042°N, 116.4074°E). Based on the air conditioning location information, the controllable air conditioning device is determined. Specifically, after obtaining the air conditioning location information, the WeChat mini-program determines whether the location of the air conditioning device is within a certain range of the user's current location. If so, the air conditioning device is determined to be controllable, and the controllable air conditioning device is displayed on a preset display page for the user to select and control. By obtaining the location information of air conditioners to identify controllable air conditioning equipment, and by restricting access to the equipment by geographical location, the controller must be able to approach the equipment, thereby effectively preventing malicious attacks.
[0029] In one embodiment, such as Figure 2 As shown, step S110 further includes steps S111-S112.
[0030] S111. The distance between the air conditioner location information and the acquired terminal location information is calculated by distance calculation.
[0031] S112. Determine whether the location distance is within a preset distance range. If it is, determine that the air conditioning device is the controllable air conditioning device.
[0032] In this embodiment, the terminal positioning information is the location information of the terminal device using the WeChat mini-program, such as the location information of a mobile phone. This location information can be obtained through various positioning technologies such as GPS, Wi-Fi, and base stations, and can also be represented using latitude and longitude coordinates. The distance between the air conditioner location information and the obtained terminal positioning information is calculated. Specifically, the Havesing formula (a formula for calculating latitude and longitude coordinates based on spherical trigonometry) can be used to calculate the distance. Specific calculation methods are not given here; accurate calculation of the distance is sufficient. The preset distance range is a control distance determined by specific application scenarios or needs. For example, in a home environment, to ensure that users can conveniently control the air conditioner while avoiding accidental control of air conditioners in other rooms, the preset distance range can be set to 10 meters. The calculated distance d between the air conditioner location and the mobile phone location is compared with the preset distance range. If d is less than or equal to the maximum value of the preset distance range, the air conditioner is determined to be controllable; otherwise, the air conditioner is determined to be uncontrollable, and only controllable air conditioners are displayed on a preset display page. Specifically, the device's information (such as current status, location, etc.) can be displayed in a list of controllable air conditioners for user selection. By determining controllable air conditioners based on a preset distance range, users can select the target device they want to control while avoiding the risk of remote attacks on the air conditioner.
[0033] In one embodiment, such as Figure 3 As shown, step S112 is followed by steps S1121-S1122.
[0034] S1121. Determine whether the number of controllable air conditioning devices is greater than the preset number of devices;
[0035] S1122. If the number of controllable air conditioning devices is greater than the preset number of devices, the controllable air conditioning devices are sorted and displayed according to the corresponding location distance.
[0036] In this embodiment, the preset number of devices is a threshold set by the developer based on actual application scenarios and user experience requirements. In this embodiment, the preset number of devices is 1. After the WeChat mini-program determines the controllable air conditioning devices based on the air conditioner location information and mobile phone location information through distance calculation, it will count these controllable air conditioning devices to obtain the number of controllable air conditioning devices. The counted number of controllable air conditioning devices is compared with the preset number of devices. If the number of controllable air conditioning devices is less than or equal to the preset number of devices, the controllable air conditioning devices are directly displayed on the interface without sorting. If it is greater, the controllable air conditioning devices are sorted and displayed according to the corresponding location distance. Specifically, the sorting is based on the location distance between each controllable air conditioning device and the mobile phone. This location distance is obtained previously using the Havesing formula equal distance calculation method. The closer the distance, the closer the air conditioning device is to the user, and the greater the likelihood that the user will operate the device. Therefore, it should be displayed first in the sorting. For example, when there are three controllable air conditioning devices, device 1 is located at P1, device 2 at P2, device 3 at P3, and the mini-program is located at P. The distances between the mini-program and each device are: ΔP1 = |P - P1| = 8; ΔP2 = |P - P2| = 5; ΔP3 = |P - P3| = 9. The mini-program will then display device 2, device 1, and device 3. By sorting and displaying the controllable air conditioning devices according to their distances when the number of controllable devices exceeds the preset number, users can easily select the device they want to control.
[0037] In one embodiment, such as Figure 4 As shown, step S1122 further includes steps S11221-S11223.
[0038] S11221. Determine whether the difference in positional distance between the controllable air conditioning devices is less than a preset distinguishing distance;
[0039] S11222. If any of the phase difference values is less than the preset differentiation distance, a preset broadcast command is sent to the controllable air conditioning device.
[0040] S11223. Control the controllable air conditioning equipment to perform digital display according to the preset broadcast command.
[0041] In this embodiment, the preset distinguishing distance is the distance used to determine whether two adjacent controllable air conditioning devices are too close in location. The difference in the distance between the controllable air conditioning devices is determined to be less than the preset distinguishing distance. Specifically, the differences between ΔP1, ΔP2, and ΔP3 are determined based on the above to see if they are less than the preset distinguishing distance. If the preset distinguishing distance is 4 meters, then |ΔP1-ΔP2|<4, indicating that the two devices are too close. The user may not be able to accurately determine which device they want to control based on location information. Therefore, a preset broadcast command is sent to the controllable air conditioning devices. This preset broadcast command includes a unique identifier and a numerical display command code. The specific broadcast command is not limited because when an air conditioning device receives the preset broadcast command, it triggers a numerical display operation. For example, Bluetooth sends the command to devices 1, 2, and 3. After receiving the command, devices 1, 2, and 3 display the numbers "1", "2", and "3" on their respective displays. In this way, when users open the WeChat mini-program to view the list of controllable air conditioning devices, they can distinguish between two nearby air conditioning devices based on the numbers displayed, thus more accurately selecting the device they want to control. By determining whether the distance between controllable air conditioning devices is preset to differentiate them, and by displaying the numbers for each device, users can quickly find the air conditioning device they want to control even when multiple devices are present.
[0042] S120. Determine whether the target broadcast packet of the target controlled air conditioning device is within a preset time limit through the cloud server, wherein the target controlled air conditioning device is selected by the user from the controllable air conditioning devices.
[0043] In this embodiment, the WeChat mini-program determines whether the target broadcast packet for the air conditioning device is within a preset time limit through a cloud server. Specifically, when a user selects the desired controllable air conditioning device from the controllable devices displayed on the preset display page, the WeChat mini-program receives the broadcast packet for the target air conditioning device as the target broadcast packet and sends it to the cloud server. The cloud server parses the target broadcast packet, obtains its generation time, and determines whether it is within the preset time limit based on the time. For example, if its generation time is "2024-07-10 10:00:00", the preset time limit is 60 seconds, and the current server system time is "2024-07-10 10:00:45", the calculated time difference is 45 seconds. Since 45 seconds is less than the preset 60-second time limit, the server determines that the target broadcast packet is valid and sends feedback information to the mini-program, informing it that the broadcast packet is valid. Otherwise, it will report that the broadcast packet has expired, and the mini-program will re-obtain a new broadcast packet to ensure the accuracy of the control operation. The real-time nature of the control is ensured by determining whether the broadcast packet is within a preset time limit.
[0044] In one embodiment, such as Figure 5 As shown, step S120 further includes steps S121-S122.
[0045] S121. Parse the target broadcast packet to obtain the encryption token of the air conditioning device;
[0046] S122. Obtain the generation timestamp of the encryption token through the cloud server, and determine whether the generation timestamp is within a preset time limit. If it is, the target broadcast packet is within the preset time limit.
[0047] In this embodiment, the air conditioning device generates a one-time encrypted token at preset intervals (e.g., every minute) and sends it via Bluetooth broadcast packets. The encrypted token also includes the air conditioning device ID, a generation timestamp (accurate to the second), and a device key. The WeChat mini-program parses the target broadcast packet according to a preset communication protocol to obtain the encrypted token of the air conditioning device. For example, the encrypted token can be represented as: Token = HMAC-SHA256(Device_ID+Timestamp+Secret_Key), where HMAC-SHA256 is the encryption algorithm, Device_ID is the device ID, Timestamp is the generation timestamp, and Secret_Key is the device key. The token is uploaded to a cloud server. The cloud server obtains the corresponding generation timestamp based on the encrypted token and determines whether the generation timestamp is within a preset validity period based on the current server time. For example, the server queries the database and finds that the generation timestamp of token "TOKEN_A1B2C3" is "2024-07-10 10:02:00". The current server system time is "2024-07-10 10:02:30", and the calculated time difference is 30 seconds. Since 30 seconds is less than the 60-second validity period, the server determines the broadcast packet is valid. The server sends a confirmation message to the mini-program that the broadcast packet is valid, and the mini-program allows the user to perform control operations such as temperature adjustment on the air conditioner. After verifying the encrypted token and entering the control page for the air conditioner, the encrypted token will be automatically received and updated periodically. As long as the user does not exit the control page, the token will be automatically replaced without repeated verification. By verifying the received broadcast packet information based on the timestamp of the encrypted token, the real-time control is ensured while simplifying the user's operation.
[0048] S130. If the target broadcast packet is within the preset time limit, the acquired user information is associated with the device information in the target broadcast packet to complete the pairing.
[0049] In this embodiment, the user information refers to the account information authorized by the user when logging into the mini-program, such as user ID and nickname. The target broadcast packet contains device information, such as device ID, device key, and location. The acquired user information is associated with the device information in the target broadcast packet. Specifically, a relationship is established between the two based on the unique identifiers in the user information and device information. For example, the user ID is bound to the device ID to form an association record. This association record can be stored in a database for subsequent querying and management. The relationship between user ID and device ID is one-to-many, meaning one user may correspond to multiple devices. When the user information and device information are successfully associated, a successful pairing feedback message is generated. This message may include a successful pairing prompt, the paired device name, device ID, etc., and the user can modify the air conditioner device's notes in the mini-program for quick future retrieval. By associating the acquired user information with the device information in the target broadcast packet, a dedicated connection is established between the user and the air conditioner device, enabling personalized control and management of the device, and facilitating the recording of user operating habits and device usage preferences, thus providing users with better service.
[0050] In one embodiment, such as Figure 6 As shown, step S130 includes steps S131-S132.
[0051] S131. Determine whether the current control is temporary based on the user's selection information. If it is temporary, the target control air conditioning device can be directly controlled based on the encryption token.
[0052] S132. If the current control is not a temporary control, the user information and the device information are associated and stored, wherein the device information includes device ID, device key and location information.
[0053] In this embodiment, the device control interface of the WeChat mini-program provides users with control type selection options, including temporary control and long-term control. Users indicate their control intention by clicking a button. After receiving the user's selection information, a judgment is made according to preset rules. If the user selects temporary control, the temporary control process is entered; if the user selects long-term control, the non-temporary control process is entered. Specifically, if the user's selection information determines that the current control is temporary, the user information is not associated with or stored with the device information. The user directly enters the control page and generates an encrypted token based on the control command input by the user to control the target air conditioning device. If the current control is not temporary, i.e., long-term control, the user information is bound with the device information to establish an association record. This association record can be stored in the database of a cloud server or in the storage module of the local device; there is no limitation on this. By judging the user's control type to determine whether the current control is temporary, the user's device control needs in different scenarios can be met.
[0054] S140. The user control instruction is encrypted according to the encryption token in the target broadcast packet to obtain an encrypted control instruction, and the paired target control air conditioning device is controlled according to the encrypted control instruction.
[0055] In this embodiment, the encryption token is data generated by the air conditioning device and periodically sent via broadcast packets. For example, the generation process of the encryption token (Token) can be: Token = HMAC - SHA256(Device_ID + Timestamp + Secret_Key), where the specific parameter meanings are the same as those of the same parameters mentioned above, and will not be repeated here. The user control command is encrypted using the encryption token in the target broadcast packet. Specifically, after the timeliness verification is passed, the control command sent by the mini-program is encrypted using the Token to generate an encrypted control command. For example, the encryption method is: Ciphertext = AES-128(Token, "SetTemp = 26℃"), where AES-128 is the encryption algorithm, Token is the encryption token, and SetTemp = 26℃ is the control command input by the user. It should be noted that the generation timestamp in the Token is the time when the encrypted control command is generated. Upon receiving the command, the air conditioning device decrypts it using the currently valid Token and executes the control command. By encrypting control commands using the encryption token in the target broadcast packet, the target air conditioning equipment with the corresponding decryption capability can correctly interpret and execute the commands, preventing the commands from being maliciously tampered with or stolen during transmission, and ensuring the security and reliability of equipment control.
[0056] Figure 7This is a schematic diagram illustrating the application of the encrypted token-based air conditioning control method provided in this embodiment of the invention to an air conditioning device. As shown in the figure, the method includes the following steps S210-S230.
[0057] S210. At each preset generation time interval, an encryption token is generated according to a preset encryption algorithm, and a broadcast packet is generated according to the encryption token and device information.
[0058] In this embodiment, the preset encryption algorithm is a pre-set encryption algorithm, such as AES (Advanced Encryption Standard) or RSA (Asymmetric Encryption Algorithm). In this embodiment, the preset encryption algorithm is a message authentication code-based hash algorithm (HMAC-SHA256). An encryption token is generated according to the preset encryption algorithm at preset intervals. Specifically, the encryption token is generated as follows: Token = HMAC-SHA256(Device_ID + Timestamp + Secret_Key), where Token is the encryption token, HMAC-SHA256 is the message authentication code-based hash algorithm, Device_ID is the device ID, Timestamp is the generation timestamp, and Secret_Key is the device key, which is a root key preset in the air conditioner's security area. A broadcast packet is generated based on the encryption token and device information. Specifically, the encryption token and other device information, such as the device's location information, are packaged together to generate the broadcast packet. The air conditioner periodically generates broadcast packets containing encrypted information so that other devices or systems can discover and identify the air conditioner, while ensuring the information in the broadcast packet has a certain level of security to prevent malicious tampering or theft.
[0059] S220. Broadcast the broadcast packet using a preset sending method.
[0060] In this embodiment, the preset transmission method is a preset broadcast packet transmission method, specifically Bluetooth broadcasting. Bluetooth is a short-range wireless communication technology characterized by low power consumption and low cost. Bluetooth broadcasting is suitable for device discovery and information transmission within a relatively small area (such as a single room or office). The broadcast packet is broadcast using the preset transmission method. Specifically, Bluetooth broadcasting parameters, such as broadcast interval and broadcast power, are set. The broadcast interval determines the frequency at which the device sends broadcast packets, while the broadcast power affects the coverage area. For example, setting the broadcast interval to 100ms and the broadcast power to -20dBm reduces power consumption while ensuring a certain coverage area. The broadcast function of the Bluetooth module is called to begin sending broadcast packets. The air conditioning device will periodically send broadcast packets according to the set parameters, waiting for other Bluetooth devices to discover and connect. By broadcasting the broadcast packet using the preset transmission method, other devices can discover and connect, thereby completing the control of the air conditioning device.
[0061] S230. Receive encrypted control instructions sent from the WeChat mini-program and control the operation of the air conditioning equipment according to the encrypted control instructions.
[0062] In this embodiment, the WeChat mini-program encrypts the control commands before sending them over the network. The air conditioning unit continuously monitors the network; upon receiving a data packet from the WeChat mini-program, it extracts the encrypted control commands. After receiving the encrypted control commands, it decrypts them using a pre-agreed decryption algorithm, key, and encryption token to obtain the original control commands, such as setting the temperature to 26 degrees Celsius or switching to cooling mode. The air conditioning unit's control system interprets these commands and adjusts its operating status accordingly. For example, if the command is "increase the temperature by 2°C," the control system will control the compressor, fan, and other components to raise the air outlet temperature accordingly, thus operating as required by the mini-program. By receiving encrypted control commands from the WeChat mini-program, the air conditioning unit can be controlled remotely, achieving convenient, secure, and precise operation.
[0063] Corresponding to the above-described air conditioning control method based on encrypted tokens, the present invention also provides an air conditioning control device based on encrypted tokens. This device includes a unit for executing the aforementioned air conditioning control method based on encrypted tokens, and can be configured in terminals such as desktop computers, tablet computers, and laptops. Figure 8 This is a schematic block diagram 300 illustrating an air conditioning control device based on an encryption token applied to a WeChat mini-program, as provided in an embodiment of the present invention. Figure 9This is a schematic block diagram 400 illustrating an air conditioning control device based on an encrypted token applied to an air conditioning equipment, as provided in an embodiment of the present invention.
[0064] like Figure 8 As shown, when the air conditioning control device based on the encryption token is applied to the WeChat mini program, it includes a receiving unit 310, a judging unit 320, a pairing unit 330, and an encryption unit 340.
[0065] The receiving unit 310 is used to receive and parse the broadcast packets issued by the air conditioning equipment to obtain the air conditioning location information, and determine the controllable air conditioning equipment based on the air conditioning location information.
[0066] In one embodiment, the receiving unit 310 includes a position calculation unit and a position determination unit.
[0067] The location calculation unit is used to calculate the location distance between the air conditioner location information and the acquired terminal location information through distance calculation.
[0068] The location determination unit is used to determine whether the location distance is within a preset distance range. If it is, the air conditioning device is determined to be the controllable air conditioning device.
[0069] In one embodiment, the receiving unit 310 includes a quantity determination unit and a device sorting unit.
[0070] A quantity determination unit is used to determine whether the number of controllable air conditioning devices is greater than the preset number of devices;
[0071] The device sorting unit is used to sort and display the controllable air conditioning devices according to the corresponding location distance if the number of controllable air conditioning devices is greater than the preset number of devices.
[0072] In one embodiment, the receiving unit 310 includes a difference judgment unit, an instruction sending unit, and a digital display unit.
[0073] The difference judgment unit is used to determine whether the difference in positional distance between the controllable air conditioning devices is less than a preset distinguishing distance;
[0074] The instruction sending unit is configured to send a preset broadcast instruction to the controllable air conditioning device if any of the phase differences is less than the preset distinguishing distance.
[0075] A digital display unit is used to control the controllable air conditioning equipment to perform digital display according to the preset broadcast instructions.
[0076] The judgment unit 320 is used to determine, via a cloud server, whether the target broadcast packet of the target controlled air conditioning device is within a preset time limit, wherein the target controlled air conditioning device is selected by the user from the controllable air conditioning devices.
[0077] In one embodiment, the judgment unit 320 includes a parsing unit and a time judgment unit.
[0078] The parsing unit is used to parse the target broadcast packet to obtain the encryption token of the air conditioning device;
[0079] The time determination unit is used to obtain the generation timestamp of the encryption token through the cloud server, determine whether the generation timestamp is within a preset time limit, and if it is, the target broadcast packet is within the preset time limit.
[0080] The pairing unit 330 is used to associate the acquired user information with the device information in the target broadcast packet if the target broadcast packet is within the preset time range, so as to complete the pairing.
[0081] In one embodiment, the pairing unit 330 includes a control judgment unit and an association unit.
[0082] The control judgment unit is used to determine whether the current control is temporary based on the user's selection information. If it is temporary, the target control air conditioning equipment can be directly controlled based on the encryption token.
[0083] The association unit is used to associate and store the user information with the device information if the current control is not temporary control, wherein the device information includes device ID, device key and location information.
[0084] The encryption unit 340 is used to encrypt the user control instruction according to the encryption token in the target broadcast packet to obtain an encrypted control instruction, and to control the paired target control air conditioning device according to the encrypted control instruction.
[0085] like Figure 9 As shown, the air conditioning control device based on encryption tokens, when applied to the air conditioning equipment, includes an encryption generation unit 410, a broadcast unit 420, and an operation control unit 430.
[0086] The encryption generation unit 410 is used to generate an encryption token according to a preset encryption algorithm at preset generation intervals, and to generate a broadcast packet according to the encryption token and device information.
[0087] Broadcast unit 420 is used to broadcast the broadcast packet using a preset transmission method;
[0088] The operation control unit 430 is used to receive encrypted control commands sent from the WeChat mini program and control the operation of the air conditioning equipment according to the encrypted control commands.
[0089] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned air conditioning control devices 300, 400 and each unit based on encrypted tokens can be referred to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity, they will not be repeated here.
[0090] The aforementioned air conditioning control device based on encrypted tokens can be implemented as a computer program, which can, for example... Figure 10 It runs on the computer device shown.
[0091] Please see Figure 10 , Figure 10 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a terminal or a server. The terminal can be an electronic device with communication functions, such as a smartphone, tablet, laptop, desktop computer, personal digital assistant, or wearable device. The server can be a standalone server or a server cluster composed of multiple servers.
[0092] See Figure 10 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.
[0093] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform a composite laser printing method.
[0094] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.
[0095] The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an air conditioning control method based on a cryptographic token.
[0096] This network interface 505 is used for network communication with other devices. Those skilled in the art will understand that... Figure 10The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0097] The processor 502 is used to run a computer program 5032 stored in a memory to implement the steps of the above method.
[0098] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0099] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0100] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the steps of the method described above.
[0101] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0102] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0103] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0104] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0105] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0106] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An air conditioning control method based on encrypted tokens, characterized in that, The method is applied to WeChat Mini Programs, and the method includes: The system receives and parses broadcast packets from an air conditioning device to obtain its location information. The encrypted token in the broadcast packet is generated by the air conditioning device at preset intervals using a preset encryption algorithm. The encrypted token includes a device ID, a generation timestamp, and a device key. The system determines a controllable air conditioning device based on the location information, including: calculating the distance between the air conditioning location information and the acquired terminal location information using the Havesing formula; determining whether the distance is less than or equal to the maximum value of a preset distance range; if it is less than or equal to, then the air conditioning device is determined to be the controllable air conditioning device. The cloud server determines whether the target broadcast packet of the target air conditioning device is within a preset time limit, wherein the target air conditioning device is selected by the user from the controllable air conditioning devices; the step of determining whether the target broadcast packet of the target air conditioning device is within the preset time limit includes: parsing the target broadcast packet to obtain the encryption token of the target air conditioning device; obtaining the generation timestamp of the encryption token through the cloud server, and determining whether the generation timestamp is within the preset time limit; if it is, then the target broadcast packet is within the preset time limit. If the target broadcast packet is within the preset time range, the acquired user information is associated with the device information in the target broadcast packet to complete the pairing. The user control command is encrypted using the encryption token in the target broadcast packet to obtain an encrypted control command, and the paired target control air conditioning device is controlled according to the encrypted control command.
2. The method according to claim 1, characterized in that, After determining the controllable air conditioning equipment based on the air conditioning location information, the following steps are included: Determine whether the number of controllable air conditioning devices is greater than the preset number of devices; If the number of controllable air conditioning devices is greater than the preset number of devices, the controllable air conditioning devices will be sorted and displayed according to the corresponding location distance.
3. The method according to claim 2, characterized in that, The step of sorting and displaying the controllable air conditioning devices according to the corresponding location distance includes: Determine whether the difference in positional distance between the controllable air conditioning devices is less than a preset distinguishing distance; If any of the phase differences is less than the preset distinguishing distance, a preset broadcast command is sent to the controllable air conditioning device; The controllable air conditioning equipment is controlled to perform digital display according to the preset broadcast command.
4. The method according to claim 1, characterized in that, The step of associating the acquired user information with the device information in the target broadcast packet includes: Based on the user's selection information, determine whether the current control is temporary. If it is temporary, directly control the target air conditioning device based on the encryption token. If the current control is not temporary, the user information and the device information are associated and stored, wherein the device information includes device ID, device key and location information.
5. The method according to claim 1, characterized in that, The method is applied to air conditioning equipment that works with WeChat mini programs, and the method includes: At preset intervals, an encryption token is generated according to a preset encryption algorithm, and a broadcast packet is generated based on the encryption token and device information. The broadcast packet is broadcast using a preset sending method; Receive encrypted control commands sent from the WeChat mini program and control the operation of the air conditioning equipment according to the encrypted control commands.
6. An air conditioning control device based on an encrypted token, characterized in that, The air conditioning control device includes a WeChat mini-program terminal and an air conditioning equipment terminal, and includes a unit for performing the method as described in any one of claims 1-5.
7. A computer device, characterized in that, The computer device includes a memory and a processor connected to the memory; the memory is used to store a computer program; the processor is used to run the computer program stored in the memory to perform the steps of the method as described in any one of claims 1-5.
8. A storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Intelligent air conditioner near-field control system and method based on WeChat applet
CN114963454A
WeChat applet access control method and device, equipment and storage medium
CN117792785A
