Device control method and apparatus, electronic device, and computer-readable storage medium
Patent Information
- Application Number
- CN202111137084.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2041-09-27
AI Technical Summary
[0004]本发明实施例提供一种设备控制方法、装置、电子设备和计算机可读存储介质,可以解决在根据控制策略控制智能设备的过程中,控制策略不能实时进行变化的技术问题
[0056]As described above, in this embodiment, when controlling the smart device corresponding to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time. Then, the current scene information is compared with the preset information in the preset control strategy. If the current scene information is inconsistent with the preset information, it indicates that the preset control strategy is no longer applicable to the current scene. Therefore, the preset control strategy is updated according to the current scene information to obtain an updated control strategy that is applicable to the current scene. Finally, the smart device is controlled according to the updated control strategy. This allows the preset control strategy to be changed in real time according to the current scene information, bringing more convenience to the user.
Smart Images

Figure CN115877722B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart home technology, and more specifically to a device control method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] With the development of science and technology, smart devices are becoming increasingly intelligent, bringing great convenience to users. Currently, after installing a smart device, users first set up device control policies and then control the smart device according to these policies.
[0003] However, in the process of controlling smart devices according to the control strategy, the control strategy is fixed and cannot be changed in real time, which results in not being able to bring more convenience to users. Summary of the Invention
[0004] This invention provides a device control method, apparatus, electronic device, and computer-readable storage medium, which can solve the technical problem that the control strategy cannot be changed in real time during the process of controlling an intelligent device according to the control strategy.
[0005] A device control method, comprising:
[0006] When controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time.
[0007] Compare the current scene information with the preset information in the preset control strategy.
[0008] If the current scene information is inconsistent with the preset information, the preset control strategy is updated according to the current scene information to obtain the updated control strategy.
[0009] The aforementioned smart devices are controlled according to the updated control strategy described above.
[0010] Optionally, before acquiring the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the method further includes:
[0011] Receive initial control strategy input from the user;
[0012] Retrieve the default conflict table;
[0013] The initial control strategy is checked according to the preset conflict table.
[0014] If the initial control strategy does not include the information in the preset conflict table, then the initial control strategy will be stored as the preset control strategy.
[0015] Optionally, the initial control strategy mentioned above includes the execution content corresponding to the smart device, and the preset conflict table is a preset parameter mutual exclusion table.
[0016] Accordingly, the initial control strategy is checked according to the preset conflict table. If the initial control strategy does not include information in the preset conflict table, the initial control strategy is stored as a preset control strategy, including:
[0017] The above execution content is checked according to the above preset parameter mutual exclusion table;
[0018] If the above execution content does not include the parameters in the above preset parameter mutual exclusion table, then the above initial control strategy will be stored as the preset control strategy.
[0019] Optionally, the initial control strategy includes the triggering conditions corresponding to the smart device, and the preset conflict table is a preset condition conflict table.
[0020] Accordingly, the initial control strategy is checked according to the preset conflict table. If the initial control strategy does not include information in the preset conflict table, the initial control strategy is stored as a preset control strategy, including:
[0021] The triggering conditions are checked according to the aforementioned preset condition conflict table;
[0022] If the above triggering conditions do not include the conditions in the above-mentioned preset condition conflict table, then the above-mentioned initial control strategy will be stored as the preset control strategy.
[0023] Optionally, after controlling the smart device according to the above-mentioned update control strategy, the method further includes:
[0024] Obtain the execution result of the aforementioned smart device after executing the aforementioned update control strategy;
[0025] Determine the distance between the user and each terminal device;
[0026] The execution result is sent to the terminal device closest to the user for notification, so that the user can receive the execution result.
[0027] Optionally, the distance between the user and each terminal device is determined, including:
[0028] Broadcast user distance request information to each terminal device so that the terminal devices can determine the distance between the user and the terminal device based on the user distance request information;
[0029] Receive the distance between the user and the terminal returned by the aforementioned terminal device.
[0030] Optionally, after controlling the smart device according to the above-mentioned update control strategy, the method further includes:
[0031] Obtain the execution result of the aforementioned smart device after executing the aforementioned update control strategy;
[0032] Broadcast user distance request information to each terminal device so that the terminal device can determine the distance between the user and the terminal device based on the user distance request information and find the number of votes corresponding to the distance.
[0033] Receive the number of votes returned by each of the aforementioned terminal devices;
[0034] The execution result is sent to the terminal device with the highest number of votes to provide a notification, so that the aforementioned user can obtain the execution result.
[0035] Optionally, the aforementioned current scene information is the user's current location information; correspondingly, the aforementioned real-time acquisition of the current scene information corresponding to the aforementioned preset control strategy includes:
[0036] Obtain the user's current location corresponding to the above-mentioned preset control strategy;
[0037] Using the user's current location as the center, construct a preset shape with a preset distance as the length;
[0038] The location information corresponding to the above-mentioned preset graphic is used as the current location information of the user.
[0039] Optionally, before acquiring the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the method further includes:
[0040] When the current scene conditions are detected to meet the trigger conditions in the above preset control strategy, the execution content in the above preset control strategy will be sent to the smart device corresponding to the above preset control strategy.
[0041] If the transmission fails, the target smart device whose distance from the aforementioned smart device is within a preset threshold is identified;
[0042] The aforementioned execution content is sent to the aforementioned target smart device, so that the aforementioned target smart device forwards the aforementioned execution content to the aforementioned smart device.
[0043] Optionally, before sending the execution content of the preset control strategy to the smart device corresponding to the preset control strategy, the method further includes:
[0044] Determine the status of the aforementioned smart devices;
[0045] Determine the execution type of the above-mentioned preset control strategy;
[0046] If the above status is an unexecutable status and the above execution type is full execution, the execution content in the above preset control strategy is sent to the backup smart device so that the backup smart device executes the above execution content.
[0047] Optionally, after determining the state of the smart device as described above, the process includes:
[0048] If the above state is a partial execution state and the above execution type is partial execution, the executable content of the above smart device will be sent to the above smart device.
[0049] Accordingly, embodiments of the present invention provide a device control apparatus, comprising:
[0050] The acquisition module is used to acquire the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy.
[0051] The comparison module is used to compare the current scene information with the preset information in the preset control strategy.
[0052] The update module is used to update the preset control strategy based on the current scene information if the current scene information is inconsistent with the preset information, so as to obtain the updated control strategy.
[0053] The control module is used to control the smart device according to the updated control strategy.
[0054] Furthermore, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the device control method provided in the embodiments of the present invention.
[0055] Furthermore, embodiments of the present invention also provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute any of the device control methods provided in the embodiments of the present invention.
[0056] As described above, in this embodiment, when controlling the smart device corresponding to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time. Then, the current scene information is compared with the preset information in the preset control strategy. If the current scene information is inconsistent with the preset information, it indicates that the preset control strategy is no longer applicable to the current scene. Therefore, the preset control strategy is updated according to the current scene information to obtain an updated control strategy that is applicable to the current scene. Finally, the smart device is controlled according to the updated control strategy. This allows the preset control strategy to be changed in real time according to the current scene information, bringing more convenience to the user. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is a flowchart illustrating the device control method provided in an embodiment of the present invention;
[0059] Figure 2 This is a schematic diagram of the structure of the device control apparatus provided in an embodiment of the present invention;
[0060] Figure 3 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0061] 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 embodiments of the present invention, and not all embodiments. 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.
[0062] This invention provides a device control method, apparatus, and computer-readable storage medium. The device control apparatus can be integrated into an electronic device, which may be a server.
[0063] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.
[0064] The terminal device can be a smartphone, tablet, laptop, desktop computer, smartwatch, or other smart device, but is not limited to these. The terminal device and the server can be connected directly or indirectly via wired or wireless communication, and this application does not impose any restrictions on this.
[0065] Smart devices refer to devices connected via Internet of Things (IoT) technology. The information exchanged between terminal devices, smart devices, and servers can be encrypted using encryption algorithms, such as the Secure Shell (SSH) protocol.
[0066] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.
[0067] In related technologies, during the process of controlling smart devices according to a control strategy, the control strategy is fixed and cannot be changed in real time, which prevents it from bringing more convenience to users.
[0068] For example, when the control policy is "control the soup maker to run when the user is at home and receives the soup-making start command" (to ensure safety, some smart devices only run when the user is present), if the server detects that the user is at home and has received the soup-making start command, it will control the soup maker to start running. However, if the user leaves home after the soup maker has started running, even if the user wants the soup maker to continue running, they will turn it off for safety reasons, thus preventing the maker from providing the user with more convenience.
[0069] To address this technical problem, this application provides a device control method. In this method, when controlling a smart device corresponding to a preset control strategy, the current scene information corresponding to the preset control strategy is acquired in real time. Then, the current scene information is compared with preset information in the preset control strategy. If the current scene information is inconsistent with the preset information, it indicates that the preset control strategy is no longer applicable to the current scene. Therefore, the preset control strategy is updated based on the current scene information to obtain an updated control strategy that is applicable to the current scene. Finally, the smart device is controlled according to the updated control strategy. This allows the preset control strategy to be changed in real time based on the current scene information, bringing greater convenience to the user.
[0070] The device control method provided in the embodiments of this application will be described in detail below.
[0071] like Figure 1 As shown, the specific flow of the device control method is as follows:
[0072] S101. When controlling the smart device corresponding to the preset control strategy according to the preset control strategy, obtain the current scene information corresponding to the preset control strategy in real time.
[0073] When the current conditions meet the preset control strategy, the server can control the smart device corresponding to the preset control strategy according to the preset control strategy, and obtain the current scene information corresponding to the preset control strategy in real time when controlling the smart device according to the preset control strategy.
[0074] The preset control strategy is a control strategy pre-set by the user. The control strategy can include trigger conditions, smart device information, and the corresponding execution content of the smart device. For example, when the preset control strategy is "when the user is at home and receives a soup-making start command, control the soup maker to start making soup", the trigger condition is "the user is at home and receives a start command", the smart device information is the soup maker, and the corresponding execution content of the smart device is "making soup".
[0075] The current scene information is real-time information about the scene where the preset control strategy is executed, and can be set according to the actual situation of the scene. For example, in this embodiment, the current scene information can be the user's current location information and / or the current operating status information of the smart device. This application does not impose any limitations on this.
[0076] For example, when the preset control strategy is "when the user is at home and receives the soup-making start command, control the soup maker to start making soup", the scenario in which the preset control strategy is executed is the soup-making scenario. Then the current scenario information can be the user's current location information and / or the current operating status information of the smart device.
[0077] For example, when the preset control strategy is "turn on the air conditioner when the ambient temperature is greater than the threshold", the scenario in which this preset control strategy is executed is a cooling scenario, and the current scenario information can be the current ambient temperature information.
[0078] It should be noted that the current scene information may also include time information, current weather status information, indoor temperature information, outdoor temperature information, indoor humidity information, and outdoor humidity information.
[0079] S102. Compare the current scene information with the preset information in the preset control strategy.
[0080] After obtaining the current scene information, the server compares it with the preset information in the preset control strategy. If the current scene information matches the preset information, the verification passes; otherwise, the verification fails.
[0081] For example, when the preset control strategy is "when the user is at home and receives a soup-making start command, control the soup maker to start making soup," the preset information is "the user is at home," and the current scenario information can be the user's current location information. If the user's current location information is "the user is at home," then the user's current location information is consistent with the preset information "the user is at home." If the user's current location information is "the user is not at home," then the user's current location information is inconsistent with the preset information "the user is at home."
[0082] S103. If the current scene information is inconsistent with the preset information, the preset control strategy is updated according to the current scene information to obtain the updated control strategy.
[0083] If the current scene information is inconsistent with the preset information, it means that the scene conditions corresponding to the preset control policy have changed. At this time, the preset control policy is no longer applicable to the current scene, and the server updates the preset control policy according to the current scene information to obtain the updated control policy.
[0084] The process of updating the preset control policy can be as follows: obtain the backup content corresponding to the current scene information, and then modify the trigger conditions or execution content corresponding to the smart device in the preset control policy according to the backup content. Alternatively, modify the smart device information in the preset control policy according to the current scene information.
[0085] For example, the preset control policy is "when the user is at home and receives the soup-making start command, control the soup maker to start making soup." If the current scenario information is the user's current location, but the user's current location information indicates the user is not at home, it means the current scenario conditions do not meet the trigger condition of the preset control policy, and the preset control policy is no longer applicable to the current scenario. Therefore, the alternative content corresponding to the user not being at home can be obtained: "send the soup maker's operating status to the user's mobile phone" (so that the user can be aware of the soup maker's status at all times, thus ensuring safety). The trigger condition "user at home" in the preset control policy is deleted, and "send the soup maker's operating status to the user's mobile phone" is added to the execution content of the preset control policy.
[0086] For example, the preset control policy is "when the user arrives home between 7 and 8 o'clock, turn on the lights in the living room and kitchen". The current scene information is the user's current location information. If the user's current location information is that the user is in the study, then the preset control policy "turn on the lights in the living room and kitchen" can be modified to turn on the lights in the living room and study.
[0087] S104. Control the smart device according to the updated control strategy.
[0088] After receiving the updated control policy, the server controls the smart devices according to that updated policy. It should be noted that the smart devices corresponding to the preset control policy and the smart devices corresponding to the updated control policy can be the same or different. Users can configure this according to their actual needs; this application does not impose any restrictions.
[0089] As described above, in this embodiment, when controlling the smart device corresponding to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time. Then, the current scene information is compared with the preset information in the preset control strategy. If the current scene information is inconsistent with the preset information, it indicates that the preset control strategy is no longer applicable to the current scene. Therefore, the preset control strategy is updated according to the current scene information to obtain an updated control strategy that is applicable to the current scene. Finally, the smart device is controlled according to the updated control strategy. This allows the preset control strategy to be changed in real time according to the current scene information, bringing more convenience to the user.
[0090] When users configure control policies for smart devices, the server or terminal device does not check these policies. If a user-configured control policy contains logical errors, these errors may only be discovered during actual implementation, preventing the smart device from being controlled according to the user's needs.
[0091] For example, if the preset control policy is "turn off or turn on the air conditioner between 7 and 8 o'clock and when the user arrives home," then "turn off" and "turn on" are two conflicting actions, and the air conditioner cannot execute simultaneously. As another example, if the preset control policy is "turn on the air conditioner when the user is home and when the user is not home," then "the user is home" and "the user is not home" are two conflicting triggering conditions.
[0092] To address this technical problem, in some embodiments, when the server receives an initial control policy input by the user, it retrieves a preset conflict table and then checks the initial control policy against the preset conflict table. If the initial control policy does not include information from the preset conflict table, it indicates that the initial control policy does not contain any logical errors, and the initial control policy can be stored as a preset control policy.
[0093] If the initial control strategy includes information from the preset conflict table, that information will be highlighted, and the user will be prompted to delete or modify it.
[0094] The default conflict table is a table set by the user in advance. When the user sets the default conflict table, the server can verify the default conflict table through the rule engine.
[0095] The initial control strategy includes the execution content corresponding to the smart device, and the preset conflict table is a preset parameter mutual exclusion table.
[0096] Accordingly, the initial control policy is checked against a preset conflict table. If the initial control policy does not include information from the preset conflict table, it is stored as a preset control policy, including:
[0097] The execution content is checked according to a preset parameter mutual exclusion table. If the execution content does not include a parameter in the preset parameter mutual exclusion table, the initial control strategy is stored as the preset control strategy.
[0098] In addition, the initial control strategy may also include the triggering conditions corresponding to the smart device, and the preset conflict table is a preset condition conflict table.
[0099] Accordingly, the initial control policy is checked against a preset conflict table. If the initial control policy does not include information from the preset conflict table, it is stored as a preset control policy, including:
[0100] The triggering conditions are checked against a preset condition conflict table. If a triggering condition does not include a condition in the preset condition conflict table, the initial control policy is stored as the preset control policy.
[0101] Users can choose the specific storage method of the preset control strategy according to the actual situation. For example, in the embodiments of this application, a singly linked list or a directed acyclic graph is selected for storage. This application does not make specific limitations here.
[0102] After the user inputs the trigger conditions in the initial control strategy, the server can determine the matching coefficient of each smart device with the trigger conditions, and then display the list of smart devices with high matching coefficients at the top of the smart device list, so that the user can quickly select the smart device that corresponds to the trigger conditions.
[0103] For example, if the trigger condition is "when the temperature is greater than 28°", then the smart device that executes the trigger condition is a temperature sensor, and the server can list the identifiers of each temperature sensor at the top of the smart device list.
[0104] It should be noted that, to ensure data security, the server can use an asymmetric encryption algorithm to encrypt the preset control policy before storage. Furthermore, if the user enters the initial control policy on a terminal device, the terminal device can first store the initial control policy locally as the preset control policy when the network is poor (when the terminal device and the smart device are close, for example, the terminal device is at home, the terminal device can directly control the smart device via the local area network according to the preset control policy). Then, when the network is better, the preset control policy is sent to the server for storage.
[0105] When a terminal device stores its initial control policy as a preset control policy to the server, a token and the preset control policy can be sent together to the server for security reasons. Upon receiving the token and the preset control policy, the server verifies the token. If the verification passes, the server stores the preset control policy. If the verification fails, it indicates that the terminal device is not an authenticated device, and the preset control policy storage fails.
[0106] When the network of the smart device corresponding to the preset control policy is poor, the server may not be able to send the preset control policy to the smart device in a timely manner, thus preventing the preset control policy from being implemented in a timely manner.
[0107] In some embodiments, to ensure that the preset control strategy is sent to the smart device in a timely manner when the network connection to the smart device is poor, the present application further includes:
[0108] When the current scene conditions are detected to meet the trigger conditions in the preset control strategy, the execution content of the preset control strategy is sent to the smart device corresponding to the preset control strategy. If the sending fails, a target smart device within a preset threshold distance is identified, and the execution content is sent to the target smart device. Since the distance between the target smart device and the target smart device is within the preset threshold, the target smart device can forward the execution content to the smart device via short-range wireless communication. The smart device then executes the received execution content.
[0109] Near-field wireless communication methods include, but are not limited to, Bluetooth, Narrowband Internet of Things (NB-IoT), Near Field Communication (NFC), Zigbee, LoRa infrared point-to-point communication, and Wi-Fi.
[0110] It should be understood that when the update control policy fails to be sent, the server can also send the update control policy to the target smart device first, and then the target smart device can forward the update control policy to the smart device.
[0111] In this embodiment, when the network connection between the smart device and the preset control device is poor, the execution content of the preset control strategy is sent to the target smart device whose distance from the smart device is within a preset threshold. The target smart device then forwards the message to the target smart device, thereby enabling the preset control strategy to be executed in a timely manner.
[0112] Since users typically set at least two preset control policies, if the smart devices corresponding to the two preset control policies are the same, the smart device may receive the execution content of the other preset control policy when executing one preset control policy. However, the smart device cannot execute the execution content of one preset control policy, resulting in the inability to achieve the control result required by the user.
[0113] To address this timeliness issue, this embodiment of the application determines the state of the smart device and the execution type of the preset control strategy before sending the execution content of the preset control strategy to the smart device corresponding to the preset control strategy. If the state is "cannot be executed" and the execution type is "full execution," the execution content of the preset control strategy is sent to a backup smart device so that the backup smart device can execute the execution content, thereby achieving the control result required by the user.
[0114] For example, the first preset control policy is "when a user is detected in the gym, start the gym's TV to play a yoga video," and the second preset control policy is "when a video sent by a preset friend is received, forward the video to the gym's TV," with the second preset control policy's execution type being "all execution." When the gym's TV is executing the first preset control policy and the server receives the video sent by the preset friend, the server determines the gym's TV's status and the second preset control policy's execution type. If the gym's TV's status is "cannot execute" and the execution type is "all execution," the server then looks for a backup device—the gym's tablet—and forwards the "video" from the second preset control policy to the tablet, allowing the tablet to play the video.
[0115] If the status is "cannot be executed" and the execution type is "not to be executed", then wait for the gym's TV to finish playing the yoga video before playing the video again.
[0116] If the status is partially executed and the execution type is partially executed, then the executable content that the smart device can execute will be sent to the smart device.
[0117] For example, the first preset control policy is "when a user is detected in the gym, start the gym's TV to play a yoga video (the video has no sound)", and the second preset control policy is "when a video connection initiated by a preset friend is received, forward the video connection to the gym's TV", with the second preset control policy's execution type being partial execution. When the gym's TV is executing the first preset control policy and the server receives the video connection initiated by the preset friend, the server determines the state of the gym's TV and the execution type of the second preset control policy. At this point, the gym's TV's state is partial execution and the execution type is partial execution. Therefore, the server can convert the video connection into an audio connection and send the audio connection to the gym's TV. Alternatively, the server can directly send the video connection to the gym's TV, and the gym's TV can then convert the video connection into an audio connection.
[0118] After controlling the smart device according to the updated control policy, if the user is far away from the smart device, the user cannot obtain the execution result of the smart device executing the updated control policy. To ensure that the user can obtain the execution result of the smart device in a timely manner, in some embodiments, after controlling the smart device according to the updated control policy, the following steps are also included:
[0119] The system retrieves the execution results of the updated control policy from the smart devices and determines the distance between the user and each terminal device. The execution results are then sent to the terminal device closest to the user for notification, ensuring the user receives the results.
[0120] The prompts can take the form of at least one of text, images, audio, and video. It should be understood that the form of the prompt can be set according to the functionality of the terminal device. For example, when the terminal device is a smart speaker, the prompt can be in the form of audio.
[0121] In this embodiment, the execution result of the smart device is sent to the terminal device closest to the user for notification, so that the user can obtain the execution result in a timely manner.
[0122] The process by which the server determines the distance between the user and each terminal device can be as follows: the server broadcasts a user distance request to each terminal device; after receiving the user distance request, each terminal device determines the distance between itself and the user, and returns this distance to the server. The server thus obtains the distance between the user and each terminal device.
[0123] Alternatively, after determining the distance between the user and the terminal device, the terminal device can look up the number of votes corresponding to that distance (the higher the number of votes, the shorter the distance) and return the number of votes to the server. After receiving the number of votes returned by each terminal device, the server sends the execution result to the terminal device with the highest number of votes for notification.
[0124] It's worth noting that the higher the number of votes, the longer the distance. In this case, the server will send the execution result to the terminal device with the lowest number of votes for display.
[0125] Alternatively, the process by which the server determines the distance between the user and each terminal device can be as follows: the server obtains the user's current location information through a location sensor, and then calculates the distance between the user's current location information and each terminal device (the location information of each terminal device has been pre-stored in the server), thereby obtaining the distance between the user and each terminal device.
[0126] It should be understood that, in order to improve the accuracy of the obtained user's current location information, the server can obtain the brightness information of the user's location through the brightness sensor and the background sound of the user's environment through the sound sensor when obtaining the user's current location information through the location sensor. Then, the user's current location information is determined by using the location information, brightness information and background sound obtained by the location sensor.
[0127] The position sensor can be an infrared position sensor, a capacitive position sensor, or a button-triggered position sensor. The server can pre-bind the position sensor to the user.
[0128] In other embodiments, the current scene information is the user's current location information; correspondingly, the current scene information corresponding to the preset control strategy is acquired in real time, including:
[0129] Obtain the user's current location point corresponding to the preset control strategy. Then, construct a preset shape with the user's current location point as the center and a preset distance as the length. Use the location information corresponding to the preset shape as the user's current location information.
[0130] Alternatively, a preset shape can be constructed using the user-selected location as the center and a preset distance as the length. The location information corresponding to the preset shape is then used as the user's current location information.
[0131] The preset shapes can be circles, polygons, rectangles, squares, etc. The number of preset distances is set according to the preset shape. For example, when the preset shape is a rectangle, there are two preset distances: one for the length of the rectangle and the other for the width. When the preset shape is a circle, there is one preset distance, which serves as the radius of the circle.
[0132] In other embodiments, after controlling the smart device according to the update control protocol, if the execution content of the update control protocol is different from the execution content of the preset control protocol, and the triggering condition of the update control protocol is the same as the triggering condition of the preset control protocol, then if the server detects again that the current scene conditions meet the triggering conditions, the server can control the smart device according to the update control protocol or according to the preset control protocol.
[0133] Optionally, since smart devices can save the most recently executed control policy, if the smart device's network condition is poor, if the server detects again that the current scenario conditions meet the triggering conditions, it can simply send the execution command to the smart device, and the smart device will then execute the most recently executed control policy.
[0134] To better implement the above methods, embodiments of the present invention also provide a device control apparatus, which can perform the following functions: Figure 2 As shown, the equipment control device includes:
[0135] The acquisition module 201 is used to acquire the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy.
[0136] The comparison module 202 is used to compare the current scene information with the preset information in the preset control strategy.
[0137] The update module 203 is used to update the preset control strategy based on the current scene information if the current scene information is inconsistent with the preset information, so as to obtain the updated control strategy.
[0138] Control module 204 is used to control smart devices according to updated control strategies.
[0139] Optionally, the device control unit further includes:
[0140] The receiving module is used to receive the initial control strategy input by the user.
[0141] The table retrieval module is used to retrieve the preset conflict table.
[0142] The storage module is checked to examine the initial control policy against a preset conflict table. If the initial control policy does not include information from the preset conflict table, it is stored as the preset control policy.
[0143] Optionally, the initial control strategy includes the execution content corresponding to the smart device, and the preset conflict table is a preset parameter mutual exclusion table.
[0144] Accordingly, the storage module is checked, specifically for execution:
[0145] The execution content is checked according to the preset parameter mutual exclusion table;
[0146] If the executed content does not include the parameters in the preset parameter mutual exclusion table, the initial control strategy will be stored as the preset control strategy.
[0147] Optionally, the initial control strategy includes the triggering conditions corresponding to the smart device, and the preset conflict table is a preset condition conflict table.
[0148] Accordingly, the storage module is checked, specifically for execution:
[0149] The triggering conditions are checked according to the preset conflict table;
[0150] If the triggering condition does not include the condition in the preset condition conflict table, the initial control policy will be stored as the preset control policy.
[0151] Optionally, the device control unit further includes:
[0152] The result acquisition module is used to acquire the execution results of the smart device after executing the update control strategy.
[0153] The distance determination module is used to determine the distance between the user and each terminal device.
[0154] The result sending module is used to send the execution result to the terminal device closest to the user for notification, so that the user can obtain the execution result.
[0155] Optionally, the distance determination module is specifically used to perform:
[0156] Broadcast user distance request information to each terminal device so that the terminal device can determine the distance between the user and the terminal device based on the user distance request information;
[0157] The distance between the user and the terminal is returned by the receiving terminal device;
[0158] Optionally, the device control unit further includes:
[0159] The broadcast module is used to broadcast user distance request information to various terminal devices, so that the terminal devices can determine the distance between the user and the terminal device based on the user distance request information and find the number of votes corresponding to the distance.
[0160] The vote receiving module is used to receive the vote counts returned by each terminal device.
[0161] Accordingly, the result sending module is specifically used to execute:
[0162] The execution result is sent to the terminal device with the highest number of votes for notification, so that the user can obtain the execution result.
[0163] Optionally, the current scene information is the user's current location information;
[0164] Accordingly, module 201 is specifically used to perform:
[0165] Obtain the user's current location corresponding to the preset control strategy;
[0166] Construct a preset shape with the user's current location as the center and a preset distance as the length;
[0167] Use the location information corresponding to the preset graphic as the user's current location information.
[0168] Optionally, the device control unit further includes:
[0169] The detection module is used to send the execution content of the preset control strategy to the smart device corresponding to the preset control strategy when the current scene conditions are detected to meet the trigger conditions in the preset control strategy.
[0170] The device identification module is used to identify a target smart device whose distance from the smart device is within a preset threshold if the transmission fails.
[0171] The content sending module is used to send the execution content to the target smart device, so that the target smart device will forward the execution content to the smart device.
[0172] Optionally, the device control unit further includes:
[0173] The device determination module is used to determine the status of smart devices.
[0174] The type determination module is used to determine the execution type of the preset control strategy.
[0175] Accordingly, the content sending module is specifically used to perform:
[0176] If the status is "cannot be executed" and the execution type is "all execution", the execution content in the preset control strategy will be sent to the backup smart device so that the backup smart device can execute the execution content.
[0177] Accordingly, the content sending module is specifically used to perform:
[0178] If the status is partially executed and the execution type is partially executed, send the executable content that the smart device can execute to the smart device.
[0179] In practice, each of the above modules can be implemented as an independent entity or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation methods and corresponding beneficial effects of each of the above modules, please refer to the previous method embodiments, which will not be repeated here.
[0180] This invention also provides an electronic device, such as... Figure 3 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:
[0181] The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will understand that... Figure 3 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0182] The processor 301 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing computer programs and / or modules stored in the memory 302, and by calling data stored in the memory 302, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 301.
[0183] The memory 302 can be used to store computer programs and modules. The processor 301 executes various functional applications and data processing by running the computer programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, computer programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.
[0184] The electronic device also includes a power supply 303 that supplies power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0185] The electronic device may also include an input unit 304, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0186] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 301 in the electronic device loads the executable files corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 runs the computer program stored in the memory 302 to realize various functions, such as:
[0187] When controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time;
[0188] Compare the current scene information with the preset information in the preset control strategy;
[0189] If the current scene information is inconsistent with the preset information, the preset control strategy is updated according to the current scene information to obtain the updated control strategy;
[0190] Control smart devices according to the updated control strategy.
[0191] For details on the specific implementation methods and corresponding beneficial effects of the above operations, please refer to the preceding embodiments, which will not be repeated here.
[0192] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0193] Therefore, embodiments of the present invention provide a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the device control methods provided in the embodiments of the present invention. For example, the computer program can execute the following steps:
[0194] When controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time;
[0195] Compare the current scene information with the preset information in the preset control strategy;
[0196] If the current scene information is inconsistent with the preset information, the preset control strategy is updated according to the current scene information to obtain the updated control strategy;
[0197] Control smart devices according to the updated control strategy.
[0198] For details on the specific implementation methods and corresponding beneficial effects of the above operations, please refer to the preceding embodiments, which will not be repeated here.
[0199] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0200] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the device control methods provided in the embodiments of the present invention, the beneficial effects that any of the device control methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0201] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned device control method.
[0202] The foregoing has provided a detailed description of a device control method, apparatus, and computer-readable storage medium provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A device control method, characterized in that, include: When controlling a smart device corresponding to a preset control strategy according to a preset control strategy, the current scene information corresponding to the preset control strategy is obtained in real time. The control strategy includes triggering conditions, smart device information, and execution content corresponding to the smart device. The current scene information is compared with the preset information in the preset control strategy; If the current scene information is inconsistent with the preset information, the preset control strategy is updated according to the current scene information to obtain an updated control strategy; Control the smart device according to the update control strategy; The process of updating the preset control strategy is as follows: obtain the backup content corresponding to the current scene information, and modify the trigger conditions or execution content corresponding to the smart device in the preset control strategy according to the backup content; or, modify the smart device information in the preset control strategy according to the current scene information.
2. The equipment control method according to claim 1, characterized in that, Before acquiring the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the method further includes: Receive initial control strategy input from the user; Retrieve the preset conflict table; The initial control strategy is checked according to the preset conflict table; If the initial control strategy does not include the information in the preset conflict table, then the initial control strategy will be stored as the preset control strategy.
3. The equipment control method according to claim 2, wherein, The initial control strategy includes the execution content corresponding to the smart device, and the preset conflict table is a preset parameter mutual exclusion table; Accordingly, the step of checking the initial control strategy according to the preset conflict table, and storing the initial control strategy as a preset control strategy if the initial control strategy does not include information in the preset conflict table, includes: The execution content is checked according to the preset parameter mutual exclusion table; If the execution content does not include the parameters in the preset parameter mutual exclusion table, then the initial control strategy is stored as the preset control strategy.
4. The equipment control method according to claim 2, wherein, The initial control strategy includes the triggering conditions corresponding to the smart device, and the preset conflict table is a preset condition conflict table; Accordingly, the step of checking the initial control strategy according to the preset conflict table, and storing the initial control strategy as a preset control strategy if the initial control strategy does not include information in the preset conflict table, includes: The triggering conditions are checked according to the preset condition conflict table; If the triggering condition does not include the condition in the preset condition conflict table, then the initial control strategy is stored as the preset control strategy.
5. The equipment control method according to claim 1, characterized in that, After controlling the smart device according to the updated control policy, the method further includes: Obtain the execution result of the smart device after executing the update control strategy; Determine the distance between the user and each terminal device; The execution result is sent to the terminal device closest to the user for notification, so that the user can obtain the execution result.
6. The equipment control method according to claim 5, wherein, Determine the distance between the user and each terminal device, including: Broadcast user distance request information to each terminal device so that the terminal device can determine the distance between the user and the terminal device based on the user distance request information; The distance between the user and the terminal is received from the terminal device.
7. The equipment control method according to claim 1, wherein, After controlling the smart device according to the updated control policy, the method further includes: Obtain the execution result of the smart device after executing the update control strategy; Broadcast user distance request information to each terminal device so that the terminal device can determine the distance between the user and the terminal device based on the user distance request information and find the number of votes corresponding to the distance; Receive the number of votes returned by each of the terminal devices; The execution result is sent to the terminal device with the highest number of votes for notification, so that the user can obtain the execution result.
8. The equipment control method according to claim 1, wherein, The current scene information is the user's current location information; correspondingly, the real-time acquisition of the current scene information corresponding to the preset control strategy includes: Obtain the user's current location corresponding to the preset control strategy; A preset shape is constructed using the user's current location as the center and a preset distance as the length. The location information corresponding to the preset graphic is used as the user's current location information.
9. The equipment control method according to claim 1, characterized in that, Before acquiring the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy, the method further includes: When it is detected that the current scene conditions meet the trigger conditions in the preset control strategy, the execution content in the preset control strategy is sent to the smart device corresponding to the preset control strategy; If the transmission fails, a target smart device whose distance from the smart device is within a preset threshold is identified; The execution content is sent to the target smart device, so that the target smart device forwards the execution content to the smart device.
10. The equipment control method according to claim 9, characterized in that, Before sending the execution content of the preset control strategy to the smart device corresponding to the preset control strategy, the method further includes: Determine the state of the smart device; Determine the execution type of the preset control strategy; If the state is an unexecution state and the execution type is full execution, the execution content in the preset control strategy is sent to the backup smart device so that the backup smart device executes the execution content.
11. The equipment control method according to claim 10, characterized in that, After determining the state of the smart device, the process includes: If the state is a partially executed state and the execution type is partially executed, the executable content of the smart device is sent to the smart device.
12. A device control apparatus, characterized in that, include: The acquisition module is used to acquire the current scene information corresponding to the preset control strategy in real time when controlling the smart device corresponding to the preset control strategy according to the preset control strategy. The control strategy includes triggering conditions, smart device information and execution content corresponding to the smart device. The comparison module is used to compare the current scene information with the preset information in the preset control strategy; An update module is used to update the preset control strategy based on the current scene information if the current scene information is inconsistent with the preset information, thereby obtaining an updated control strategy. The control module is used to control the smart device according to the updated control strategy; The process of updating the preset control strategy is as follows: obtain the backup content corresponding to the current scene information, and modify the trigger conditions or execution content corresponding to the smart device in the preset control strategy according to the backup content; or, modify the smart device information in the preset control strategy according to the current scene information.
13. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program, and the processor running the computer program in the memory to perform the device control method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the device control method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Monitoring method, set top box, monitoring system and memory medium
CN107484005A
Storage medium, and smart home scene generation device and method
CN111487884A
Equipment control method and device, electronic equipment and computer readable storage medium
CN111596556A
Method, system and device for automatically recommending switching scene and storage medium
CN113220991A