Device control method and apparatus, electronic device, and computer-readable storage medium
By comparing and merging the control source identifiers of control commands and processing control commands for IoT devices under busy conditions, the problem of execution timeout and discarding of IoT devices in the case of multiple commands is solved, thereby improving the processing efficiency of the devices and the user experience.
Patent Information
- Application Number
- CN202310688650.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-06-09
AI Technical Summary
When IoT devices receive multiple control commands, they may not be able to process them in a timely manner, resulting in execution timeouts or the control commands being discarded by mistake.
The system compares the control source identifier of a new control command with the control source identifier in the current set of control commands to be executed by the IoT device. If they are different, the new control command is discarded. The same identifier is also compared in a busy state, and commands are merged when there is a correlation. Commands are added to the set to be executed when the system is not busy, and commands are processed according to priority.
It reduces the time it takes for control commands to be queued for execution, decreases the occurrence of execution timeouts and accidental discards, and improves the customer experience and the success rate of command execution.
Smart Images

Figure CN116614542B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a device control method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] The Internet of Things (IoT) is an extension and expansion of the Internet, forming a vast network that combines various information sensing devices with the network, enabling interconnection and interoperability of people, machines, and things anytime, anywhere.
[0003] During IoT interactions, there may be situations where multiple clients simultaneously and frequently issue control commands to the same IoT device.
[0004] When there are too many control commands, IoT devices may not be able to process multiple control commands in a timely manner, which may lead to serious timeouts in the execution of control commands or even the erroneous discarding of received control commands. Summary of the Invention
[0005] In view of the above, embodiments of this application provide a device control method, apparatus, electronic device, and computer-readable storage medium, which can alleviate the situation of control command execution timeout and reduce the situation of control command being accidentally discarded.
[0006] One embodiment of this application provides a device control method, including:
[0007] If a new control command for controlling an IoT device is received, the current set of control commands to be executed for the IoT device is obtained; the set of control commands to be executed is used to store the control commands to be executed for the IoT device.
[0008] Obtain the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed, wherein the control source identifier is the identity identifier corresponding to the control source;
[0009] The control source identifier of the control instruction to be executed in the set of control instructions to be executed is compared with the control source identifier of the new control instruction to determine whether there is a common control source identifier;
[0010] If there is no control source identifier in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, the new control instruction is discarded.
[0011] By adopting this technical solution, in the case where the control source of the new control command is different from the control source of the control command to be processed, the new control command is discarded and the control command from the newly added control source is no longer processed. This reduces the number of control commands that the Internet of Things currently needs to execute, reduces the queuing time for control commands, alleviates the situation of control command execution timeout, and reduces the situation of control commands being mistakenly discarded.
[0012] In some embodiments, before comparing the control source identifiers of the control instructions to be executed in the set of control instructions to be executed with the control source identifiers of the new control instruction to determine whether there are identical control source identifiers, the method further includes:
[0013] If the IoT device is detected to be not in a busy instruction processing state, the new control instruction is added to the set of control instructions to be executed;
[0014] The step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a duplicate control source identifier includes:
[0015] If the IoT device is detected to be in a busy instruction processing state, the step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction is performed to determine whether there is a common control source identifier.
[0016] This technical solution can alleviate timeout issues during busy instruction processing and, during less busy periods, ensure the execution of control instructions from various control sources, thereby improving the user experience.
[0017] In some embodiments, before comparing the control source identifiers of the control instructions to be executed in the set of control instructions to be executed with the control source identifiers of the new control instruction to determine whether there are identical control source identifiers, the method further includes:
[0018] If there is a target control instruction in the set of control instructions to be executed that is related to the new control instruction, the new control instruction and the target control instruction shall be merged.
[0019] The step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a duplicate control source identifier includes:
[0020] If there is no target control instruction having an association relationship with the new control instruction in the set of to-be-executed control instructions, the step of comparing the control source identifier of the to-be-executed control instruction in the set of to-be-executed control instructions with the control source identifier of the new control instruction to determine whether there is the same control source identifier is performed.
[0021] By adopting the technical scheme, the same operation of the Internet of Things device is repeatedly executed.
[0022] In some embodiments, the association relationship includes a containing relationship, if there is a target control instruction having an association relationship with the new control instruction in the set of to-be-executed control instructions, the new control instruction is merged with the target control instruction, including:
[0023] If there is a to-be-executed control operation having a containing relationship with the new control operation indicated by the new control instruction in the to-be-executed control operation indicated by the set of to-be-executed control instructions;
[0024] The to-be-executed control instruction corresponding to the to-be-executed control operation having the containing relationship is taken as the target control instruction.
[0025] The new control instruction is merged with the target control instruction.
[0026] In some embodiments, the new control instruction is merged with the target control instruction, including:
[0027] If the new control operation indicated by the new control instruction contains the to-be-executed control operation indicated by the target control instruction, the new control operation is taken as the control operation indicated by the merged control instruction.
[0028] If the to-be-executed control operation indicated by the target control instruction contains the new control operation indicated by the new control instruction, the to-be-executed control operation indicated by the target control instruction is taken as the control operation indicated by the merged control instruction.
[0029] The control source identifier of the new control instruction and the control source identifier of the target control instruction are taken as the control source identifier corresponding to the merged control instruction.
[0030] In some embodiments, if there is the same control source identifier in the control source identifier of the to-be-executed control instruction in the set of to-be-executed control instructions and the control source identifier of the new control instruction, the new control instruction is added to the set of to-be-executed control instructions to obtain an updated set of to-be-executed control instructions; the priority of each to-be-executed control instruction in the updated set of to-be-executed control instructions is determined; and the Internet of Things device processes the each to-be-executed control instruction based on the order from high to low of the priority of the each to-be-executed control instruction.
[0031] By adopting the technical scheme, the Internet of Things device can execute the control instruction issued by the control source in the set of to-be-executed control instructions smoothly, and the customer experience can be improved by setting the processing priority.
[0032] In some embodiments, after the new control instruction is discarded, the method further includes:
[0033] sending a discard message of the new control instruction to the control source of the new control instruction;
[0034] After the Internet of Things device processes the to-be-executed control instructions in the order from high to low based on the priority of the to-be-executed control instructions, the method includes:
[0035] transmitting the execution result of the to-be-executed control instructions to the control source corresponding to the to-be-executed control instructions.
[0036] By adopting the technical scheme, the execution result of the control instruction is transmitted to the control source, and the user can obtain the execution of the control instruction.
[0037] An embodiment of the present application provides a device control apparatus, which includes:
[0038] a receiving module, configured to acquire a set of to-be-executed control instructions of an Internet of Things device if a new control instruction for controlling the Internet of Things device is received, the set of to-be-executed control instructions being used to store the to-be-executed control instructions of the Internet of Things device;
[0039] a recognition module, configured to acquire a control source identifier of the new control instruction and a control source identifier of the to-be-executed control instructions, the control source identifier being an identity identifier corresponding to a control source;
[0040] a detection module, configured to compare the control source identifier of the to-be-executed control instructions in the set of to-be-executed control instructions with the control source identifier of the new control instruction, and determine whether there is a same control source identifier;
[0041] a judgment module, configured to discard the new control instruction if there is no same control source identifier as the control source identifier of the new control instruction in the control source identifier of the to-be-executed control instructions in the set of to-be-executed control instructions.
[0042] An embodiment of the present application provides an electronic device, which includes a processor and a memory, the memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the device control method.
[0043] An embodiment of the present application provides a computer readable storage medium storing computer instructions, which, when executed on an electronic device, cause the electronic device to perform the device control method. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 is a scene schematic diagram of a device control system according to an embodiment of the present application;
[0045] Figure 2 is a flowchart of a device control method according to an embodiment of the present application;
[0046] Figure 3 is a flowchart of a device control method including an instruction processing busy detection step according to another embodiment of the present application;
[0047] Figure 4 is a flowchart of a device control method including an instruction association relationship detection step according to another embodiment of the present application;
[0048] Figure 5 is a flowchart of a device control method including an instruction processing busy detection and an instruction association relationship step according to another embodiment of the present application;
[0049] Figure 6 is a structural schematic diagram of a device control apparatus according to an embodiment of the present application;
[0050] Figure 7 is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to more clearly understand the above objectives, features and advantages of the present application, the present application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0052] In the following description, many specific details are set forth in order to fully understand the present application. The described embodiments are merely a part of the embodiments of the present application, and are not all the embodiments.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used in the specification of the present application are only for the purpose of describing the specific embodiments of the present application, and are not intended to limit the present application.
[0054] It is further noted that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0055] "at least one" means one or more, "multiple" means two or more than two. "And / or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and / or B can represent: A exists alone, A and B exist together, B exists alone, where A, B can be singular or plural. The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0056] In the embodiments of the present application, the words such as "exemplary" or "for example" are used to mean an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words such as "exemplary" or "for example" are used in the specific manner to present the relevant concept.
[0057] The embodiments of the present application provide a device control method and device, electronic device and computer readable storage medium, which are described below respectively.
[0058] Please refer to Figure 1 As shown in the figure, Figure 1 The scene schematic diagram of the device control system provided by an embodiment of the present application is shown. The device control system can include a device control device, the device control device can execute the device control method of the embodiments of the present application, and the device control device can be integrated into an electronic device, such as a message forwarding device or an Internet of Things device.
[0059] The message forwarding device can be used to forward the control instruction from the control source to the Internet of Things device, and the message forwarding device can be a gateway, a WIFI device, etc. The control source can be used to generate the control instruction for controlling the Internet of Things device. The Internet of Things device can be a lamp, an air conditioner, a curtain, a water heater, etc. supporting the Internet of Things, but is not limited thereto.
[0060] In the device control system, the Internet of Things device can be connected with the control source through the message forwarding device, or can be directly connected with the control source.
[0061] For the Internet of Things device without the connection of the message forwarding device, the device control apparatus can be integrated in the Internet of Things device.
[0062] For the Internet of Things device, such as the ZigBee device, which needs the connection of the gateway, the device control apparatus can be integrated in the gateway; for the Internet of Things device which needs the connection of the WIFI device, the device control apparatus can also be integrated in the WIFI device. In the above cases, the device control apparatus does not need to be integrated in each Internet of Things device, thereby saving the computer resources of the Internet of Things device.
[0063] The electronic device integrated with the device control apparatus in the embodiment of the present application can be used to, if a new control instruction for controlling the Internet of Things device is received, acquire a set of to-be-executed control instructions of the Internet of Things device at present; the set of to-be-executed control instructions is used to store the to-be-executed control instructions of the Internet of Things device.
[0064] The control source identifier of the new control instruction and the control source identifier of the to-be-executed control instruction are acquired, and the control source identifier is the identity identifier corresponding to the control source.
[0065] The control source identifiers of the to-be-executed control instructions in the set of to-be-executed control instructions are compared with the control source identifier of the new control instruction, and it is determined whether there is the same control source identifier.
[0066] If there is no control source identifier which is the same as the control source identifier of the new control instruction in the control source identifiers of the to-be-executed control instructions in the set of to-be-executed control instructions, the new control instruction is discarded.
[0067] In the embodiment of the present application, if the new control instruction is received and it is determined that the control source identifier of the new control instruction is different from the control source identifier of the to-be-processed control instruction, the new control instruction is discarded, and the control instruction issued by the new control source is no longer processed, thereby the control instructions which need to be executed at present by the Internet of Things can be reduced, the time length of the queuing execution of the control instruction can be reduced, the situation that the control instruction execution is timed out can be alleviated, and the situation that the control instruction is mistakenly discarded can be reduced.
[0068] The device control method of the present application can be applied to one or more electronic devices. The electronic device is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and the hardware thereof includes but is not limited to a processor, a microprogrammed control unit (MCU), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc. The electronic device can be a portable electronic device (such as a mobile phone, a tablet computer), a personal computer, a server, etc.
[0069] Figure 2 FIG. 1 is a flowchart of an embodiment of the device control method of the present application. The order of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted.
[0070] Referring to FIG. 1, the device control method can include the following steps. Figure 2
[0071] In step 201, if a new control instruction for controlling the Internet of Things device is received, the current set of control instructions to be executed by the Internet of Things device is obtained.
[0072] The Internet of Things device can be a dimmable lamp, a color temperature lamp, an RGB lamp, a curtain, a sound system, etc., but is not limited thereto.
[0073] The new control instruction can be a control instruction newly received by the Internet of Things device and not yet stored in the set of control instructions to be executed.
[0074] The control instruction can represent a control operation of a control source on the Internet of Things device.
[0075] The control operation can be an operation performed by the Internet of Things device, such as increasing the volume of a sound system or raising the temperature of an air conditioner, but is not limited thereto.
[0076] The control source can be a device that generates a control instruction, such as a mobile phone, a switch, a tablet, etc., but is not limited thereto.
[0077] The set of control instructions to be executed is used to store the control instructions to be executed by the Internet of Things device. The data organization method in the set of control instructions to be executed can be a queue, but is not limited thereto. The control instruction to be executed is a control instruction that needs to be executed by the Internet of Things device but has not yet been executed.
[0078] In the case that the device control apparatus is integrated in the Internet of Things device, the Internet of Things device can take the control instruction to be executed from the set of control instructions to be executed and execute the control operation of the control instruction, and transmit the execution result to the control source.
[0079] In the case that the device control apparatus is integrated in the message forwarding device, the message forwarding device can take the control instruction to be executed from the set of control instructions to be executed and forward the control instruction to be executed to the corresponding control source. After the control source executes the operation of the control instruction to be executed, the control source can generate the execution result of the control instruction to be executed and transmit the execution result to the message forwarding device. The message forwarding device transmits the execution result to the corresponding control source.
[0080] In step 202, the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed are obtained.
[0081] The control source identifier is the identity of the control source, and one control source can be uniquely determined by the control source identifier.
[0082] The control source identifier of the new control instruction is the identifier of the device that generates the new control instruction, and the control source identifier of the control instruction to be executed is the identifier corresponding to the device that generates each control instruction to be executed in the set of control instructions to be executed.
[0083] The electronic device can be integrated with the function of control source identification, that is, the electronic device can parse the control instruction to obtain the control source identifier.
[0084] In step 203, the control source identifier of the control instruction to be executed in the set of control instructions to be executed is compared with the control source identifier of the new control instruction to determine whether there is the same control source identifier.
[0085] If the control source identifier of the new control instruction is different from the control source identifier of each control instruction to be executed in the set of control instructions to be executed, that is, there is no control source identifier that is the same as the control source identifier of the new control instruction in the control source identifier of the control instruction to be executed in the set of control instructions to be executed, it indicates that there is a new control source (a control source other than the control source corresponding to each control instruction to be executed) controlling the Internet of Things device. The electronic device can execute step 204 to make the Internet of Things device not process the control instruction from the new control source, thereby alleviating the instruction congestion situation.
[0086] In step 204, the new control instruction is discarded.
[0087] In some embodiments, after the new control instruction is discarded, a discard message of the new control instruction is sent to the first control source.
[0088] After the new control instruction is discarded, the Internet of Things device will not execute the new control instruction.
[0089] In some embodiments, if it is determined in step 203 that there is a control source identifier same as the control source identifier of the new control instruction in the control source identifiers of the to-be-executed control instructions in the set of to-be-executed control instructions, it indicates that the control source corresponding to each to-be-executed control instruction generates the new control instruction, and there is no new control source controlling the Internet of Things device, step 205 can be performed.
[0090] In step 205, the new control instruction is added to the set of to-be-executed control instructions to obtain an updated set of to-be-executed control instructions.
[0091] Step 205 can enable the Internet of Things device to smoothly execute the control instructions generated by the control source corresponding to each to-be-executed control instruction. In actual application, whether the electronic device is provided with the execution logic of step 205 can be set based on actual application requirements, and the embodiments of the present application do not limit this.
[0092] In some embodiments, after step 205, the method can further include determining the priority of each to-be-executed control instruction in the updated set of to-be-executed control instructions, and controlling the Internet of Things device to process the to-be-executed control instructions in a descending order of the priority of each to-be-executed control instruction.
[0093] In the case where the data organization manner of the set of to-be-executed control instructions is a queue, the queue adopts a first-in-first-out manner, in which the to-be-executed control instruction stored first in the set of to-be-executed control instructions is preferentially taken out and executed. That is, in this manner, the priority of each to-be-executed control instruction is determined according to the time order of storage, and the earlier the time, the higher the priority of processing the to-be-executed control instruction.
[0094] The priority can also be set according to actual requirements. For example, the priority can be set according to the control operation of the to-be-executed control instruction, such as setting the switching operation as the highest priority and other operations as the lowest priority. For another example, the priority can be set according to the control source, such as setting the mobile phone terminal as the first priority and the tablet terminal as the second priority, and the embodiments of the present application do not limit this.
[0095] After the execution of the to-be-executed control instruction is completed, the execution result of the to-be-executed control instruction can be transmitted to the control source corresponding to each to-be-executed control instruction.
[0096] In the above embodiments, in the case where the control source of the new control instruction is different from the control source of the to-be-processed control instruction, the new control instruction is discarded, so that the control instruction of the new control source is no longer processed, the current control instructions of the Internet of Things that need to be executed are reduced, the time length of the control instruction queue execution is reduced, and the timeout condition of the control instruction execution is reduced. In addition, the control source corresponding to each to-be-executed control instruction in the set of to-be-processed control instructions can normally and smoothly control the Internet of Things device.
[0097] However, if the new control instruction is discarded in the case that the control source identifier of the new control instruction is the same as the control source identifier of the control instruction to be processed, the Internet of Things device can be difficult to process the control instruction from the newly added control source, and the control requirements of each control source cannot be met.
[0098] In view of this, the embodiments of the present application also provide a device control method, as shown in Figure 3 The device control method can include:
[0099] Step 301, if a new control instruction for controlling the Internet of Things device is received, obtaining a current set of control instructions to be executed of the Internet of Things device.
[0100] Step 301 is substantially the same as step 201, which will not be described here.
[0101] Step 302, monitoring whether the Internet of Things device is in an instruction processing busy state.
[0102] If it is monitored that the Internet of Things device is in an instruction processing busy state, step 303 is performed; if it is monitored that the Internet of Things device is not in an instruction processing busy state, step 306 is performed.
[0103] The monitoring of whether the Internet of Things device is in an instruction processing busy state can include: monitoring whether there are a preset number of control instructions to be executed that have timed out, if there are a preset number of control instructions to be executed that have timed out, it indicates that the Internet of Things device is in an instruction processing busy state, and if there are less than a preset number of control instructions to be executed that have timed out, it indicates that the Internet of Things device is not in an instruction processing busy state.
[0104] For another example, the monitoring of whether the Internet of Things device is in an instruction processing busy state can include: detecting whether the number of control instructions to be executed in the set of control instructions to be executed exceeds a preset number, if the number of control instructions to be executed exceeds a preset number, it indicates that the Internet of Things device is in an instruction processing busy state, and if the number of control instructions to be executed is less than a preset number, it indicates that the Internet of Things device is not in an instruction processing busy state.
[0105] For another example, the monitoring of whether the Internet of Things device is in an instruction processing busy state can include: monitoring whether the number of control instructions to be executed received by the Internet of Things device in a preset time period exceeds a preset number.
[0106] The monitoring of whether the Internet of Things device is in an instruction processing busy state is not limited to the above examples, and in actual application, the determination condition of the Internet of Things device being in an instruction processing busy state can be set according to requirements.
[0107] If the Internet of Things device is in an instruction processing busy state, step 303 is performed.
[0108] In step 303, the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed are obtained.
[0109] In step 304, the control source identifier of the control instruction to be executed in the set of control instructions to be executed is compared with the control source identifier of the new control instruction to determine whether there is a same control source identifier.
[0110] If there is no same control source identifier in the control source identifier of the control instruction to be executed in the set of control instructions to be executed, step 305 can be performed.
[0111] If there is a same control source identifier in the control source identifier of the control instruction to be executed in the set of control instructions to be executed, step 306 can be performed.
[0112] In step 305, the new control instruction is discarded.
[0113] In step 306, the new control instruction is added to the set of control instructions to be executed.
[0114] Steps 303 to 306 are substantially the same as steps 202 to 205, which will not be described here.
[0115] The embodiment can relieve the timeout phenomenon of instruction execution when the Internet of Things instruction processing is busy, and can ensure the execution of control instructions from various control sources as much as possible when the Internet of Things instruction processing is not busy, thereby improving customer experience.
[0116] In the above embodiment, if there is a same control source identifier in the control source identifier of the control instruction to be executed in the set of control instructions to be executed, the new control instruction is taken as the control instruction to be executed, so that the Internet of Things device executes the new control instruction, and this method may cause the Internet of Things device to repeatedly execute the same control operation.
[0117] For example, there is a control instruction "device brightness up 50%" in the set of control instructions to be executed, and the control operation of the new control instruction is "device brightness up 50%", which may cause the Internet of Things device to repeatedly execute the control instruction, and the processing efficiency of the Internet of Things device is reduced.
[0118] Therefore, the embodiment of the present application further provides a device control method, as shown in Figure 4 The device control method comprises the following steps:
[0119] In step 401, if a new control instruction for controlling an Internet of Things device is received, a set of control instructions to be executed of the Internet of Things device is obtained.
[0120] Step 401 is substantially the same as step 201, which will not be described here.
[0121] Step 402, detecting whether there is a target control instruction having an association relationship with the new control instruction in the set of control instructions to be executed.
[0122] If there is no target control instruction, step 403 is executed; if there is a target control instruction, step 407 is executed.
[0123] The association relationship between the two control instructions indicates that the two control instructions can be combined.
[0124] If the two control instructions have an association relationship, the Internet of Things devices controlled by the two control instructions are the same. That is, the Internet of Things device controlled by the new control instruction is the same as the Internet of Things device controlled by the target control instruction.
[0125] The association relationship can be set according to actual needs.
[0126] For example, the association relationship can be set as the control operations corresponding to the two control instructions having the same sub-operation. For example, the control operation of a control instruction is to increase the light brightness by 20%, and the light is set to white light. The control operation of another control instruction is to turn on the light and increase the light brightness by 20%. Both control instructions have the sub-operation of "increasing the light brightness by 20%", and therefore, the two control instructions have an association relationship.
[0127] Further, the set association relationship can include any of the following:
[0128] (1) Equal relationship.
[0129] In the case where the association relationship includes the equal relationship, the new control instruction and the target control instruction having the association relationship need to satisfy the following situation: the target control operation corresponding to the target control instruction is consistent with the new control operation corresponding to the new control instruction.
[0130] Specifically, in the case where the association relationship includes the equal relationship, step 402 can include: detecting whether there is a to-be-executed control operation that is the same as the new control operation indicated by the new control instruction in the to-be-executed control operation indicated by the set of control instructions to be executed; if there is a to-be-executed control operation that is the same as the new control operation indicated by the new control instruction, the to-be-executed control instruction corresponding to the same to-be-executed control operation is taken as the target control instruction.
[0131] For example, the to-be-executed control operation 1 indicates that the temperature of air conditioner A is increased by two degrees, and the new control operation indicates that the temperature of air conditioner A is increased by two degrees. The to-be-executed control operation 1 has an equal relationship with the new control operation, and the to-be-executed control operation 1 is the target control instruction.
[0132] The embodiment can combine two instructions in the case that different control sources perform the same control operation on the same Internet of Things device, so that the different control sources can all receive the instruction execution result. Compared with directly discarding the new control instruction, the embodiment can improve the success rate of instruction execution presented to the user and improve the customer experience.
[0133] In addition, in the combining process, the control operation in the set of control instructions to be executed is not increased, that is, the operation to be executed of the Internet of Things device is not increased, so that the success rate of instruction execution presented to the user can be improved, the timeout and accidental discarding of the execution of the Internet of Things device instruction can be alleviated, the same operation of the Internet of Things device is avoided from being repeatedly executed, and the execution efficiency of the Internet of Things device is improved.
[0134] (2) One-way inclusion relationship.
[0135] In the case that the association relationship includes the inclusion relationship, the new control instruction and the target control instruction having the association relationship need to meet the following situations: the target control operation corresponding to the target control instruction truly includes the new control operation, or the target control operation is the same as the new control operation.
[0136] Specifically, in the case that the association relationship includes the one-way inclusion relationship, step 402 can include: detecting whether there is a to-be-executed control operation that includes the new control operation indicated by the new control instruction in the to-be-executed control operation indicated by the set of control instructions to be executed; if there is a to-be-executed control operation that includes the new control operation indicated by the new control instruction, taking the to-be-executed control instruction corresponding to the to-be-executed control operation having the inclusion relationship as the target control instruction.
[0137] For example, in the case that the association relationship includes the one-way inclusion relationship, if the new control operation indicates turning on the light and the light source is set to white, the to-be-executed control operation 1 corresponding to the to-be-executed control instruction 1 indicates that the light source is set to white, which represents that the to-be-executed control instruction 1 has no association relationship with the new control instruction; if the new control operation indicates turning on the light, the to-be-executed control operation 2 corresponding to the to-be-executed control instruction 2 indicates turning on the light and the light source is set to white, and the to-be-executed control operation 2 truly includes the new control operation, which represents that the to-be-executed control instruction 2 has an association relationship with the new control instruction.
[0138] In the case that the control operation of the to-be-executed control instruction includes the control operation of the new control instruction, the to-be-executed control instruction and the new control instruction can be combined in the embodiment, so that the Internet of Things device can return the execution result of the new control operation corresponding to the new control instruction to the corresponding control source. Compared with the association relationship including the equality relationship, the success rate of instruction execution presented to the user can be further improved, and the customer experience can be further improved.
[0139] In addition, in the merging process, the control operation in the set of to-be-executed control instructions is not increased, that is, the to-be-executed operation of the Internet of Things device is not increased, so that the success rate of instruction execution presented to the user is improved, and the timeout and misdiscard of the Internet of Things device instruction execution are alleviated.
[0140] (3) Inclusion relationship.
[0141] In the case where the association relationship includes the inclusion relationship, the new control instruction and the target control instruction having the association relationship need to satisfy the following cases: the new control operation truly includes the target control operation corresponding to the target control instruction, the target control operation truly includes the new control operation, or the new control operation is the same as the target control operation.
[0142] Specifically, in the case where the association relationship includes the inclusion relationship, step 402 can include: detecting whether there is a to-be-executed control operation having an inclusion relationship with the new control operation in the to-be-executed control operation indicated by the set of to-be-executed control instructions; if there is a to-be-executed control operation having an inclusion relationship with the new control operation, taking the to-be-executed control instruction corresponding to the to-be-executed control operation having the inclusion relationship as the target control instruction.
[0143] For example, if the new control operation indicates turning on the light and the light source is set to white, the to-be-executed control operation 1 corresponding to the to-be-executed control instruction 1 indicates setting the light source to white, so that the new control operation includes the to-be-executed control operation 1, indicating that the to-be-executed control instruction 1 and the new control instruction satisfy the inclusion relationship, and the two have an association relationship; if the new control operation indicates turning on the light, the to-be-executed control operation 2 corresponding to the to-be-executed control instruction 2 indicates turning on the light and setting the light source to white, so that the to-be-executed control instruction 2 includes the new control instruction, indicating that the to-be-executed control instruction 2 and the new control instruction satisfy the inclusion relationship, and the two have an association relationship; if the new control operation is the same as the to-be-executed control operation 1 corresponding to the to-be-executed control instruction 1, indicating that the to-be-executed control instruction 1 and the new control instruction satisfy the inclusion relationship, and the two have an association relationship.
[0144] In the case where the control operation of the to-be-executed control instruction includes the control operation of the new control instruction, or the control operation of the new control instruction includes the control operation of the to-be-executed control instruction, the two control operations can be merged in the embodiment, the success rate of instruction execution is improved, and by merging the operation, the control operation added in the set of to-be-executed control instructions can be reduced when there is a new control operation in the new control instruction, so as to alleviate the delay problem of control instruction execution as much as possible.
[0145] In the above equal relationship, one-way inclusion relationship, and inclusion relationship, the control instructions that can be merged increase in turn, so that the control instructions that are successfully executed increase in turn, and the alleviation effect of the delay problem of control instruction execution is smaller.
[0146] Therefore, the step 402 can include: acquiring the current instruction processing busy degree; determining the target association relationship according to the current instruction processing busy degree, and detecting whether there is a target control instruction having the target association relationship with the new control instruction in the set of to-be-executed control instructions.
[0147] For example, the instruction processing busy degree is divided into a high busy state, a medium busy state and a low busy state, the target association relationship of the high busy state is an equal relationship, the target association relationship of the medium busy state is a one-way containing relationship, and the target association relationship of the low busy state is a low busy state. The level corresponding to the instruction processing busy degree can be set according to requirements, which is not limited in the embodiment.
[0148] The embodiment can determine the new control instruction and the to-be-executed control instruction that can be combined according to the instruction processing busy degree of the Internet of Things device, which can better match the instruction processing state of the Internet of Things device, and can improve the success rate of control instruction execution on the basis of relieving the instruction processing delay.
[0149] In the case where there is no target control instruction having the association relationship with the new control instruction, the step 403 is executed.
[0150] The step 403 includes: acquiring the control source identifier of the new control instruction and the control source identifier of the to-be-executed control instruction.
[0151] The step 404 includes: comparing the control source identifier of the to-be-executed control instruction in the set of to-be-executed control instructions with the control source identifier of the new control instruction, and determining whether there is the same control source identifier.
[0152] If there is no control source identifier same as the control source identifier of the new control instruction in the control source identifier of the to-be-executed control instruction in the set of to-be-executed control instructions, the step 405 can be executed.
[0153] If there is the control source identifier same as the control source identifier of the new control instruction in the control source identifier of the to-be-executed control instruction in the set of to-be-executed control instructions, the step 406 can be executed.
[0154] The step 405 includes: discarding the new control instruction.
[0155] The step 406 includes: adding the new control instruction to the set of to-be-executed control instructions to obtain an updated set of to-be-executed control instructions.
[0156] The steps 403 to 406 are substantially the same as the steps 202 to 205, which will not be described herein.
[0157] The steps 403-406 are steps performed in the absence of the target control instruction. If there is a target control instruction associated with the new control instruction, step 407 is performed.
[0158] Step 407: merging the new control instruction and the target control instruction.
[0159] In some embodiments, step 407 can include adding the new control operation of the new control instruction and the target control operation of the target control instruction, and deduplicating, to obtain the control operation indicated by the merged control instruction.
[0160] For example, if the new control operation indicated by the new control instruction contains the control operation to be executed indicated by the target control instruction, the new control operation is taken as the control operation indicated by the merged control instruction.
[0161] If the control operation to be executed indicated by the target control instruction contains the new control operation indicated by the new control instruction, the control operation to be executed indicated by the target control instruction is taken as the control operation indicated by the merged control instruction.
[0162] In some embodiments, step 407 can further include taking the control source identifier of the new control instruction and the control source identifier of the target control instruction as the control source identifier corresponding to the merged control instruction.
[0163] The electronic device can store the merged control instruction in the set of control instructions to be executed, and discard the new control instruction.
[0164] The electronic device can execute each control instruction in the set of control instructions to be executed, and after the execution of the control instruction is completed, the execution result of the control instruction to be executed can be transmitted to the control source corresponding to the control instruction to be executed.
[0165] For example, after the instructions are merged, the control source corresponding to the target control instruction includes control source 1 and control source 2, and the execution result of the target control instruction can be transmitted to control source 1 and control source 2.
[0166] The embodiment can improve the success rate of execution of control instructions, improve the customer experience, and reduce the situation of multiple execution of the same control operation by the Internet of Things device in the case of relieving the timeout of instruction execution.
[0167] However, in the case where the two control instructions do not have an association relationship and the control source identifier of the new control instruction is different from the control source identifier of the control instruction to be processed, the new control instruction will still be discarded, which is difficult to meet the control requirements of each control source.
[0168] In view of this, the embodiment of the present application can combine Figure 3 and Figure 4The device control method is shown. In some embodiments, reference is made to Figure 5 The device control method is shown. In some embodiments, reference is made to
[0169] Step 501, if a new control instruction for controlling the Internet of Things device is received, obtain the current set of control instructions to be executed of the Internet of Things device.
[0170] Step 501 is substantially the same as step 201, which will not be repeated here.
[0171] Step 502, monitor whether the Internet of Things device is in an instruction processing busy state.
[0172] If the Internet of Things device is in an instruction processing busy state, step 503 is executed; if the Internet of Things device is not in an instruction processing busy state, step 507 is executed, i.e. the new control instruction is added to the set of control instructions to be executed to obtain an updated set of control instructions to be executed.
[0173] Step 502 is substantially the same as step 302, which will not be repeated here.
[0174] Step 503, detect whether there is a target control instruction having an associated relationship with the new control instruction in the set of control instructions to be executed.
[0175] If there is no target control instruction having an associated relationship with the new control instruction, step 504 is executed; if there is a target control instruction having an associated relationship with the new control instruction, step 508 is executed.
[0176] Step 503 is substantially the same as step 402, which will not be repeated here.
[0177] Step 504, obtain the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed.
[0178] Step 505, compare the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a same control source identifier.
[0179] If there is no control source identifier in the control source identifier of the control instruction to be executed in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, step 506 is executed;
[0180] If there is a control source identifier in the control source identifier of the control instruction to be executed in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, step 507 is executed.
[0181] Step 506, discard the new control instruction.
[0182] Step 507, add the new control instruction into the set of control instructions to be executed, to obtain an updated set of control instructions to be executed.
[0183] Steps 504 to 507 are substantially the same as steps 202 to 205, and will not be described here.
[0184] Step 508, merge the new control instruction with the target control instruction.
[0185] Step 508 is substantially the same as step 407, and will not be described here.
[0186] In steps 501 to 508 described above, the electronic device first monitors whether the Internet of Things device is in a busy state, and then detects whether there is a target control instruction having an association relationship with the new control instruction in the set of control instructions to be executed, in the case of a busy state.
[0187] In other embodiments, the electronic device can first detect whether there is a target control instruction having an association relationship with the new control instruction in the set of control instructions to be executed; if there is a target control instruction having an association relationship with the new control instruction, merge the new control instruction with the target control instruction to avoid repeated execution of the same operation; if there is no target control instruction having an association relationship with the new control instruction, monitor whether the Internet of Things device is in a busy state, if it is in a busy state, enter the step of "comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is the same control source identifier", if it is not in a busy state, directly add the new control instruction into the set of control instructions to be executed.
[0188] The embodiment can alleviate the timeout phenomenon of instruction execution timeout when the Internet of Things instruction processing is busy, and can guarantee the execution of control instructions from various control sources as much as possible when the Internet of Things instruction processing is not busy. In addition, the execution success rate of the control instruction can be improved, the customer experience can be improved, and the execution efficiency of the Internet of Things device can be improved.
[0189] Based on the same idea as the device control method in the above embodiment, the application also provides a device control apparatus, which can be used to execute the device control method described above. For the convenience of description, only the part related to the embodiment of the application is shown in the structure diagram of the device control apparatus embodiment, and those skilled in the art can understand that the diagrammed structure does not constitute a limitation on the apparatus, which can include more or fewer components than the diagrammed, or combine certain components, or different component arrangements.
[0190] As Figure 6As shown, the device control apparatus comprises a receiving module 601, an identifying module 602, a detecting module 603 and a judging module 604. In some embodiments, the above modules can be programmable software instructions stored in the memory and executable by the processor. It can be understood that in other embodiments, the above modules can also be program instructions or firmware fixed in the processor.
[0191] The receiving module 601 is configured to, if a new control instruction for controlling an Internet of Things device is received, acquire a current set of to-be-executed control instructions of the Internet of Things device; the set of to-be-executed control instructions is used to store to-be-executed control instructions of the Internet of Things device.
[0192] The identifying module 602 is configured to acquire a control source identifier of the new control instruction and a control source identifier of the to-be-executed control instruction, the control source identifier being an identity identifier corresponding to a control source.
[0193] The detecting module 603 is configured to compare the control source identifiers of the to-be-executed control instructions in the set of to-be-executed control instructions with the control source identifier of the new control instruction, and determine whether there is a same control source identifier.
[0194] The judging module 604 is configured to, if there is no same control source identifier in the control source identifiers of the to-be-executed control instructions in the set of to-be-executed control instructions and the control source identifier of the new control instruction, discard the new control instruction.
[0195] Figure 7 FIG. 1 is a schematic diagram of an embodiment of the electronic device.
[0196] The electronic device 100 comprises a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30. The processor 30 implements the steps in the above device control method embodiments when executing the computer program 40, for example Figure 2 Steps 201 to 205 as shown.
[0197] For example, the computer program 40 can also be divided into one or more modules / units, which are stored in the memory 20 and executed by the processor 30. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program 40 in the electronic device 100. For example, the receiving module 601, the identifying module 602, the detecting module 603 and the judging module 604 as shown can be divided. Figure 6
[0198] Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 100, and does not constitute a limitation on the electronic device 100, and can include more or fewer components than the diagram, or combine certain components, or different components, for example, the electronic device 100 can also include an input / output device, a network access device, a bus, etc.
[0199] The processor 30 can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor, a single-chip computer or the processor 30 can also be any conventional processor, etc.
[0200] The memory 20 can be used to store the computer program 40 and / or modules / units, and the processor 30 realizes various functions of the electronic device 100 by running or executing the computer program and / or modules / units stored in the memory 20, and calling the data stored in the memory 20. The memory 20 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; and the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-volatile memory, for example, a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device.
[0201] The modules / units integrated in the electronic device 100, if implemented in the form of software function units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can also be implemented by a computer program instructing related hardware to complete, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0202] In several embodiments provided in the present application, it should be understood that the disclosed electronic device and method can be implemented in other ways. For example, the above-described electronic device embodiments are only illustrative, for example, the division of the units is only a logical function division, and another division mode can be used in actual implementation.
[0203] In addition, each functional unit in each embodiment of the present application can be integrated in the same processing unit, or each unit can be physically present separately, or two or more units can be integrated in the same unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software function module.
[0204] It is obvious for those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be regarded as exemplary and non-limiting in any respect. In addition, it is obvious that the word "comprise" does not exclude other units or steps, and the singular does not exclude the plural. The plurality of units or electronic devices stated in the electronic device claims can also be implemented by the same unit or electronic device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0205] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the above examples, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A device control method, characterized in that, include: If a new control command for controlling an IoT device is received, obtain the current set of control commands to be executed for the IoT device; The set of control instructions to be executed is used to store the control instructions to be executed by the Internet of Things device; Obtain the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed, wherein the control source identifier is the identity identifier corresponding to the control source; The control source identifiers of the control instructions to be executed in the set of control instructions to be executed are compared with the control source identifiers of the new control instruction to determine whether there are any identical control source identifiers. If there is no control source identifier in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, the new control instruction is discarded. If there is a control source identifier in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, the new control instruction is added to the set of control instructions to be executed to obtain an updated set of control instructions to be executed. Determine the priority of each control instruction to be executed in the updated set of control instructions to be executed; The IoT device is controlled to process each control instruction to be executed in descending order of priority.
2. The equipment control method as described in claim 1, characterized in that, Before comparing the control source identifiers of the control instructions to be executed in the set of control instructions to be executed with the control source identifiers of the new control instruction to determine whether there are identical control source identifiers, the method further includes: If the IoT device is detected to be not in a busy instruction processing state, the new control instruction is added to the set of control instructions to be executed; The step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a duplicate control source identifier includes: If the IoT device is detected to be in a busy instruction processing state, the step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction is performed to determine whether there is a matching control source identifier.
3. The equipment control method as described in claim 1, characterized in that, Before comparing the control source identifiers of the control instructions to be executed in the set of control instructions to be executed with the control source identifiers of the new control instruction to determine whether there are identical control source identifiers, the method further includes: If there is a target control instruction in the set of control instructions to be executed that is related to the new control instruction, the new control instruction and the target control instruction shall be merged. The step of comparing the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a duplicate control source identifier includes: If there is no target control instruction associated with the new control instruction in the set of control instructions to be executed, the step of comparing the control source identifier of the control instructions to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction is performed to determine whether there is a common control source identifier.
4. The equipment control method as described in claim 3, characterized in that, The association relationship includes an inclusion relationship. The step of merging the new control instruction with the target control instruction if there exists a target control instruction in the set of control instructions to be executed that is associated with the new control instruction includes: If, among the control operations to be executed indicated by the set of control instructions to be executed, there exists a control operation to be executed that has an inclusion relationship with the new control operation indicated by the new control instruction; The control instruction to be executed corresponding to the control operation to be executed with the inclusion relationship is taken as the target control instruction; The new control command is merged with the target control command.
5. The equipment control method as described in claim 4, characterized in that, The step of merging the new control command with the target control command includes: If the new control operation indicated by the new control instruction includes the control operation to be executed indicated by the target control instruction, the new control operation shall be used as the control operation indicated by the merged control instruction. If the control operation to be executed indicated by the target control instruction includes the new control operation indicated by the new control instruction, the control operation to be executed indicated by the target control instruction shall be used as the control operation indicated by the merged control instruction. The control source identifier of the new control instruction and the control source identifier of the target control instruction are used as the control source identifier corresponding to the merged control instruction.
6. The equipment control method as described in claim 1, characterized in that, Following the discarding of the new control command, the following is also included: Send a discard message for the new control command to the control source of the new control command; After controlling the IoT device to process the control commands to be executed in descending order of priority, the process includes: The execution results of each control instruction to be executed are transmitted to the control source corresponding to each control instruction to be executed.
7. A device control apparatus, characterized in that, include: The receiving module is configured to, upon receiving a new control instruction for controlling an IoT device, obtain the current set of control instructions to be executed for the IoT device. The set of control instructions to be executed is used to store the control instructions to be executed by the Internet of Things device; The identification module is used to obtain the control source identifier of the new control instruction and the control source identifier of the control instruction to be executed, wherein the control source identifier is the identity identifier corresponding to the control source; The detection module is used to compare the control source identifier of the control instruction to be executed in the set of control instructions to be executed with the control source identifier of the new control instruction to determine whether there is a common control source identifier; The judgment module is used to discard the new control instruction if there is no control source identifier in the control source identifier of the new control instruction that is the same as the control source identifier of the new control instruction in the set of control instructions to be executed; If there is a control source identifier in the set of control instructions to be executed that is the same as the control source identifier of the new control instruction, the new control instruction is added to the set of control instructions to be executed to obtain an updated set of control instructions to be executed; the priority of each control instruction to be executed in the updated set of control instructions to be executed is determined. The IoT device is controlled to process each control instruction to be executed in descending order of priority.
8. An electronic device, the electronic device comprising a processor and a memory, characterized in that, The memory is used to store instructions, and the processor is used to invoke the instructions in the memory to cause the electronic device to execute the device control method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on an electronic device, cause the electronic device to perform the device control method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent control method and device, storage medium and air conditioner
CN110285534A