Equipment parameter processing method and device, electronic equipment and storage medium
By receiving client data modification requests and judging modification scenarios on the cloud of the smart home system, the data conflict problem caused by multiple family members editing smart home device parameters at the same time is solved, and the effective editing and consistency of data is achieved.
Patent Information
- Application Number
- CN202411544741.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-28
AI Technical Summary
In a smart home system, when multiple family members edit the device parameters of smart home devices at the same time, data conflicts are prone to occur, affecting the processing of device parameters.
By communicating and connecting with smart home devices in the cloud, receiving client data modification requests, and determining data modification scenarios based on data attributes. If it is a complex data modification scenario, the data status of cloud device data is obtained. If it is in an unedited state, the modification time will be allocated to allow the client to modify the data within that time.
It effectively avoids data editing conflicts, ensures successful writing of device data, and ensures data consistency and integrity.
Smart Images

Figure CN119536048A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart home data processing, and in particular to a method for processing device parameters, a device for processing device parameters, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the development of smart home technology, smart home devices have become common devices in people's homes. In smart home scenarios, various parts of the home environment are connected through various smart home devices and systems to achieve automation, intelligent control and management, thereby improving the quality of life and efficiency of users. Among them, for smart home systems, it is usually based on the family as the basic unit. Different family members in the family can set corresponding "usage scenarios" under the family. For example, when the door of the house is opened, the lights in the living room are automatically turned on, and the air conditioner is turned on and set to a specified temperature. However, since the needs of different family members may be different, when multiple family members edit the data corresponding to the same smart home scenario at the same time, data conflicts are likely to occur, thereby affecting the processing of device parameters. Summary of the invention
[0003] The embodiments of the present invention provide a method, apparatus, electronic device and computer-readable storage medium for processing device parameters to solve or partially solve the problem of data conflict that may occur when different members edit the device parameters of smart home devices at the same time during the process of controlling smart home devices.
[0004] An embodiment of the present invention discloses a method for processing device parameters, which is applied to a cloud, wherein the cloud is communicatively connected with at least one smart home device, and the method includes:
[0005] Receiving a data modification request for the smart home device sent by a client, the data modification request including data attributes corresponding to local device data of the smart home device on the client;
[0006] Determining, according to the data attribute, a data modification scenario corresponding to the data modification request;
[0007] If the data modification scenario represents a complex data modification scenario for the smart home device, obtaining a data state corresponding to the cloud device data of the smart home device in the cloud;
[0008] If the data status indicates that the cloud device data is currently in an unedited state, determining a modification duration for the client, wherein the modification duration is a duration during which only the client is allowed to modify data on the smart home device;
[0009] In response to the target device data for the smart home device sent by the client within the modification duration, the cloud device data is updated to the target device data.
[0010] In some feasible implementations, the data attribute includes at least a data volume corresponding to the local device data, and determining, according to the data attribute, a data modification scenario corresponding to the data modification request includes:
[0011] If the data volume is less than a preset threshold, it is determined that the data modification request belongs to a simple data modification scenario;
[0012] If the data volume is greater than or equal to the preset threshold, it is determined that the data modification request belongs to a complex data modification scenario.
[0013] In some feasible implementations, the data attribute includes at least a first version number corresponding to the local device data, and if the data modification scenario represents a complex data modification scenario for the smart home device, obtaining a data state corresponding to the cloud device data of the smart home device in the cloud includes:
[0014] Obtain a second version number corresponding to the cloud device data of the smart home device in the cloud;
[0015] If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is the same as the second version number, then a data state corresponding to the cloud device data of the smart home device in the cloud is obtained.
[0016] Some possible implementations also include:
[0017] If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is later than the second version number, local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data.
[0018] In some feasible implementations, the method further includes:
[0019] If the data modification scenario represents a simple data modification scenario for the smart home device, and the first version number is later than the second version number, local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data.
[0020] In some feasible implementations, the method further includes:
[0021] If the data status indicates that the cloud device data is currently in an editing state, an editing prompt message is returned to the client, where the editing prompt message is a message indicating that the data of the smart home device is currently in a state where data editing is not possible.
[0022] In some feasible implementations, in response to the target device data for the smart home device sent by the client within the modification duration, updating the cloud device data to the target device data includes:
[0023] Receiving target device data for the smart home device sent by the client;
[0024] Determine the receiving time point corresponding to the target device data and the valid time period corresponding to the modification duration, and if the receiving time point is within the valid time period, update the cloud device data to the target device data.
[0025] Some possible implementations also include:
[0026] If the receiving time point exceeds the valid time period, obtaining a third version number corresponding to the target device data, and comparing the third version number with the second version number corresponding to the cloud device data;
[0027] If the third version number is later than the second version number, the cloud device data is updated to the target device data.
[0028] The embodiment of the present invention further discloses a device for processing device parameters, which is applied to a cloud, and the cloud is communicatively connected with at least one smart home device, and the device includes:
[0029] A request receiving module, configured to receive a data modification request for the smart home device sent by a client, wherein the data modification request includes data attributes corresponding to local device data of the smart home device on the client;
[0030] A scenario determination module, used for determining the data modification scenario corresponding to the data modification request according to the data attribute;
[0031] A data status acquisition module, configured to acquire a data status corresponding to the cloud device data of the smart home device in the cloud if the data modification scenario represents a complex data modification scenario for the smart home device;
[0032] A duration allocation module, configured to determine a modification duration for the client if the data status indicates that the cloud device data is currently in an unedited state, wherein the modification duration is a duration during which only the client is allowed to modify data on the smart home device;
[0033] The data updating module is used to update the cloud device data to the target device data in response to the target device data for the smart home device sent by the client within the modification time period.
[0034] In some feasible implementations, the data attribute includes at least a data volume corresponding to the local device data, and the scene determination module is specifically configured to:
[0035] If the data volume is less than a preset threshold, it is determined that the data modification request belongs to a simple data modification scenario;
[0036] If the data volume is greater than or equal to the preset threshold, it is determined that the data modification request belongs to a complex data modification scenario.
[0037] In some feasible implementations, the data attribute includes at least a first version number corresponding to the local device data, and the data status acquisition module is specifically used to:
[0038] Obtain a second version number corresponding to the cloud device data of the smart home device in the cloud;
[0039] If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is the same as the second version number, then a data state corresponding to the cloud device data of the smart home device in the cloud is obtained.
[0040] Some possible implementations also include:
[0041] The first data processing module is used to obtain the local device data corresponding to the data modification request and update the cloud device data to the local device data if the data modification scenario represents a complex data modification scenario for the smart home device and the first version number is later than the second version number.
[0042] In some feasible implementations, the device further includes:
[0043] The second data processing module is used to obtain the local device data corresponding to the data modification request and update the cloud device data to the local device data if the data modification scenario represents a simple data modification scenario for the smart home device and the first version number is later than the second version number.
[0044] In some feasible implementations, the device further includes:
[0045] The prompt processing module is used to return an editing prompt message to the client if the data status indicates that the cloud device data is currently in an editing state, and the editing prompt message is a message indicating that the smart home device is currently in a state where data editing is not possible.
[0046] In some feasible implementations, the data updating module is specifically used for:
[0047] Receiving target device data for the smart home device sent by the client;
[0048] Determine the receiving time point corresponding to the target device data and the valid time period corresponding to the modification duration, and if the receiving time point is within the valid time period, update the cloud device data to the target device data.
[0049] Some possible implementations also include:
[0050] A version comparison module, configured to obtain a third version number corresponding to the target device data if the receiving time point exceeds the valid time period, and compare the third version number with the second version number corresponding to the cloud device data;
[0051] A data updating module is used to update the cloud device data to the target device data if the third version number is later than the second version number.
[0052] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0053] The memory is used to store computer programs;
[0054] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0055] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0056] The embodiments of the present invention include the following advantages:
[0057] In the embodiment of the present invention, the cloud is applied to communicate with at least one smart home device and remotely control and manage data of the smart home device. The user can set the device parameters of the smart home device through the client. When the user edits the device parameters, the cloud can receive the data modification request for the smart home device sent by the client. The data modification request includes the data attributes corresponding to the local device data of the smart home device on the client, and determines the data modification scenario corresponding to the data modification request according to the data attributes. Before formally editing the device parameters, the cloud can determine the scenario corresponding to the data modification according to the data attributes, so as to flexibly adjust the corresponding processing strategy according to the data modification scenario, so as to accurately identify the situation where data editing conflicts may occur, and ensure the validity of data editing. If the data modification The scenario represents a complex data modification scenario for smart home devices. The cloud can obtain the data status corresponding to the cloud device data of the smart home devices in the cloud; if the data status represents that the cloud device data is currently in an unedited state, the modification duration for the client is determined, and the modification duration is the duration for allowing the client to modify the data of the smart home device. Then, in response to the target device data for the smart home device sent by the client within the modification duration, the cloud device data can be updated to the target device data. By determining that the user's modification intention is to modify the complex data of the smart home device and the data is in an unedited state, the corresponding modification duration is allocated to the client, allowing the client to edit the data of the smart home device within the modification duration, thereby effectively avoiding the problem of data editing conflicts and ensuring successful writing of device data. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 is a flowchart of a method for processing device parameters provided in an embodiment of the present invention;
[0059] Figure 2 is a structural block diagram of a device parameter processing apparatus provided in an embodiment of the present invention;
[0060] Figure 3 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] As an example, for a smart home system, it is usually based on the family as the basic unit, and different family members in the family can set corresponding "usage scenarios" under the family. For example, when the door of the house is opened, the lights in the living room are automatically turned on, the air conditioner is turned on and set to a specified temperature, etc. However, since the needs of different family members may be different, when multiple family members edit the data corresponding to the same smart home scene at the same time, data conflicts are likely to occur, thereby affecting the processing of device parameters.
[0063] In this regard, in the present invention, the cloud can communicate with at least one smart home device and remotely control and manage data of the smart home device. The user can set the device parameters of the smart home device through the client. When the user edits the device parameters, the cloud can receive a data modification request for the smart home device sent by the client. The data modification request includes data attributes corresponding to the local device data of the smart home device on the client, and determines the data modification scenario corresponding to the data modification request according to the data attributes. Before formally editing the device parameters, the cloud can determine the scenario corresponding to the data modification according to the data attributes, so as to flexibly adjust the corresponding processing strategy according to the data modification scenario, so as to accurately identify situations where data editing conflicts may occur, and ensure the effectiveness of data editing. If the data modification scenario table If the target is a complex data modification scenario for smart home devices, the cloud can obtain the data status corresponding to the cloud device data of the smart home device in the cloud; if the data status indicates that the cloud device data is currently in an unedited state, the modification duration for the client is determined, and the modification duration is the duration for allowing the client to modify the data of the smart home device. Then, in response to the target device data for the smart home device sent by the client within the modification duration, the cloud device data can be updated to the target device data. By determining that the user's modification intention is to modify the complex data of the smart home device and the data is in an unedited state, the corresponding modification duration is allocated to the client, allowing the client to edit the data of the smart home device within the modification duration, thereby effectively avoiding the problem of data editing conflicts and ensuring the successful writing of device data.
[0064] Reference Figure 1 , shows a flowchart of a method for processing device parameters provided in an embodiment of the present invention, which is applied to a cloud, and the cloud is connected to at least one smart home device for communication, and specifically may include the following steps:
[0065] Step 101, receiving a data modification request for the smart home device sent by a client, wherein the data modification request includes data attributes corresponding to local device data of the smart home device on the client;
[0066] In the smart home scenario, there are multi-level interactive relationships between the cloud, user terminals, clients, and smart home devices, which together constitute the core architecture of the smart home system.
[0067] As for the cloud, it can be the core computing and data storage center of the smart home system, responsible for processing complex computing tasks, data analysis, forwarding of remote control instructions, and synchronization of device status. For example, it can be used to store status information, user preference settings, historical data, etc. of all smart home devices; it can also be used to execute complex algorithms, such as machine learning, data analysis, etc., to optimize device control strategies; it can also be used to remotely control smart home devices, even if the user is not at home; it can also be responsible for management tasks such as device registration, authentication, firmware updates, etc.
[0068] For the user terminal, it can be the main interface for users to interact with the smart home system. It can be a smart phone, tablet computer, computer and other devices. For example, users can interact with the smart home system through the application (App) or web interface on the terminal device to view device status, set scenes, receive notifications, etc.; users can also send control instructions to the cloud through the terminal device, and the cloud will forward the instructions to the corresponding smart home device; and the terminal device and the cloud maintain real-time data synchronization to ensure that users see the latest device status and system information.
[0069] For the client, it can be an application, browser, applet, etc. running on the user terminal, which is responsible for communicating with the cloud and processing user input. For example, the client can be responsible for exchanging data with the cloud, including sending control instructions, receiving device status updates, synchronizing user settings, etc.; it can also provide a user interface, process user input (such as clicks, slides, voice commands, etc.), and convert these inputs into control instructions and send them to the cloud; it can also perform some simple data processing locally, such as caching device status, processing offline operations, etc.
[0070] Smart home devices can be hardware devices that actually perform smart home tasks, such as smart light bulbs, smart sockets, smart door locks, smart cameras, etc. Among them, smart home devices can receive control instructions from the cloud and perform corresponding operations, such as turning on and off lights, adjusting temperature, locking doors, etc., and upload their own status information (such as switch status, temperature, power, etc.) to the cloud in real time for user terminals and clients to query. Optionally, some smart home devices can also have certain local processing capabilities and can perform preset automation tasks when disconnected from the Internet.
[0071] In actual application, the cloud communicates with the user terminal through the client, and the user terminal sends control instructions to the cloud through the client and receives device status updates. At the same time, the cloud is the control center of smart home devices, responsible for receiving instructions from the user terminal and forwarding them to the device, and collecting device status information. The user terminal interacts with the cloud through the client. The client is a bridge between the user and the smart home system, and the client indirectly controls the smart home device through the cloud. The client itself does not communicate directly with the device, so that there is a multi-level interactive relationship between the cloud, user terminal, client and smart home devices, forming a control architecture for controlling smart home devices, allowing users to effectively control smart home devices remotely, automatically, intelligently, etc., to enhance the user's life experience.
[0072] In an embodiment of the present invention, for a smart home device, when a user wants to modify corresponding parameters of the smart home device, the user can input a data modification operation for the smart home device through a client running on a user terminal. Based on the data modification operation, the client can first generate a corresponding data modification request and send the data modification request to the cloud. After receiving the data modification request for the smart home device sent by the client, the cloud can determine whether the client is allowed to make modifications, and in what manner to make modifications if the modification is allowed, and process the modification results, etc.
[0073] The data modification request may be information requesting parameter modification of a smart home device, which may at least include data attributes corresponding to the local device data of the smart home device on the client. Optionally, for local device data, it may be relevant device data stored on the client or smart home device, such as control parameters, device parameters, user information, etc. of the smart home device. The control parameters may be parameters for controlling the smart home device to perform corresponding device operations. The device parameters may be detailed information describing the device performance, features, and specifications of the smart home device. The user information may be information related to the user logged in on the smart home device (such as user account, password, etc.), and the present invention is not limited to this.
[0074] It should be noted that when users modify the data of smart home devices, they need to first initiate a corresponding data modification request through the client, and only after obtaining authorization from the cloud can they modify the data of the smart home devices. This can ensure the data security of smart home devices on the one hand, and reduce the frequency of data modification on the other hand, so as to reduce the probability of data conflicts and ensure data consistency.
[0075] Step 102, determining a data modification scenario corresponding to the data modification request according to the data attribute;
[0076] Data modification scenarios can be divided into complex data modification scenarios and simple data modification scenarios. The difference between the two lies in the difference in the amount of data involved in the data modification process. For simple data modification scenarios, since the amount of data involved is small, each data modification can be directly overwritten, and the data overwriting process will not bring about problems such as large resource consumption. Therefore, when the data modification request initiated by the client corresponds to a simple data modification scenario, the cloud can directly authorize the client to modify the data; for complex data modification scenarios, since the amount of data involved in each modification is large, data write conflicts are prone to occur when writing data. When the data modification request initiated by the client corresponds to a complex data modification scenario, the cloud can further authorize to ensure data consistency and reduce the probability of data conflicts.
[0077] In an embodiment of the present invention, the data attributes may at least include the data volume corresponding to the local device data. The cloud can then determine, based on the data volume, which data modification scenario the data modification request initiated by the client corresponds to. If the data volume is less than a preset threshold, it is determined that the data modification request belongs to a simple data modification scenario; if the data volume is greater than or equal to the preset threshold, it is determined that the data modification request belongs to a complex data modification scenario. Thus, by identifying the data modification scenario for the data volume involved in the local device data, it can be effectively determined whether to make further judgments on the client's data modification behavior in order to ensure data consistency and reduce the probability of data conflicts.
[0078] In the data modification scenario, the client can determine the corresponding local device data according to the data modification operation triggered by the user, and then obtain the data volume corresponding to the corresponding local device data, and carry the data volume to the data modification request, and send it to the cloud together. The cloud can determine what kind of data modification scenario the data modification request corresponds to based on the data volume, so as to execute the corresponding data modification processing strategy based on the corresponding data modification scenario, including direct authorization modification and further verification, etc. For example, the cloud can judge by the number of bytes, and the units are: B (1 byte), KB (1024 bytes), MB (1024*1024 bytes), etc., and data not exceeding 1MB or several MB can be regarded as simple data, that is, corresponding to a simple data modification scenario; conversely, data exceeding can be regarded as complex data, that is, corresponding to a complex data modification scenario, etc., and the present invention does not limit this.
[0079] Step 103: if the data modification scenario represents a complex data modification scenario for the smart home device, then obtaining a data state corresponding to the cloud device data of the smart home device in the cloud;
[0080] In an embodiment of the present invention, when the cloud determines, based on the judgment result, that the data modification request initiated by the client corresponds to a complex data modification scenario for a smart home device, the data state corresponding to the cloud device data of the smart home device in the cloud can be obtained. The data state can be used to indicate whether the cloud device data is currently in a modified state, so that by determining whether the cloud device data is in a modified state, the cloud can determine whether to allow the client to modify the data, so as to avoid at least two clients modifying the same type of data of the same smart home device at the same time, thereby reducing the probability of data conflicts.
[0081] The cloud device data may be data corresponding to the smart home device stored in the cloud. The cloud device data and the local device data may be the same or different. The two may be distinguished by corresponding version numbers. The device data with a later version number represents the result of the user's latest editing. In addition, the cloud device data, like the local device data, may at least include control parameters, device parameters, user information, etc. of the smart home device, which is not limited in the present invention.
[0082] In some feasible implementations, in addition to determining the data modification scenario based on the amount of data, the data attributes also include at least the first version number corresponding to the local device data. The cloud can also obtain the second version number corresponding to the cloud device data of the smart home device in the cloud, and then compare the first version number with the second version number. If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is the same as the second version number, that is, the local device data and the cloud device data are the same, then the data status corresponding to the cloud device data of the smart home device in the cloud is obtained, so as to further determine whether the client is allowed to modify the data based on the data status; if the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is later than the second version number, that is, the version of the local device data is newer than the cloud device data, then the local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data, so that in the data modification scenario, the version number is further combined to perform version detection on the device data that needs to be modified to ensure data integrity and consistency.
[0083] In addition, if the data modification scenario represents a simple data modification scenario for a smart home device, and the first version number is later than the second version number, local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data.
[0084] Step 104: if the data status indicates that the cloud device data is currently in an unedited state, determining a modification duration for the client, wherein the modification duration is a duration during which only the client is allowed to modify data on the smart home device;
[0085] After the cloud determines the data status corresponding to the cloud device data, if the data status indicates that the cloud device data is currently in an unedited state, the modification time for the client is determined, and the modification time is the time during which only the client is allowed to modify the data of the smart home device; if the data status indicates that the cloud device data is currently in an editing state, an editing prompt message is returned to the client, and the editing prompt message is a message indicating that the smart home device is currently in a state where data editing is not possible. Therefore, in the case of a complex data modification scenario, if the data that the user wants to modify is not currently being modified by any client, the cloud can allocate a corresponding modification time for the client, and only the corresponding client is allowed to modify the data within the modification time, which effectively avoids the problem of data editing conflicts and ensures successful writing of device data.
[0086] In one example, assuming that a user wants to modify the control parameters of a smart home device (modification of control parameters belongs to a complex data modification scenario), the user can initiate a data modification request for the smart home device through client ①. After the cloud determines that it is a complex data modification scenario, it detects whether the cloud device data of the smart home device in the cloud is in an edited state. If the current client ② is modifying the control parameters of the smart home device, the cloud can return an editing prompt message to client ① to inform client ① that the control parameters of the smart home device cannot be edited at present; if no client is currently modifying the control parameters of the smart home device, the cloud can allocate a corresponding modification time to client ①, and only client ① is allowed to modify the control parameters of the smart home device within the modification time. Therefore, when it is determined that the user's modification intention is to modify the complex data of the smart home device and the data is not edited, the corresponding modification time is allocated to the client, and the client is allowed to edit the data of the smart home device within the modification time, which effectively avoids the problem of data editing conflicts and ensures successful writing of device data.
[0087] It should be noted that when there are at least two complex data modification scenarios, if the data modification request initiated by client ① corresponds to data modification scenario A, and the data modification request initiated by client ② corresponds to data modification scenario B, etc., then since different data modification scenarios correspond to modifying different data of smart home devices, the cloud can independently process different data modification scenarios, such as allocating modification time I to client ①, which can be used to modify device data a corresponding to data modification scenario A, and allocating modification time II to client ②, which can be used to modify device data b corresponding to data modification scenario B, etc., thereby independently processing data modifications in different scenarios, the consistency and integrity of the data can be effectively guaranteed. At the same time, based on the modification time, data editing conflicts can be effectively avoided, thereby ensuring successful writing of device data.
[0088] Step 105 , in response to the target device data for the smart home device sent by the client within the modification time period, the cloud device data is updated to the target device data.
[0089] After the cloud allocates a corresponding modification duration to the client, the client can edit the data of the smart home device within the effective time period corresponding to the modification duration. Specifically, after the user edits the data of the smart home device through the client, the client can determine the edited target device data and send the target device data to the cloud. The cloud can respond to the target device data for the smart home device sent by the client within the modification duration and update the cloud device data to the target device data. Therefore, by determining that the user's modification intention is to modify the complex data of the smart home device and the data is unedited, the client is allocated a corresponding modification duration, allowing the client to edit the data of the smart home device within the modification duration, thereby effectively avoiding the problem of data editing conflicts and ensuring the successful writing of device data.
[0090] In some feasible implementations, the cloud can receive the target device data for the smart home device sent by the client, and determine the receiving time point corresponding to the target device data. The receiving time point can be the time point corresponding to when the cloud receives the target device data. Accordingly, based on the modification time length allocated to the client, the effective time period corresponding to the modification time length can be further determined, and then the cloud can match the receiving time point with the effective time period. If the receiving time point is in the effective time period, it indicates that the client has completed the data editing within the effective time period corresponding to the modification time length, and the cloud device data is updated to the target device data. On the contrary, if the receiving time point exceeds the effective time period, the cloud can obtain the third version number corresponding to the target device data, and compare the third version number with the second version number corresponding to the cloud device data. If the third version number is later than the second version number, it indicates that the version of the local device data is newer than the cloud device data, and the cloud can update the cloud device data to the target device data. It should be noted that if the third version number is the same as the second version number, the cloud can obtain the data status corresponding to the cloud device data, so as to determine whether to authorize the client to modify the data of the smart home device. The corresponding implementation process can refer to the aforementioned embodiment, which will not be repeated here.
[0091] In one example, suppose that a user edits the data of the air conditioner through client ①. When the user modifies the account information (such as the login password) of the air conditioner through client ①, the cloud can determine that the data modification belongs to a simple data modification scenario. After receiving the account information sent by the client, the cloud determines the new account information based on the version number, and then updates the account information stored in the cloud. When the user modifies the control parameters of the air conditioner through client ①, the cloud determines that it belongs to a complex data modification scenario based on the data modification request sent by the client. The cloud can obtain the corresponding control parameters of the air conditioner in the cloud and detect whether the control parameters are in the editing state. If client ② is editing the control parameters, the cloud can return a non-editable prompt message to client ①; if no client is currently editing the control parameters, the cloud can allocate the corresponding modification duration to client ①. After the client receives the modification duration, it can obtain the first receiving time point corresponding to the received modification duration, and return the first receiving time point to the cloud so that the cloud can determine the corresponding valid time period. Furthermore, if the user completes editing the control parameters of the air conditioner through the client ① within the valid time period, the cloud can update the control parameters stored in the cloud based on the new control parameters; if the valid time period has expired when the cloud receives the control parameters, the cloud can determine whether the received control parameters are newer than the control parameters on the cloud based on the version number, and if so, update the control parameters on the cloud; if not, obtain the data status corresponding to the control parameters on the cloud to determine whether the client ① is authorized to edit the data, thereby allocating a corresponding modification time to the client when it is determined that the user's modification intention is to modify complex data of the smart home device and the data is unedited, allowing the client to edit the data of the smart home device within the modification time, thereby effectively avoiding the problem of data editing conflicts and ensuring successful device data writing.
[0092] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0093] In the embodiment of the present invention, the cloud is applied to communicate with at least one smart home device and remotely control and manage data of the smart home device. The user can set the device parameters of the smart home device through the client. When the user edits the device parameters, the cloud can receive the data modification request for the smart home device sent by the client. The data modification request includes the data attributes corresponding to the local device data of the smart home device on the client, and determines the data modification scenario corresponding to the data modification request according to the data attributes. Before formally editing the device parameters, the cloud can determine the scenario corresponding to the data modification according to the data attributes, so as to flexibly adjust the corresponding processing strategy according to the data modification scenario, so as to accurately identify the situation where data editing conflicts may occur, and ensure the validity of data editing. If the data modification The scenario represents a complex data modification scenario for smart home devices. The cloud can obtain the data status corresponding to the cloud device data of the smart home devices in the cloud; if the data status represents that the cloud device data is currently in an unedited state, the modification duration for the client is determined, and the modification duration is the duration for allowing the client to modify the data of the smart home device. Then, in response to the target device data for the smart home device sent by the client within the modification duration, the cloud device data can be updated to the target device data. By determining that the user's modification intention is to modify the complex data of the smart home device and the data is in an unedited state, the corresponding modification duration is allocated to the client, allowing the client to edit the data of the smart home device within the modification duration, thereby effectively avoiding the problem of data editing conflicts and ensuring successful writing of device data.
[0094] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:
[0095] 1. When a user edits data of a smart home device through a client, the client can first apply to the cloud for editing data and send the version number of the local device data to the cloud.
[0096] 2. The cloud verifies whether the client version number is the same as the version number of the device data stored in the cloud. If they are the same, proceed to the next step; if they are not the same, the client can be asked to return the latest data.
[0097] 3. The cloud uses a flag to check whether there is a client currently editing the data. If there is a client editing, the client is temporarily not allowed to edit. If there is no client editing, the flag is updated to indicate that there is a client editing, and the client can edit, and the editable time period is, for example, 1 minute. The client editable time period set by the cloud can be set to different lengths for different data according to the complexity of the business;
[0098] 4. If the client receives a response that allows editing, the user can edit the data freely and submit the data to the cloud after editing;
[0099] 5. After the cloud receives the data, if it has not exceeded the given time period, the data will be saved to the cloud and the flag will be set to "no client editing"; if the client does not submit the data within the specified time period, the flag will automatically change to "no client editing" and the cloud will accept all client editing applications again. After the specified time, the cloud receives the data submitted by the client and checks the flag. If "there is client editing", the client data submission fails; if "there is no client editing", go to step 2.
[0100] Through the above process, the client applies to the cloud for editing operations before editing data, which is actually a method similar to the database exclusive lock, except that the database exclusive lock occurs when the database data is written to prevent data concurrent writing conflicts. In this solution, the entire process of the client writing data to the cloud is "locked" by a cloud flag. After the writing is completed or exceeds the specified time period, the flag is automatically updated to "release the lock".
[0101] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0102] Reference Figure 2 , shows a structural block diagram of a device parameter processing device provided in an embodiment of the present invention, which is applied to a cloud, and the cloud communicates with at least one smart home device, and specifically may include the following modules:
[0103] A request receiving module 201 is used to receive a data modification request for the smart home device sent by a client, wherein the data modification request includes data attributes corresponding to local device data of the smart home device on the client;
[0104] A scenario determination module 202, configured to determine a data modification scenario corresponding to the data modification request according to the data attribute;
[0105] A data status acquisition module 203 is used to acquire the data status corresponding to the cloud device data of the smart home device in the cloud if the data modification scenario represents a complex data modification scenario for the smart home device;
[0106] The duration allocation module 204 is used to determine a modification duration for the client if the data status indicates that the cloud device data is currently in an unedited state, wherein the modification duration is a duration during which only the client is allowed to modify data of the smart home device;
[0107] The data updating module 205 is used to update the cloud device data to the target device data in response to the target device data for the smart home device sent by the client within the modification time period.
[0108] In some feasible implementations, the data attribute includes at least the data volume corresponding to the local device data, and the scene determination module 202 is specifically used to:
[0109] If the data volume is less than a preset threshold, it is determined that the data modification request belongs to a simple data modification scenario;
[0110] If the data volume is greater than or equal to the preset threshold, it is determined that the data modification request belongs to a complex data modification scenario.
[0111] In some feasible implementations, the data attribute includes at least a first version number corresponding to the local device data, and the data status acquisition module 203 is specifically used to:
[0112] Obtain a second version number corresponding to the cloud device data of the smart home device in the cloud;
[0113] If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is the same as the second version number, then a data state corresponding to the cloud device data of the smart home device in the cloud is obtained.
[0114] Some possible implementations also include:
[0115] The first data processing module is used to obtain the local device data corresponding to the data modification request and update the cloud device data to the local device data if the data modification scenario represents a complex data modification scenario for the smart home device and the first version number is later than the second version number.
[0116] In some feasible implementations, the device further includes:
[0117] The second data processing module is used to obtain the local device data corresponding to the data modification request and update the cloud device data to the local device data if the data modification scenario represents a simple data modification scenario for the smart home device and the first version number is later than the second version number.
[0118] In some feasible implementations, the device further includes:
[0119] The prompt processing module is used to return an editing prompt message to the client if the data status indicates that the cloud device data is currently in an editing state, and the editing prompt message is a message indicating that the smart home device is currently in a state where data editing is not possible.
[0120] In some feasible implementations, the data updating module 205 is specifically used for:
[0121] Receiving target device data for the smart home device sent by the client;
[0122] Determine the receiving time point corresponding to the target device data and the valid time period corresponding to the modification duration, and if the receiving time point is within the valid time period, update the cloud device data to the target device data.
[0123] Some possible implementations also include:
[0124] A version comparison module, configured to obtain a third version number corresponding to the target device data if the receiving time point exceeds the valid time period, and compare the third version number with the second version number corresponding to the cloud device data;
[0125] The data updating module 205 is configured to update the cloud device data to the target device data if the third version number is later than the second version number.
[0126] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0127] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned device parameter processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0128] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned device parameter processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0129] Figure 3 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0130] The electronic device 300 includes but is not limited to: a radio frequency unit 301, a network module 302, an audio output unit 303, an input unit 304, a sensor 305, a display unit 306, a user input unit 307, an interface unit 308, a memory 309, a processor 310, and a power supply 311. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0131] It should be understood that in the embodiment of the present invention, the radio frequency unit 301 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 310 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 301 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 301 can also communicate with the network and other devices through a wireless communication system.
[0132] The electronic device provides users with wireless broadband Internet access through the network module 302, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0133] The audio output unit 303 can convert the audio data received by the RF unit 301 or the network module 302 or stored in the memory 309 into an audio signal and output it as sound. Moreover, the audio output unit 303 can also provide audio output related to a specific function performed by the electronic device 300 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 303 includes a speaker, a buzzer, a receiver, etc.
[0134] The input unit 304 is used to receive audio or video signals. The input unit 304 may include a graphics processor (GPU) 3041 and a microphone 3042, and the graphics processor 3041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 306. The image frame processed by the graphics processor 3041 can be stored in the memory 309 (or other storage medium) or sent via the radio frequency unit 301 or the network module 302. The microphone 3042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 301 in the case of a telephone call mode.
[0135] The electronic device 300 also includes at least one sensor 305, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 3061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 3061 and / or the backlight when the electronic device 300 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 305 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0136] The display unit 306 is used to display information input by the user or information provided to the user. The display unit 306 may include a display panel 3061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0137] The user input unit 307 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 307 includes a touch panel 3071 and other input devices 3072. The touch panel 3071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 3071 or near the touch panel 3071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 3071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 310, receives the command sent by the processor 310 and executes it. In addition, the touch panel 3071 can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 3071, the user input unit 307 may also include other input devices 3072. Specifically, other input devices 3072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0138] Further, the touch panel 3071 may be covered on the display panel 3061. When the touch panel 3071 detects a touch operation on or near it, it is transmitted to the processor 310 to determine the type of the touch event, and then the processor 310 provides a corresponding visual output on the display panel 3061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 3071 and the display panel 3061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 3071 and the display panel 3061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.
[0139] The interface unit 308 is an interface for connecting an external device to the electronic device 300. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 308 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 300 or may be used to transmit data between the electronic device 300 and an external device.
[0140] The memory 309 can be used to store software programs and various data. The memory 309 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 required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 309 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0141] The processor 310 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 309 and calling data stored in the memory 309, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 310 may include one or more processing units; preferably, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 310.
[0142] The electronic device 300 may also include a power supply 311 (such as a battery) for supplying power to each component. Preferably, the power supply 311 may be logically connected to the processor 310 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0143] In addition, the electronic device 300 includes some functional modules not shown, which will not be described in detail here.
[0144] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0146] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0147] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0148] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0149] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0153] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for processing device parameters, characterized in that: Applied to a cloud, the cloud is communicatively connected to at least one smart home device, and the method includes: Receiving a data modification request for the smart home device sent by a client, the data modification request including data attributes corresponding to local device data of the smart home device on the client; Determining, according to the data attribute, a data modification scenario corresponding to the data modification request; If the data modification scenario represents a complex data modification scenario for the smart home device, obtaining a data state corresponding to the cloud device data of the smart home device in the cloud; If the data status indicates that the cloud device data is currently in an unedited state, determining a modification duration for the client, wherein the modification duration is a duration during which only the client is allowed to modify data on the smart home device; In response to the target device data for the smart home device sent by the client within the modification duration, the cloud device data is updated to the target device data.
2. The method according to claim 1, characterized in that The data attribute includes at least a data volume corresponding to the local device data, and the determining, according to the data attribute, a data modification scenario corresponding to the data modification request includes: If the data volume is less than a preset threshold, it is determined that the data modification request belongs to a simple data modification scenario; If the data volume is greater than or equal to the preset threshold, it is determined that the data modification request belongs to a complex data modification scenario.
3. The method according to claim 1 or 2, characterized in that: The data attribute includes at least a first version number corresponding to the local device data, and if the data modification scenario represents a complex data modification scenario for the smart home device, obtaining a data state corresponding to the cloud device data of the smart home device in the cloud includes: Obtain a second version number corresponding to the cloud device data of the smart home device in the cloud; If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is the same as the second version number, then a data state corresponding to the cloud device data of the smart home device in the cloud is obtained.
4. The method according to claim 3, characterized in that Also includes: If the data modification scenario represents a complex data modification scenario for the smart home device, and the first version number is later than the second version number, local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data.
5. The method according to claim 3, characterized in that: The method further comprises: If the data modification scenario represents a simple data modification scenario for the smart home device, and the first version number is later than the second version number, local device data corresponding to the data modification request is obtained, and the cloud device data is updated to the local device data.
6. The method according to claim 1, characterized in that The method further comprises: If the data status indicates that the cloud device data is currently in an editing state, an editing prompt message is returned to the client, where the editing prompt message is a message indicating that the data of the smart home device is currently in a state where data editing is not possible.
7. The method according to claim 1, characterized in that The updating of the cloud device data to the target device data for the smart home device in response to the target device data sent by the client within the modification time period includes: Receiving target device data for the smart home device sent by the client; Determine the receiving time point corresponding to the target device data and the valid time period corresponding to the modification duration, and if the receiving time point is within the valid time period, update the cloud device data to the target device data.
8. The method according to claim 7, characterized in that Also includes: If the receiving time point exceeds the valid time period, obtaining a third version number corresponding to the target device data, and comparing the third version number with the second version number corresponding to the cloud device data; If the third version number is later than the second version number, the cloud device data is updated to the target device data.
9. A device for processing equipment parameters, characterized in that: Applied to a cloud, the cloud is communicatively connected with at least one smart home device, and the device comprises: A request receiving module, configured to receive a data modification request for the smart home device sent by a client, wherein the data modification request includes data attributes corresponding to local device data of the smart home device on the client; A scenario determination module, used for determining the data modification scenario corresponding to the data modification request according to the data attribute; A data status acquisition module, configured to acquire a data status corresponding to the cloud device data of the smart home device in the cloud if the data modification scenario represents a complex data modification scenario for the smart home device; A duration allocation module, configured to determine a modification duration for the client if the data status indicates that the cloud device data is currently in an unedited state, wherein the modification duration is a duration during which only the client is allowed to modify data on the smart home device; The data updating module is used to update the cloud device data to the target device data in response to the target device data for the smart home device sent by the client within the modification time period.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 8 when executing the program stored in the memory.
11. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 8.