Host election method and device of home system, equipment and storage medium

By dynamically calculating the backup host score through a dynamic weight coefficient prediction model, the problem of inaccurate host election in smart home systems is solved, enabling adaptive host election and rapid switching, thereby improving system reliability and resource utilization efficiency.

CN121300323APending Publication Date: 2026-01-09GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511313523.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing smart home systems rely on static threshold judgments for host selection, which cannot effectively perceive real-time changes in system status. This results in the selected host not being the optimal one at the moment, and uneven utilization of system resources.

Method used

By acquiring the device parameters of multiple backup hosts and the operating status parameters of the home system, a dynamic weight coefficient prediction model is used to dynamically calculate the score of the backup hosts, thereby achieving adaptive election of the optimal host and automatic switching when the main control host fails.

Benefits of technology

It enables host switching to be completed in a very short time, shortens service interruption time, improves system smoothness and reliability, and ensures balanced utilization of system resources and response efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300323A_ABST
    Figure CN121300323A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a host election method and device of a home system, equipment and a storage medium. The method comprises the following steps: acquiring equipment parameters of a plurality of standby hosts and operation state parameters of the home system; the operation state parameters comprise at least one of network state parameters, control instruction characteristics, equipment connection information and equipment distribution characteristics; determining a weight coefficient corresponding to the equipment parameter according to the operation state parameter; determining scores corresponding to the standby hosts according to the equipment parameters and the weight coefficients of the standby hosts; determining at least one target standby host according to the score corresponding to each standby device; and when the main control host meets the replacement condition, replacing the main control host with the target standby host to connect the target standby host with the plurality of household devices so as to control the plurality of household devices through the target standby host. And the weight coefficient is dynamically calculated for the equipment parameters based on the system state, so that the selected target standby host is the optimal host, and dynamic self-adaptive optimal host selection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart home technology, and in particular to a method for electing a host in a home system, a device for electing a host in a home system, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Currently, smart home systems often employ a multi-host distributed architecture to improve system reliability and processing power. In this architecture, a host is needed as the "optimal host" (or master node) to coordinate system tasks, manage resources, and maintain system state. Existing technologies use a host election and replacement mechanism based on static threshold judgments. This mechanism calculates the overall load balancing value of the cluster system and triggers virtual machine migration to achieve load rebalancing when the value exceeds a preset threshold. This approach relies on static, pre-defined resource dimensions (such as computing and network resources) for decision-making.

[0003] However, smart home environments are highly dynamic and uncertain, with device status, network conditions, and user request load all changing rapidly. Existing solutions rely on static data for analysis, and election based on static data cannot effectively perceive real-time changes in system status, resulting in the elected host not being the optimal host at the moment. Summary of the Invention

[0004] In view of the above problems, embodiments of the present invention are proposed to provide a home system host election method, a home system host election device, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.

[0005] To address the aforementioned problems, a first aspect of the present invention discloses a method for host election in a home system, wherein the home system includes a main control host, multiple backup hosts, and multiple home devices; the multiple backup hosts and multiple home devices are respectively connected to the main control host; the method includes:

[0006] Obtain the device parameters of the multiple backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics.

[0007] The weighting coefficients corresponding to the device parameters are determined based on at least one of the network status parameters, the instruction characteristics, the device connection information, and the device distribution characteristics.

[0008] The score for each backup host is determined based on the device parameters of the multiple backup hosts and the weighting coefficients.

[0009] Based on the scores corresponding to each backup device, at least one target backup host is determined;

[0010] When the main control host meets the replacement conditions, the target backup host replaces the main control host and is connected to the multiple home devices so that the multiple home devices can be controlled through the target backup host.

[0011] Optionally, the replacement condition is that the heartbeat communication between the main control host and the backup host is abnormal, or that the performance parameters of the main control host are less than a preset performance threshold.

[0012] Optionally, before connecting the target backup host to the plurality of home devices, the method further includes:

[0013] The current instruction status of the multiple home devices is sent to the target backup host. The instruction status includes at least one of the following: an unexecuted instruction queue, the progress of an instruction being executed, and the current status of all home devices, so that the target backup host can control the multiple home devices through the instruction status.

[0014] Optionally, the step of replacing the main control host with the target backup host and connecting it to the plurality of home devices includes:

[0015] If any of the multiple home devices have control commands being executed, the main control host will control the multiple home devices to complete the execution of the control commands, and then the target backup host will replace the main control host in connecting with the multiple home devices.

[0016] Optionally, determining the weighting coefficient corresponding to the device parameter based on at least one of the network state parameters, the instruction characteristics, the device connection information, and the device distribution characteristics includes:

[0017] At least one of the network status parameters, the control command characteristics, the device connection information, and the device distribution characteristics is input into a preset weight coefficient prediction model so that the weight coefficient prediction model outputs the weight coefficients corresponding to the device parameters.

[0018] Optionally, the device parameters include computing power, network latency, current load, stability, and resource utilization.

[0019] The step of determining the score corresponding to each backup host based on the device parameters of the plurality of backup hosts and the weighting coefficient includes:

[0020] The scores corresponding to the equipment parameters of each backup host are determined based on the computing power, network latency, current load, stability, resource utilization, and weighting coefficient.

[0021] The score of each backup device is determined based on the score corresponding to the device parameters of each backup host.

[0022] Optionally, the weighting coefficient prediction model is obtained in the following way:

[0023] Obtain the dataset of operating status parameters for the home system;

[0024] The dataset is normalized, and the normalized dataset is then input into the training model for training.

[0025] Obtain the predicted weights and corresponding true weights of the trained model, and determine the loss value of the trained model based on the predicted weights and the true weights;

[0026] The gradient parameters of the training model are determined based on the loss value, and the training model is optimized based on the gradient parameters to obtain the weight coefficient prediction model.

[0027] Optionally, when the main control host meets the replacement conditions, the step of replacing the main control host with the target backup host to connect with the plurality of home devices, so as to control the plurality of home devices through the target backup host, includes:

[0028] If a target backup host is identified, then the target backup host replaces the main control host and is connected to all home appliances.

[0029] If multiple target backup hosts are identified, then based on the load status of the multiple target backup hosts, the corresponding home devices are allocated to the multiple target backup hosts, and the multiple target backup hosts are connected to the corresponding home devices.

[0030] According to a second aspect of the present invention, a host selection device for a home system is disclosed. The home system includes a main control host, multiple backup hosts, and multiple home devices; the multiple backup hosts and multiple home devices are respectively connected to the main control host; the device includes:

[0031] The parameter acquisition module is used to acquire the device parameters of the multiple backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics.

[0032] The weight coefficient determination module is used to determine the weight coefficient corresponding to the device parameter based on at least one of the network status parameter, the instruction feature, the device connection information, and the device distribution feature;

[0033] The scoring determination module is used to determine the score corresponding to each backup host based on the device parameters of the multiple backup hosts and the weighting coefficients.

[0034] The target host determination module is used to determine at least one target backup host based on the scores corresponding to each backup device.

[0035] The host replacement module is used to replace the main control host with the target backup host when the main control host meets the replacement conditions, and connect the target backup host to the multiple home devices so as to control the multiple home devices through the target backup host.

[0036] Optionally, the replacement condition is that the heartbeat communication between the main control host and the backup host is abnormal, or that the performance parameters of the main control host are less than a preset performance threshold.

[0037] Optionally, it also includes:

[0038] The instruction status sending module is used to send the current instruction status of the multiple home devices to the target backup host. The instruction status includes at least one of the following: an unexecuted instruction queue, the progress of an instruction being executed, and the current status of all home devices, so that the target backup host can control the multiple home devices through the instruction status.

[0039] Optionally, the host replacement module includes:

[0040] The instruction execution submodule is used to, if there are control instructions being executed on the multiple home devices, control the multiple home devices through the main control host to complete the execution of the control instructions, and then replace the main control host with the target backup host to connect to the multiple home devices.

[0041] Optionally, the weight coefficient determination module includes:

[0042] The weight prediction submodule is used to input at least one of the network status parameters, the control command characteristics, the device connection information, and the device distribution characteristics into a preset weight coefficient prediction model, so that the weight coefficient prediction model outputs the weight coefficients corresponding to the device parameters.

[0043] Optionally, the device parameters include computing power, network latency, current load, stability, and resource utilization; the scoring determination module includes:

[0044] The parameter scoring determination submodule is used to determine the score corresponding to the device parameters of each backup host based on the computing power, network latency, current load, stability, resource utilization and weighting coefficient.

[0045] The equipment rating determination submodule is used to determine the rating of each backup device based on the rating corresponding to the equipment parameters of each backup host.

[0046] Optionally, the weighting coefficient prediction model is obtained through the following apparatus:

[0047] The dataset acquisition module is used to acquire the operating status parameter dataset of the home system;

[0048] The model training module is used to normalize the dataset and input the normalized dataset into the training model for training.

[0049] The loss value acquisition module is used to acquire the predicted weights and corresponding true weights of the training model, and determine the loss value of the training model based on the predicted weights and the true weights.

[0050] The model training module is used to determine the gradient parameters of the training model based on the loss value, optimize the training model based on the gradient parameters, and obtain the weight coefficient prediction model.

[0051] Optionally, the host replacement module includes:

[0052] The device connection submodule is used to replace the main control host with the target backup host and connect it to all home devices if a target backup host is determined; if multiple target backup hosts are determined, the module allocates the corresponding home devices to the multiple target backup hosts according to their load conditions and connects the multiple target backup hosts to the corresponding home devices.

[0053] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the host election method for a home system as described in any of the preceding embodiments.

[0054] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the host election method for a home system as described in any of the preceding embodiments.

[0055] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0056] This invention provides a method, apparatus, device, and storage medium for host election in a home system. The method includes: acquiring device parameters of multiple backup hosts and operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics; determining weight coefficients corresponding to the device parameters based on at least one of the network status parameters, command characteristics, device connection information, and device distribution characteristics; dynamically calculating the weight coefficients corresponding to the device parameters based on the system operating status parameters, achieving dynamic adaptive optimal host election, making the elected target backup host more suitable for the current scenario, effectively solving problems such as suboptimal election results and uneven system resource utilization caused by perception lag in existing technologies. Based on the device parameters and weight coefficients of multiple backup hosts, a score is determined for each backup host; based on the score corresponding to each backup device, at least one target backup host is determined; when the main control host meets the replacement conditions, the target backup host replaces the main control host and connects to multiple home devices to control the multiple home devices. When the main control host fails, automatic switching can be completed in a very short time, greatly shortening service interruption time and ensuring the smoothness of the overall system. Attached Figure Description

[0057] Figure 1 This is a flowchart illustrating the steps of a home system host election method provided in an embodiment of the present invention;

[0058] Figure 2 This is a logic block diagram of a home system host election method provided in an embodiment of the present invention;

[0059] Figure 3 This is a structural block diagram of a host selection device for a home system provided in an embodiment of the present invention. Detailed Implementation

[0060] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0061] Existing solutions rely on static data for analysis. Electing hosts based on static data cannot effectively detect real-time changes in the system state, resulting in the elected host not being the optimal host at the moment.

[0062] One of the core concepts of this invention is that by transforming static performance parameter comparison into a dynamic weighted comprehensive evaluation that combines real-time system status, the problem of suboptimal election results and unbalanced system resource utilization caused by perception lag in the prior art is effectively solved, and the performance and reliability of the election host in a real dynamic environment is significantly improved.

[0063] Reference Figure 1 This diagram illustrates a flowchart of a home system host election method according to an embodiment of the present invention. The home system includes a main control host, multiple backup hosts, and multiple home devices; the multiple backup hosts and multiple home devices are respectively connected to the main control host; the method may specifically include the following steps:

[0064] In multi-host environments, traditional host election strategies cannot be dynamically optimized based on real-time system status, leading to unsatisfactory election results and low system response efficiency. Existing solutions implement elections using static data; however, since the data changes in real time and contains uncertainties (not conforming to dynamic change patterns over a certain period), it is impossible to adjust the election results in a timely manner. Therefore, it is difficult to meet the stability requirements of multi-host environments.

[0065] Therefore, this embodiment of the invention introduces a dynamic weight allocation mechanism and a machine learning model, enabling the system to perform host election based on multiple dimensions such as the real-time load and historical performance of nodes. This avoids election result anomalies caused by data mutations and effectively improves the accuracy of election results and the system's response efficiency.

[0066] Step 101: Obtain the device parameters of the multiple backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics;

[0067] A smart home system, also known as an IoT system, is an ecosystem that connects various devices in a home through Internet of Things (IoT) technology, providing centralized control, automated management, and intelligent linkage. Its core objective is to improve comfort, security, convenience, and energy efficiency. Its core components include a smart hub / control center responsible for unified management and scheduling of all smart devices; a network connecting the system's neural network through which all devices communicate; and hardware products that are the smart terminal devices that perform the specific tasks.

[0068] The main control unit, also known as the smart home hub, is the command center of the entire smart home system. It is responsible for coordinating, managing, and driving all connected devices. The main control unit is a hardware device that acts as the local core of the smart home network, handling communication between devices, executing automation commands and scenarios, and typically serving as a bridge connecting the internet and other devices within the home. Its form can be a smart speaker, a standalone smart home hub, or directly integrated into a router. Its functions include receiving user commands, executing automation scenarios, and enabling devices from different brands to work collaboratively.

[0069] A backup host is the same type of device as the main control host. It's a backup solution designed to prevent the entire smart home system from "paralyzing" due to a failure of the main control host. The backup host is designed to quickly restore system functionality and ensure the basic operation of the smart home system in the event of a failure of the main control host.

[0070] Home appliances refer to household appliances, devices, or sensors that are connected to a network (local or internet) through Internet of Things (IoT) technology, can be remotely monitored, controlled, automated, and linked with other devices, such as smart refrigerators, smart washing machines, smart robot vacuums, and smart TVs.

[0071] The standby host's equipment parameters are its performance parameters, including its computing power, network latency, current load, stability, and resource utilization.

[0072] The operational status parameters of a smart home system are a series of quantitative data and qualitative indicators used to describe, monitor, and evaluate the current working status and health of the smart home system as a whole and its individual components. These include network status parameters, control command characteristics, device connection information, and device distribution characteristics.

[0073] Network status parameters are key indicators for diagnosing the health of smart home networks and troubleshooting connection problems. These include router network bandwidth utilization, network throughput, and network latency standard deviation. Control command characteristics represent the real-time load on the home system, describing the intensity and pattern of current user interaction with the system (whether it's sporadic commands or intensive operations), reflecting the type of stress the system is experiencing, including the interval, number, and data length of control commands in the last half hour. Device connection information describes the scale and diversity of connection methods for the managed objects, including the total number of home devices in the home scenario, the number of Bluetooth devices, the number of Wi-Fi devices, and the number of directly connected devices. Device distribution characteristics characterize the connection status between multiple smart home devices and the main control host and multiple backup hosts.

[0074] In this embodiment of the invention, each host is started and initialized. The main control host (selected as the first host configured to the home during the initialization phase) identifies the other hosts and establishes Transmission Control Protocol (TCP) communication connections. Under normal operating conditions, the main control host controls all home appliances in the home environment, while the backup host remains in a dormant state and does not control any devices. All home appliances are uniformly controlled by the main control host. The backup host can take over the main control host's work in situations such as poor network signal, enhancing the overall stability of control.

[0075] The primary controller acquires device data from other backup hosts every five minutes and uses a dynamic election system to update the optimal control host. The primary control host receives heartbeat packets from other devices every minute, and simultaneously sends heartbeat packets to other backup hosts to ensure that they can take over the devices immediately in the event of a primary control host failure. Backup hosts report their device parameters to the primary control host every five minutes. If device parameters fluctuate significantly, they should be reported immediately; the fluctuation threshold needs to be set according to the actual device conditions.

[0076] The main control host periodically obtains the device parameters of the backup host and the operating parameters of the home system in the current scenario, including at least one of the following: network status parameters, control command characteristics, device connection information, and device distribution characteristics.

[0077] Step 102: Determine the weighting coefficients corresponding to the device parameters based on at least one of the network status parameters, the instruction characteristics, the device connection information, and the device distribution characteristics;

[0078] A weighting coefficient is a numerical value used to represent the importance of a factor, indicator, or parameter in the overall evaluation or decision-making process. Weight represents the magnitude of importance or influence; coefficient represents a specific multiplier value. Generally, the larger the weighting coefficient, the greater the factor's influence on the final result.

[0079] In this embodiment of the invention, based on the obtained operating parameters of the home system in the current scenario, including network status parameters, control command characteristics, device connection information and device distribution characteristics, the network status parameters, command characteristics, device connection information and device distribution characteristics are input into a pre-trained weight coefficient prediction model. The weight coefficients corresponding to the device parameters are determined by the weight coefficients predicted by the weight coefficient prediction model.

[0080] In some embodiments, step 102 may include the following sub-steps:

[0081] Sub-step S11 involves inputting at least one of the network status parameters, the control command characteristics, the device connection information, and the device distribution characteristics into a preset weight coefficient prediction model, so that the weight coefficient prediction model outputs the weight coefficients corresponding to the device parameters.

[0082] Traditional weighting coefficients are static, pre-set values ​​(e.g., manually set to 0.6, 0.3, 0.1). Based on prior human knowledge or experience, they typically remain unchanged during system operation. A weighting coefficient prediction model, on the other hand, is an algorithm or system capable of automatically learning, calculating, and dynamically adjusting weighting coefficients. Its core objective is to predict the optimal weight allocation scheme for the current environment based on real-time or historical data, thereby making system decisions more intelligent and adaptive.

[0083] In this embodiment of the invention, network status parameters, command characteristics, device connection information and device distribution characteristics are input into a pre-trained weight coefficient prediction model, and the weight coefficients corresponding to the device parameters of the standby host are predicted by the weight coefficient prediction model.

[0084] The weighted coefficient prediction model takes the real-time operating status of the smart home system as input. This status includes one or more dimensions such as network conditions (network status parameters), user operation behavior (control command characteristics), device connection topology (device connection information), and device physical distribution (device distribution characteristics). By analyzing these complex, multi-dimensional environmental parameters, the model dynamically calculates the optimal weight allocation for the current environment. The predicted weighted coefficients determine how to weigh the different performance indicators of each backup host in the subsequent host election scoring process, thereby ensuring that the elected host is best suited to the specific needs of the current environment.

[0085] This approach surpasses traditional election strategies based on fixed rules or static weights. It dynamically adjusts based on the current system's operating context (such as network congestion, which devices users are intensively operating, and the location of those devices). For example, when the system detects increased network latency, the model automatically increases the weight of the "network latency" metric, prioritizing the host with better network connectivity rather than simply the host with the strongest computing power. By highly adapting the election strategy to the real-time environment, it fundamentally ensures the real-time performance, stability, and reliability of control. Regardless of changes in the home network environment or user behavior patterns, the system automatically allocates control to the host most capable of efficiently completing the task at that moment.

[0086] Step 103: Determine the score corresponding to each backup host based on the device parameters of the multiple backup hosts and the weighting coefficients;

[0087] In this embodiment of the invention, the scores of each standby host are determined based on the equipment parameters periodically reported by the standby host and the weight coefficients corresponding to the equipment parameters predicted by the weight coefficient prediction model, and the optimal target standby host is determined based on the scores of each standby host.

[0088] In some embodiments, the device parameters include computing power, network latency, current load, stability, and resource utilization; step 103 may include the following sub-steps:

[0089] Sub-step S21: Determine the score corresponding to the device parameters of each backup host based on the computing power, network latency, current load, stability, resource utilization and weighting coefficient;

[0090] Computing power refers to the overall performance of the backup host (from the cloud to the device) in a smart home system, encompassing data processing, algorithm execution, decision-making, and software operation. It determines how "intelligent" the backup host can be, how complex its tasks can be handled, how many devices it can support, and how fast its response time is. Network latency refers to the total time required for data packets to travel from the source device (e.g., your phone) to the destination device (e.g., a smart light bulb) and back. Current load refers to the amount of tasks, workload, or resources a system, device, or network is processing at a specific moment; it is an instantaneous value, not an average, and changes dynamically over time. Stability refers to the backup host's ability to provide continuous and reliable service, resist internal and external interference, and maintain normal and predictable functionality over long-term operation. Resource utilization is the ratio of resources used by the backup host to the total available resources, usually expressed as a percentage. It measures the degree to which resources are effectively utilized and is a core indicator for evaluating system efficiency, performance, and economy.

[0091] In this embodiment of the invention, based on the weighting coefficients corresponding to the determined device parameters, a score corresponding to the device parameters of each backup host is determined according to computing power, network latency, current load, stability, resource utilization, and the weighting coefficients. Specifically, a computing power score, a network latency score, a current load score, a stability score, and a resource utilization score are determined.

[0092] The computing power score is obtained by multiplying the computing power of the standby host by the corresponding weight coefficient. The network latency score is obtained by multiplying the network latency of the standby host by the reciprocal of the corresponding weight coefficient. The current load score is obtained by multiplying the current load score of the standby host by the reciprocal of the corresponding weight coefficient. The stability score is obtained by multiplying the stability score of the standby host by the corresponding weight coefficient. The resource utilization score is obtained by multiplying the resource utilization score of the standby host by the reciprocal of the corresponding weight coefficient.

[0093] Sub-step S22: Determine the score of each backup device based on the score corresponding to the device parameters of each backup host.

[0094] In this embodiment of the invention, based on the determined standby host's computing power score, network latency score, current load score, stability score, and resource utilization score, all parameter scores of the standby host are summed to obtain the score of each standby device. By introducing device parameters of five dimensions—computing power, network latency, current load, stability, and resource utilization—and comprehensively scoring them based on dynamic weighting coefficients, a more comprehensive, refined, and accurate host capability assessment is achieved, with a more complete set of assessment dimensions.

[0095] The score for each backup host is determined using the following formula:

[0096]

[0097] Wherein, S is the scoring function, C is the computing power score of the standby host, D is the network latency score of the standby host, L is the current load score of the standby host, and S... t The stability score of the standby host, the resource utilization score of the standby host R, and the ω C The ω D The ω L The ω St and the ω R It is the weighting coefficient.

[0098] Step 104: Based on the scores corresponding to each backup device, determine at least one target backup host;

[0099] In this embodiment of the invention, based on the determined scores of each backup host, the multiple backup hosts are sorted according to their corresponding scores, and the backup host with the highest score is selected as the target backup host. If multiple backup hosts have the same score and are all ranked high, then multiple backup hosts can be selected as the target backup host.

[0100] Step 105: When the main control host meets the replacement conditions, the target backup host replaces the main control host and connects to the multiple home devices so as to control the multiple home devices through the target backup host.

[0101] In this embodiment of the invention, when the main control host is detected to be unable to operate reliably due to faults, performance degradation, or network anomalies (i.e., the preset replacement conditions are met), a control transfer process is automatically triggered. The optimal backup host (target backup host) elected according to the election strategy is promoted to the new main control host, which takes over the control of all smart home devices, thereby ensuring the continuous and stable operation of the entire smart home system.

[0102] It achieves an automated closed loop from fault detection to power transfer, requiring no manual intervention. When the main control host fails, the system can automatically switch over in a very short time (such as heartbeat timeout time), greatly reducing service interruption time and fundamentally enhancing the reliability and availability of the smart home system.

[0103] In some embodiments, the replacement condition is that the heartbeat communication between the main control host and the backup host is abnormal, or that the performance parameters of the main control host are less than a preset performance threshold.

[0104] In this embodiment of the invention, when the main control host meets the replacement conditions, the target backup host is used to replace the main control host in connecting with multiple home devices. The replacement conditions are that the heartbeat communication between the main control host and the backup host is abnormal, or that the performance parameters of the main control host are less than a preset performance threshold.

[0105] The main control host receives heartbeat packets from other devices (backup hosts and home appliances) every minute. Simultaneously, the main control host also needs to send heartbeat packets to other backup hosts to ensure that they can take over the devices immediately in the event of a main control host failure. If a backup host does not receive a heartbeat packet from the main control host within five minutes, it is determined that the main control host has failed and will proactively take over all home appliances in the home system. Furthermore, the main control host's performance parameters are used to determine if it is performing poorly. If the main control host's performance parameters are lower than a preset performance threshold, it indicates that the main control host is underperforming and does not meet the current control conditions.

[0106] The abnormal heartbeat communication includes at least one of the following situations: any standby host does not receive a heartbeat packet from the main control host within a preset time threshold; the main control host does not receive any heartbeat packet from any standby host within a preset time threshold; or the two-way heartbeat packets between the main control host and any standby host are lost.

[0107] By using "heartbeat communication anomaly" as a condition, faults can be quickly and promptly detected and replacements triggered when the main control host malfunctions, crashes, or experiences network disconnection. This significantly reduces system downtime and enhances the system's fault tolerance. By using "performance parameters less than a preset threshold" as a condition, the main control host can be proactively replaced when its performance degrades but has not yet completely failed (e.g., excessive load, slowed processing). This prevents it from becoming a system bottleneck, thus ensuring the overall system's smoothness and responsiveness in advance, achieving proactive performance optimization.

[0108] Optionally, the process may further include the following steps before performing step 105:

[0109] The current instruction status of the multiple home devices is sent to the target backup host. The instruction status includes at least one of the following: an unexecuted instruction queue, the progress of an instruction being executed, and the current status of all home devices, so that the target backup host can control the multiple home devices through the instruction status.

[0110] In this embodiment of the invention, during the control handover between the primary control host and the backup host, the operating status of all current smart home devices is fully synchronized to the target backup host. This status includes not only the queue of instructions to be executed and the current static configuration of the devices, but also the real-time progress of the instructions being executed, ensuring a seamless transition of control context between the old and new hosts. By synchronizing the "progress of the instructions being executed," the new host can continue executing unfinished operations from a precise breakpoint, completely avoiding problems such as instruction execution interruption, inconsistent status, or device malfunctions that may occur during control transfer. This ensures the integrity and accuracy of complex and continuous operations, providing users with an extremely smooth and seamless experience.

[0111] In some embodiments, step 105 may include the following sub-steps:

[0112] In sub-step S31, if there are control commands being executed by the multiple home devices, the main control host controls the multiple home devices to complete the execution of the control commands, and then the target backup host replaces the main control host and connects to the multiple home devices.

[0113] In this embodiment of the invention, when the primary control host and the backup host need to switch control and an unfinished control instruction is detected, control will not be forcibly transferred immediately. Instead, the original primary control host will continue to perform its duties until all ongoing instruction tasks are completed normally. After all ongoing control instructions have been executed, the switchover process will be formally initiated to smoothly transfer control to the target backup host.

[0114] This completely avoids the risk of instructions being executed incompletely or the device being placed in an unknown intermediate state due to a sudden interruption of control. By ensuring that every instruction is executed completely, the reliability and security of the system's operation of the device are greatly improved, preventing logical chaos or physical damage to the device that may be caused by forced switching.

[0115] In some embodiments, step 105 may include the following sub-steps:

[0116] Sub-step S41: If a target backup host is determined, the target backup host replaces the main control host and is connected to all home devices; if multiple target backup hosts are determined, the home devices corresponding to the multiple target backup hosts are allocated according to the load of the multiple target backup hosts, and the multiple target backup hosts are connected to the corresponding home devices.

[0117] In this embodiment of the invention, based on the election results, both the traditional single-host full takeover mode and an innovative multi-host load-sharing mechanism are supported. When multiple target candidate hosts are elected, control of all devices is no longer simply transferred to a single host. Instead, based on the real-time load of each target host, the home device cluster is intelligently divided into several groups and assigned to different backup hosts for collaborative control. Each backup host controls its corresponding home device.

[0118] The multi-host load-sharing mechanism breaks through the performance bottleneck of a single host. By distributing device control tasks to multiple hosts in a distributed manner, the overall system processing capacity is linearly improved, effectively avoiding performance overload issues that may occur in scenarios with a large number of devices or intensive instructions, and ensuring smooth response speed and control experience even in a large-scale smart home ecosystem.

[0119] In some embodiments, the weighting coefficient prediction model is obtained as follows:

[0120] Obtain the dataset of operating status parameters for the home system;

[0121] The dataset is normalized, and the normalized dataset is then input into the training model for training.

[0122] Obtain the predicted weights and corresponding true weights of the trained model, and determine the loss value of the trained model based on the predicted weights and the true weights;

[0123] The gradient parameters of the training model are determined based on the loss value, and the training model is optimized based on the gradient parameters to obtain the weight coefficient prediction model.

[0124] In this embodiment of the invention, historical operating status parameters of the home system are first collected as a training dataset. After normalization preprocessing, this data is input into a machine learning model for training. During training, the loss value is calculated by comparing the weight coefficients predicted by the model with the manually labeled true weight coefficients to measure the prediction error. Then, the gradient descent algorithm is used to backpropagate the error to continuously optimize the internal parameters of the model, ultimately obtaining an intelligent model that can accurately predict the optimal weight coefficients based on the real-time system state.

[0125] By replacing the traditional method of manually setting weights based on expert experience with machine learning, it can automatically learn the mapping relationship between complex environmental patterns and weight configurations from massive amounts of historical data, making it widely applicable to various complex real-world environments.

[0126] The dataset is artificially created, essentially containing operational status parameters of the home system, including at least one of the following: network status parameters, control command characteristics, device connection information, and device distribution characteristics. (This includes router network bandwidth utilization, network throughput, network latency standard deviation; the interval, number, and data length of control commands in the last half hour; the total number of devices in the home, the number of Bluetooth devices, the number of Wi-Fi devices, and the number of directly connected devices, etc.).

[0127] The runtime status parameter dataset is standardized / normalized, and the normalized dataset is divided into a training set, a validation set (debugging parameters), and a test set (final performance test).

[0128] The partitioned training set is input into the model for training. The model uses a time-series RNN convolutional neural network. Before training begins, an initial weight matrix W and bias b are randomly generated (usually initialized to 0). The training set is then input into the model, and the data in the training set is processed layer by layer through linear transformations and activation functions, starting from the first input layer of the model, and repeated until the output layer outputs the predicted weight coefficients.

[0129] Its linear transformation is specifically z (i) =W (i) ·a (i-1) +b (i) (The weighted sum of the i-th layer) z is the output of the linear transformation of the i-th layer, W is the weight matrix, a is the output of the previous layer, which also serves as the input of this layer, b is the bias; the activation function is a (i) =f(z) (i) (Activation function). A linear transformation extracts features from the input data, resulting in a linear output. The activation function, however, introduces non-linearity, enabling the network to learn complex patterns. The combination of these two allows the neural network model to automatically learn hierarchical features from the original data, thereby calculating predicted values.

[0130] During model training, the cross-entropy loss function is chosen to calculate the loss value L, which quantifies the difference between the model's predicted values ​​and the true values, thereby optimizing the model. The loss value is obtained through the formula:

[0131]

[0132] N is the batch size, where the entire dataset is typically divided into batches for training. Y a It is the true weight vector, that is, the output value of the artificially created dataset, Y.p It is the model's predicted output vector.

[0133] Obtain the weights Y predicted by the model p And the true weight Y labeled by humans a Calculate the squared difference between the predicted value and the true value for each sample: The loss is calculated by averaging all squared differences over a batch (N samples). The loss value L is a single scalar number that measures how "bad" the model's current prediction is. The smaller L is, the better the predicted value Y is. p The closer to the true value Y a The ultimate goal of model training is to minimize this loss value L.

[0134] Starting from the output layer, the gradient (partial derivative) of the loss function L with respect to each layer's parameters and intermediate results is calculated layer by layer in reverse propagation. These gradients determine the direction and magnitude in which each parameter should be adjusted to reduce the loss L; this efficient calculation of gradients for all parameters is the core algorithm for training neural networks, indicating the direction of optimization. Gradient descent updates the parameters along the negative gradient direction, updating the model's internal parameters, including the weight matrix and biases. The gradients calculated through backpropagation are then used to update the parameters according to the following formula:

[0135]

[0136] η is the learning rate (a custom value), which controls the step size for each update. Based on the direction indicated by the gradient, all weights and biases are adjusted little by little so that the model's loss value can be reduced in the next prediction.

[0137] The validation set is used to validate the performance of the model during iterative training, and the hyperparameters are adjusted or overfitting is determined based on the validation results. When training reaches a preset stopping condition, iteration is stopped, and the performance of the final model is evaluated using the test set. The model that passes the evaluation is used as the weight coefficient prediction model.

[0138] Reference Figure 2 This diagram illustrates a logic block diagram of a home system host election method provided by an embodiment of the present invention. Figure 2 The main control host obtains the device parameters of multiple backup hosts, and outputs the weight coefficients corresponding to the device parameters based on the device parameters and the weight coefficient prediction model. The target backup host is selected as the optimal control host. When the main control host meets the replacement conditions, the main control host and the backup host switch control and the target backup host replaces the main control host to connect with multiple home devices.

[0139] This invention provides a method, apparatus, device, and storage medium for host election in a home system. The method includes: acquiring device parameters of multiple backup hosts and operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics; determining weight coefficients corresponding to the device parameters based on at least one of the network status parameters, command characteristics, device connection information, and device distribution characteristics; dynamically calculating the weight coefficients corresponding to the device parameters based on the system operating status parameters, achieving dynamic adaptive optimal host election, making the elected target backup host more suitable for the current scenario, effectively solving problems such as suboptimal election results and uneven system resource utilization caused by perception lag in existing technologies. Based on the device parameters and weight coefficients of multiple backup hosts, a score is determined for each backup host; based on the score corresponding to each backup device, at least one target backup host is determined; when the main control host meets the replacement conditions, the target backup host replaces the main control host and connects to multiple home devices to control the multiple home devices. When the main control host fails, automatic switching can be completed in a very short time, greatly shortening service interruption time and ensuring the smoothness of the overall system.

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

[0141] Reference Figure 3 This diagram illustrates a structural block diagram of a host election device for a home system according to an embodiment of the present invention. The home system includes a main control host, multiple backup hosts, and multiple home devices; the multiple backup hosts and multiple home devices are respectively connected to the main control host; specifically, it may include the following modules:

[0142] The parameter acquisition module 201 is used to acquire the device parameters of the plurality of backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information and device distribution characteristics.

[0143] The weight coefficient determination module 202 is used to determine the weight coefficient corresponding to the device parameter based on at least one of the network status parameter, the instruction feature, the device connection information, and the device distribution feature;

[0144] The scoring determination module 203 is used to determine the score corresponding to each backup host based on the device parameters of the plurality of backup hosts and the weighting coefficient;

[0145] The target host determination module 204 is used to determine at least one target backup host based on the scores corresponding to each backup device;

[0146] The host replacement module 205 is used to replace the main control host with the target backup host when the main control host meets the replacement conditions, and connect the target backup host to the multiple home devices so as to control the multiple home devices through the target backup host.

[0147] In some embodiments, the replacement condition is that the heartbeat communication between the main control host and the backup host is abnormal, or that the performance parameters of the main control host are less than a preset performance threshold.

[0148] In some embodiments, it also includes:

[0149] The instruction status sending module is used to send the current instruction status of the multiple home devices to the target backup host. The instruction status includes at least one of the following: an unexecuted instruction queue, the progress of an instruction being executed, and the current status of all home devices, so that the target backup host can control the multiple home devices through the instruction status.

[0150] In some embodiments, the host replacement module 205 includes:

[0151] The instruction execution submodule is used to, if there are control instructions being executed on the multiple home devices, control the multiple home devices through the main control host to complete the execution of the control instructions, and then replace the main control host with the target backup host to connect to the multiple home devices.

[0152] In some embodiments, the weighting coefficient determination module 202 includes:

[0153] The weight prediction submodule is used to input at least one of the network status parameters, the control command characteristics, the device connection information, and the device distribution characteristics into a preset weight coefficient prediction model, so that the weight coefficient prediction model outputs the weight coefficients corresponding to the device parameters.

[0154] In some embodiments, the device parameters include computing power, network latency, current load, stability, and resource utilization; the scoring determination module 203 includes:

[0155] The parameter scoring determination submodule is used to determine the score corresponding to the device parameters of each backup host based on the computing power, network latency, current load, stability, resource utilization and weighting coefficient.

[0156] The equipment rating determination submodule is used to determine the rating of each backup device based on the rating corresponding to the equipment parameters of each backup host.

[0157] In some embodiments, the weighting coefficient prediction model is obtained through the following means:

[0158] The dataset acquisition module is used to acquire the operating status parameter dataset of the home system;

[0159] The model training module is used to normalize the dataset and input the normalized dataset into the training model for training.

[0160] The loss value acquisition module is used to acquire the predicted weights and corresponding true weights of the training model, and determine the loss value of the training model based on the predicted weights and the true weights.

[0161] The model training module is used to determine the gradient parameters of the training model based on the loss value, optimize the training model based on the gradient parameters, and obtain the weight coefficient prediction model.

[0162] In some embodiments, the host replacement module 205 includes:

[0163] The device connection submodule is used to replace the main control host with the target backup host and connect it to all home devices if a target backup host is determined; if multiple target backup hosts are determined, the module allocates the corresponding home devices to the multiple target backup hosts according to their load conditions and connects the multiple target backup hosts to the corresponding home devices.

[0164] This invention provides a method, apparatus, device, and storage medium for host election in a home system. The method includes: acquiring device parameters of multiple backup hosts and operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics; determining weight coefficients corresponding to the device parameters based on at least one of the network status parameters, command characteristics, device connection information, and device distribution characteristics; dynamically calculating the weight coefficients corresponding to the device parameters based on the system operating status parameters, achieving dynamic adaptive optimal host election, making the elected target backup host more suitable for the current scenario, effectively solving problems such as suboptimal election results and uneven system resource utilization caused by perception lag in existing technologies. Based on the device parameters and weight coefficients of multiple backup hosts, a score is determined for each backup host; based on the score corresponding to each backup device, at least one target backup host is determined; when the main control host meets the replacement conditions, the target backup host replaces the main control host and connects to multiple home devices to control the multiple home devices. When the main control host fails, automatic switching can be completed in a very short time, greatly shortening service interruption time and ensuring the smoothness of the overall system.

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

[0166] This invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described home system host election method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0167] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described home system host election method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.

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

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

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

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

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

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

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

[0175] The present invention has provided a detailed description of a host selection method and a host selection device for a home system. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for selecting a host computer in a home system, characterized in that, The home system includes a main control unit, multiple backup control units, and multiple home devices; the multiple backup control units and multiple home devices are respectively connected to the main control unit; the method includes: Obtain the device parameters of the multiple backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics. The weighting coefficients corresponding to the device parameters are determined based on at least one of the network status parameters, the instruction characteristics, the device connection information, and the device distribution characteristics. The score for each backup host is determined based on the device parameters of the multiple backup hosts and the weighting coefficients. Based on the scores corresponding to each backup device, at least one target backup host is determined; When the main control host meets the replacement conditions, the target backup host replaces the main control host and is connected to the multiple home devices so that the multiple home devices can be controlled through the target backup host.

2. The home system host election method according to claim 1, characterized in that, The replacement condition is that the heartbeat communication between the main control host and the backup host is abnormal, or the performance parameters of the main control host are less than a preset performance threshold.

3. The home system host election method according to claim 1, characterized in that, Before connecting the target backup host to the main control host and the plurality of home appliances, the method further includes: The current instruction status of the multiple home devices is sent to the target backup host. The instruction status includes at least one of the following: an unexecuted instruction queue, the progress of an instruction being executed, and the current status of all home devices, so that the target backup host can control the multiple home devices through the instruction status.

4. The home system host election method according to claim 3, characterized in that, The step of replacing the main control host with the target backup host and connecting it to the multiple home devices includes: If any of the multiple home devices have control commands being executed, the main control host will control the multiple home devices to complete the execution of the control commands, and then the target backup host will replace the main control host in connecting with the multiple home devices.

5. The home system host election method according to claim 1, characterized in that, The step of determining the weighting coefficient corresponding to the device parameter based on at least one of the network state parameters, the instruction characteristics, the device connection information, and the device distribution characteristics includes: At least one of the network status parameters, the control command characteristics, the device connection information, and the device distribution characteristics is input into a preset weight coefficient prediction model so that the weight coefficient prediction model outputs the weight coefficients corresponding to the device parameters.

6. The home system host election method according to claim 1, characterized in that, The device parameters include computing power, network latency, current load, stability, and resource utilization. The step of determining the score corresponding to each backup host based on the device parameters of the plurality of backup hosts and the weighting coefficient includes: The scores corresponding to the equipment parameters of each backup host are determined based on the computing power, network latency, current load, stability, resource utilization, and weighting coefficient. The score of each backup device is determined based on the score corresponding to the device parameters of each backup host.

7. The home system host election method according to claim 5, characterized in that, The weighting coefficient prediction model is obtained in the following way: Obtain the dataset of operating status parameters for the home system; The dataset is normalized, and the normalized dataset is then input into the training model for training. Obtain the predicted weights and corresponding true weights of the trained model, and determine the loss value of the trained model based on the predicted weights and the true weights; The gradient parameters of the training model are determined based on the loss value, and the training model is optimized based on the gradient parameters to obtain the weight coefficient prediction model.

8. The home system host election method according to claim 1, characterized in that, When the main control host meets the replacement conditions, the target backup host replaces the main control host in connecting with the multiple home devices, so as to control the multiple home devices through the target backup host, including: If a target backup host is identified, then the target backup host replaces the main control host and is connected to all home appliances. If multiple target backup hosts are identified, then based on the load of the multiple target backup hosts, the corresponding home devices are allocated to the multiple target backup hosts, and the multiple target backup hosts are connected to the corresponding home devices.

9. A host selection device for a home system, characterized in that, The home system includes a main control unit, multiple backup control units, and multiple home devices; the multiple backup control units and multiple home devices are respectively connected to the main control unit; the device includes: The parameter acquisition module is used to acquire the device parameters of the multiple backup hosts and the operating status parameters of the home system; the operating status parameters include at least one of network status parameters, control command characteristics, device connection information, and device distribution characteristics. The weight coefficient determination module is used to determine the weight coefficient corresponding to the device parameter based on at least one of the network status parameter, the instruction feature, the device connection information, and the device distribution feature; The scoring determination module is used to determine the score corresponding to each backup host based on the device parameters of the multiple backup hosts and the weighting coefficients. The target host determination module is used to determine at least one target backup host based on the scores corresponding to each backup device. The host replacement module is used to replace the main control host with the target backup host when the main control host meets the replacement conditions, and connect the target backup host to the multiple home devices so as to control the multiple home devices through the target backup host.

10. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the host election method for a home system as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the host election method for a home system as described in any one of claims 1-8.