Equipment state control method and device, storage medium and electronic device
By communicating directly with the load switch via a multi-control switch, the problem of remote control delay for smart home devices is solved, enabling real-time device status control and improving system efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the remote control of smart home devices suffers from significant control delays due to reliance on centralized gateways, affecting the timeliness of device status control.
By communicating directly with the load switch through a multi-control switch, equipment control commands are generated, eliminating the intermediate gateway link and realizing direct control of equipment status.
It significantly reduces control latency, achieves near-instantaneous response, and improves the efficiency and timeliness of equipment status control.
Smart Images

Figure CN121967393A_ABST
Abstract
Description
Methods, devices, storage media and electronic devices for controlling equipment status Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to a method, apparatus, storage medium, and electronic device for controlling the status of a device. Background Technology
[0002] With the increasing popularity of the smart home concept, smart switches, as a core component, are gradually changing people's lifestyles. The innovation of smart switches lies in their ability to remotely control home appliances such as lights and electrical devices through wireless technology, thereby bringing a convenient, energy-saving, and personalized home experience.
[0003] Currently, remote control of home appliances largely relies on centralized gateways for command relay and status synchronization. Because commands must pass through the gateway, the entire control process suffers from significant latency.
[0004] Therefore, there is an urgent need for a new method for controlling equipment status to overcome the shortcomings of conventional technologies and improve the timeliness of equipment status control. Summary of the Invention
[0005] This application provides a method and apparatus for controlling the state of a device, a storage medium, and an electronic device, to at least solve the problems of delay and poor timeliness in device state control.
[0006] According to one aspect of the embodiments of this application, a method for controlling the state of a device is provided, comprising: when a multi-control switch receives a switch control instruction sent by a target object, determining state information of a target device that matches a target device identifier; wherein the switch control instruction carries a target device identifier of the target device; generating a device control instruction for the target device connected to the load switch based on the state information and a target switch address of the load switch; and sending the device control instruction to the load switch to instruct the load switch to control the state of the target device based on the device control instruction.
[0007] In an exemplary embodiment, determining the status information of the target device includes: obtaining a status mapping table, wherein the status mapping table includes at least: multiple device identifiers and indicator light statuses corresponding to the multiple device identifiers; matching the target device identifier of the target device with the multiple device identifiers in the status mapping table to determine the device identifier that matches the target device identifier; determining the target indicator light status corresponding to the device identifier that matches the target device identifier; and determining the status information of the target device based on the target indicator light status.
[0008] In an exemplary embodiment, based on the status information and the target switch address of the load switch, generating device control instructions for a target device connected to the load switch includes: determining the control intent of the target object based on the status information; and generating device control instructions for the target device connected to the load switch according to an intent identifier matching the control intent, the target switch address of the load switch, and the source switch address of the multi-control switch.
[0009] In an exemplary embodiment, sending the device control command to the load switch to instruct the load switch to control the device state of the target device based on the device control command includes: sending the device control command to the load switch, instructing the load switch to extract the target switch address carried in the device control command, and comparing the target switch address with a pre-stored stored switch address to obtain a first comparison result; and controlling the device state of the target device if the first comparison result shows that the target switch address and the stored switch address are consistent.
[0010] In an exemplary embodiment, after sending the device control command to the load switch to instruct the load switch to control the device state of the target device based on the device control command, the method further includes: receiving an indicator light signal fed back by the load switch and extracting the stored switch address carried by the indicator light signal, wherein the indicator light signal is determined based on the control result obtained after controlling the device state of the target device; comparing the stored switch address with the target switch address to obtain a second comparison result; and updating a state mapping table based on the indicator light state carried by the indicator light signal when the second comparison result indicates that the stored switch address and the target switch address are consistent, wherein the state mapping table is a pre-constructed mapping table for storing indicator light states.
[0011] In an exemplary embodiment, before determining the status information of the target device matching the target device identifier when the multi-control switch receives a switch control command sent by the target object, the method further includes: receiving a switch configuration command sent by the target object, wherein the switch configuration command is used to indicate the switch mode of the smart switch; entering the mode configuration interface of the smart switch based on the switch configuration command, configuring the smart switch in the mode configuration interface, and obtaining a configuration result.
[0012] In an exemplary embodiment, the switch configuration instructions include: a load configuration instruction and a multi-controller configuration instruction; configuring the smart switch in the mode configuration interface to obtain a configuration result includes: for the load configuration instruction, setting the mode of the smart switch to load mode in the mode configuration interface to configure the smart switch as a load switch; and for the multi-controller configuration instruction, setting the mode of the smart switch to multi-controller mode in the mode configuration interface to configure the smart switch as a multi-controller switch; determining the connection relationship between the load switch and the multi-controller switch, and determining the configuration result based on the connection relationship.
[0013] According to another aspect of the embodiments of this application, a device for controlling device status is also provided, comprising: a determining module, configured to determine status information of a target device matching a target device identifier when the multi-control switch receives a switch control instruction sent by a target object; wherein the switch control instruction carries a target device identifier of the target device; a generating module, configured to generate a device control instruction for the target device connected to the load switch based on the status information and a target switch address of the load switch; and a controlling module, configured to send the device control instruction to the load switch to instruct the load switch to control the device status of the target device based on the device control instruction.
[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described control method for the device state when running.
[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the device state control method through the computer program.
[0016] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program and a method for controlling the state of the aforementioned device when the computer program is executed by a processor.
[0017] This application describes a method for determining the status information of a target device when a multi-control switch receives a switch control command from the target device. Based on the acquired status information and the pre-stored target switch address of the load switch, a corresponding device control command can be generated. This generated device control command is then sent to the load switch, instructing it to control the status of the target device based on the received command. By eliminating the gateway as an intermediary, direct communication reduces data transmission layers, significantly lowers control latency, achieves near-instantaneous response, and improves overall efficiency. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 is a schematic diagram of the hardware environment of an interaction method for a smart device according to an embodiment of this application;
[0021] Figure 2 is a flowchart of one of the device state control methods according to an embodiment of this application;
[0022] Figure 3 is a schematic diagram of the architecture of a device state control method according to an embodiment of this application;
[0023] Figure 4 is a second flowchart of a device state control method according to an embodiment of this application;
[0024] Figure 5 is a flowchart of a method for controlling the state of a device according to an embodiment of this application;
[0025] Figure 6 is a structural block diagram of a device for controlling the state of an equipment according to an embodiment of this application;
[0026] Figure 7 is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] According to one aspect of the embodiments of this application, a method for controlling the state of a device is provided. This method is widely used in whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and smart house ecosystems. Optionally, in this embodiment, the above-mentioned method for controlling the state of a device can be applied to the hardware environment shown in Figure 1. As shown in Figure 1, a multi-control switch is network-connected to a load switch, and the load switch is network-connected to a target device. Both the multi-control switch and the load switch have built-in controllers responsible for processing various input and output signals, executing preset programs, and managing and coordinating wireless communication functions. When the multi-control switch receives a switch control command sent by the target device, it determines the state information of the target device. Based on the acquired state information and the pre-stored target switch address of the load switch, a corresponding device control command can be generated. The generated device control command is sent to the load switch to instruct the load switch to control the state of the target device based on the received device control command. By eliminating the gateway as an intermediary, direct communication reduces the data transmission layers, significantly reduces control latency, achieves near-instantaneous response, and improves overall efficiency.
[0030] The aforementioned networks may include, but are not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The target device may not be limited to PCs, mobile phones, tablets, smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart stoves, smart washing machines, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual systems, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaners, smart window cleaning robots, smart mopping robots, smart air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, smart door locks, smart lights, etc.
[0031] To address the aforementioned issues, this embodiment provides a device status control method, including but not limited to applications in whole-house smart digital control scenarios. Figure 2 is a flowchart of a device status control method according to an embodiment of this application, which includes the following steps S202-S206:
[0032] Step S202: When the multi-control switch receives a switch control command sent by the target object, determine the status information of the target device that matches the target device identifier; wherein, the switch control command carries the target device identifier of the target device;
[0033] In a smart home system, a multi-control switch is a smart switch that enables control of the same load device (such as lights or curtain motors) from multiple different locations. It does not connect directly to the target device but communicates with it through the load switch, sending control commands and receiving status updates.
[0034] A switch control command is a signal or data packet used in a smart home system to remotely control a target device (such as turning lights on or off). It carries the target device's identifier. When a multi-control switch receives a switch control command, it can determine the target device's status information based on its stored information. This status information typically includes the target device's current on / off state (e.g., whether the light is on or off).
[0035] Specifically, the multi-control switch first receives a switch control command. This command can originate from user operation (e.g., sent via mobile phone or physical button), timed triggering, or a forwarding from another multi-control switch. The controller of the multi-control switch parses the received control command, extracts the target device identifier, queries the target device's status information, and determines the appropriate device control strategy based on the target device's status information.
[0036] Step S204: Based on the status information and the target switch address of the load switch, generate device control instructions for the target device connected to the load switch;
[0037] In an exemplary embodiment, a device control instruction for a target device connected to the load switch is generated based on status information and the target switch address of the load switch, including: determining the control intent of the target object based on the status information; and generating the device control instruction for the target device connected to the load switch according to the intent identifier matching the control intent, the target switch address of the load switch, and the source switch address of the multi-control switch.
[0038] Understandably, when a multi-control switch receives a switch control command from a target device, it first determines the target device's status information. This status information may include the status of an indicator light (on / off), reflecting the current operating state of the target device (e.g., a light bulb). Based on this status information, the multi-control switch can determine the control intent the target device wants to execute. If the indicator light is currently on, the target device's control intent could be to turn the light bulb off (state toggling); conversely, if the indicator light is off, the target device's control intent could be to turn the light bulb on.
[0039] The multi-control switch internally stores the target switch addresses of all load switches connected to it. Once the control intent is determined, the multi-control switch can look up the target switch address. Based on the determined control intent and target switch address, the multi-control switch can generate a command data packet containing the following fields: Intent identifier: Used to identify the type of control action, such as on, off, brightness adjustment, etc. In this scenario, the control action is simply on or off, which can be represented by the numbers 0 or 1. Target switch address: The MAC (Media Access Control) address of the load switch, used to ensure that the command is only received and executed by the correct device. Source switch address: The MAC address of the multi-control switch sending the command, facilitating communication tracking and status feedback between devices. Furthermore, the intent identifier, target switch address, source switch address, and mode identifier are integrated into the data format specified by the BLE Mesh (Bluetooth Low Energy) protocol to form a complete and usable device control command.
[0040] In the above embodiments, device control commands are generated based on status information and target switch addresses, which can efficiently and accurately execute user intentions, and also realize direct communication between devices, avoiding the latency and failure rate of traditional gateway reliance.
[0041] Step S206: Send the device control command to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
[0042] It's important to note that the multi-control switch can send pre-configured device control commands to the load switch via unicast. Unicast means the device control command is sent directly and only to a specific MAC address, which is the target switch address of the load switch, avoiding unnecessary network traffic and latency. The load switch receives the device control command from the multi-control switch. The load switch checks if the source address is a valid multi-control switch address to ensure the command originates from a pre-configured controller, enhancing security. If the source address is valid, it parses the control signal (0 or 1) and changes the state of its connected target device based on the parsed signal. For example, if the control signal is 1, the load switch will turn on its load (e.g., turn on a light). If the control signal is 0, the load switch will turn off its load (e.g., turn off a light).
[0043] In steps S202-S206 above, when the multi-control switch receives the switch control command sent by the target object, the status information of the target device is determined. Based on the acquired status information and the pre-stored target switch address of the load switch, a corresponding device control command can be generated. The generated device control command is sent to the load switch to instruct the load switch to control the status of the target device based on the received device control command. By eliminating the gateway as an intermediary, direct communication reduces the data transmission layers, significantly reduces control latency, achieves near-instantaneous response, and improves overall efficiency.
[0044] In an exemplary embodiment, determining the status information of the target device includes: obtaining a status mapping table, wherein the status mapping table includes at least: multiple device identifiers and indicator light statuses corresponding to the multiple device identifiers; matching the target device identifier of the target device with the multiple device identifiers in the status mapping table to determine the device identifier that matches the target device identifier; determining the target indicator light status corresponding to the device identifier that matches the target device identifier; and determining the status information of the target device based on the target indicator light status.
[0045] The status mapping table is a database or data structure that stores all device identifiers and their corresponding indicator light statuses, maintained internally within the multi-control switch. This mapping table is dynamically updated to reflect the status of each device in the current network. The mapping table must contain at least the following elements: Device Identifier: A unique identifier for each device. Indicator Light Status: The current status of the indicator light corresponding to each device identifier, which can be represented by a number (e.g., 0 for off, 1 for on) or a Boolean value.
[0046] When it's necessary to determine the status of a specific device (i.e., the target device), the first step is to find the target device's identifier. Next, this identifier is compared and matched against multiple device identifiers in a status mapping table to determine the corresponding entry. Once an entry matching the target device identifier is found, the indicator light status under that entry can be read. This directly reflects the target device's current status. Finally, based on the obtained indicator light status, detailed status information of the device can be further interpreted and displayed. For example, if a smart light bulb's indicator light status is 1, it can be determined that the bulb is on; otherwise, it is off.
[0047] In the above embodiments, matching device identifiers and querying status through a status mapping table is a crucial mechanism for maintaining device status monitoring and control. It ensures that the current status of each networked device can be grasped in real time and accurately, thereby enabling refined management and a user-friendly interface.
[0048] In an exemplary embodiment, sending a device control command to a load switch to instruct the load switch to control the device state of a target device based on the device control command includes: sending the device control command to the load switch, instructing the load switch to extract the target switch address carried in the device control command, and comparing the target switch address with a pre-stored stored switch address to obtain a first comparison result; and controlling the device state of the target device if the first comparison result shows that the target switch address and the stored switch address are consistent.
[0049] Specifically, the device control command is generated in the multi-control switch and includes the target device's address (target switch address), control signal (on / off), and possibly other control parameters. After receiving the device control command, the load switch first parses the target switch address in the command and compares it with a locally stored list of switch addresses. This locally stored list of switch addresses (stored switch addresses) contains the MAC addresses of all devices that are allowed to be controlled; this list is set by the user or the system during the configuration phase.
[0050] The load switch parses and compares the target switch address in the received device control command with the locally stored list of switch addresses. If the addresses match (i.e., the first comparison result is consistent), the load switch can execute the subsequent control action. If they do not match (i.e., the first comparison result is inconsistent), the load switch can ignore the command to ensure network security.
[0051] When addresses match, the load switch will control the connected loads (such as lights, appliances, etc.) based on the switch status value carried in the device control command. After executing the control action, the load switch will generate a status feedback command, containing the current status of the load and its own MAC address, and broadcast it via the BLE Mesh network. After receiving the status feedback command, the multi-control switch updates its status mapping table to ensure that the status information of all related devices remains synchronized.
[0052] In the above embodiments, from the generation and sending of device control commands by the multi-control switch, to the receiving, verification and execution of commands by the load switch, and then to status feedback, the entire process ensures the safety, reliability and consistency of the device control process. Even in scenarios with complex network topology and numerous devices, the device status can be effectively controlled and monitored.
[0053] In an exemplary embodiment, after sending a device control command to a load switch to instruct the load switch to control the device state of the target device based on the device control command, the method further includes: receiving an indicator light signal fed back by the load switch and extracting the stored switch address carried by the indicator light signal, wherein the indicator light signal is determined based on the control result obtained after controlling the device state of the target device; comparing the stored switch address with the target switch address to obtain a second comparison result; and updating the state mapping table based on the indicator light state carried by the indicator light signal if the second comparison result indicates that the stored switch address and the target switch address are consistent, wherein the state mapping table is a pre-constructed mapping table for storing indicator light states.
[0054] When a load switch executes a device control command received from a multi-control switch, it generates an indicator light signal based on the status of the controlled device (on or off) and broadcasts this signal via the BLE Mesh network. All multi-control switches in listening mode will attempt to capture this broadcast signal.
[0055] After receiving an indicator light signal, the multi-control switch first extracts the stored switch address from the signal. The stored switch address refers to the MAC address of the associated load switch pre-stored within the multi-control switch. This address is set during the configuration phase to establish the communication relationship between the multi-control switch and the load switch. After extracting the stored switch address, the multi-control switch compares it with the target switch address to confirm whether the feedback signal comes from the expected load switch. This comparison step ensures that the multi-control switch only processes feedback from pre-authorized devices, improving system security and accuracy. After confirming the signal is correct, the multi-control switch reads the indicator light status (0 for off, 1 for on) from the indicator light signal.
[0056] Subsequently, the multi-control switch updates its internal state mapping table along with the corresponding target device identifier. The state mapping table records the current state of all devices associated with the multi-control switch, ensuring that the multi-control switch can reflect and control the state of these devices in real time. Updating the state mapping table keeps the state information of all devices related to the multi-control switch synchronized, allowing both user interface displays and subsequent control strategy adjustments to be based on the latest state information.
[0057] In the above embodiments, by receiving indicator light signals from the load switch, extracting and comparing the stored switch address with the target switch address, and updating the status mapping table after confirming the correct signal source, the consistency of device status can be effectively monitored and maintained. This mechanism not only enhances the system's security and robustness but also ensures that users can obtain device status in real time, improving the overall interactive experience and system management efficiency.
[0058] In an exemplary embodiment, before determining the status information of the target device matching the target device identifier when the multi-control switch receives a switch control command sent by the target object, the method further includes: receiving a switch configuration command sent by the target object, wherein the switch configuration command is used to indicate the configuration of the switch mode of the smart switch; entering the mode configuration interface of the smart switch based on the switch configuration command, configuring the smart switch in the mode configuration interface, and obtaining the configuration result.
[0059] The target user can select the smart switch to be configured and specify its switching mode via a mobile phone, web interface, or other interactive methods. This can include single-control, dual-control, or multi-control modes, as well as specific control logic or linkage rules with other devices. The selection of the target user can be converted into a switch configuration instruction. This instruction must contain at least the following information: the unique identifier of the smart switch (such as a MAC address); the specified switching mode; and related configuration details.
[0060] Specifically, the switch configuration command is sent to the corresponding smart switch via the network. The smart switch receives the configuration command, parses the information in the command, and verifies its completeness and legitimacy. This includes confirming that the command originates from a trusted target and that the command content is within the capabilities of the current device. If the command passes verification, the smart switch enters the mode configuration interface. This interface can be built-in or presented through an interactive interface with the target (e.g., remote access via an app). In the mode configuration interface, the smart switch will change its internal configuration parameters according to the received configuration command, including but not limited to switch mode, network settings, and associations with other devices. After configuration, the smart switch generates a configuration result, which may include confirmation information, new operating status, or a parameter list. The smart switch then feeds back the configuration result to the target via the network. This ensures that the user can immediately know whether the configuration was successful and the current status of the smart switch.
[0061] In the above embodiments, the entire smart switch configuration process begins with the sending of instructions from the target object and includes steps such as receiving, parsing, verifying, configuring, and providing feedback on the results of the smart switch. This process not only ensures that users can flexibly define the behavior of the smart switch, but also enhances the transparency and reliability of the configuration process through the feedback mechanism.
[0062] In an exemplary embodiment, the switch configuration instructions include: a load configuration instruction and a multi-control configuration instruction; configuring the smart switch in the mode configuration interface to obtain a configuration result includes: for the load configuration instruction, setting the mode of the smart switch to load mode in the mode configuration interface to configure the smart switch as a load switch; and for the multi-control configuration instruction, setting the mode of the smart switch to multi-control mode in the mode configuration interface to configure the smart switch as a multi-control switch; determining the connection relationship between the load switch and the multi-control switch, and determining the configuration result based on the connection relationship.
[0063] The smart switch receives configuration commands from a target object (such as a user via a mobile app). These commands include the user's specification of the smart switch's operating mode, either load mode or multi-control mode. Configuration commands are divided into load configuration commands and multi-control configuration commands. The former configures the smart switch as a load switch, while the latter configures it as a multi-control switch.
[0064] In the mode configuration interface, the smart switch sets its mode to load mode according to the instruction. This means the smart switch will directly control the physical load (such as lights, appliances, etc.), and its status (on / off) will directly reflect the status of the physical load. Similarly, after receiving a multi-control configuration instruction, the smart switch also enters the mode configuration interface. In this interface, the smart switch sets its mode to multi-control mode, meaning it will act as the initiator of control instructions without directly associating with the physical load. It will store the addresses of one or more load switches so that when it receives a user control instruction, it can forward the instruction to the corresponding load switch.
[0065] When a smart switch is configured in multi-control mode, its connection relationship with load switches needs to be further determined. This typically involves the user specifying the addresses of one or more load switches through the target object, enabling the multi-control switch to send control commands in a targeted manner. The multi-control switch stores the determined connection relationship (i.e., the MAC addresses of the load switches) in its internal storage, generating a connection relationship list or mapping table as the basis for subsequent control command sending. After completing the mode configuration and connection relationship determination, the smart switch performs internal verification to ensure that all settings are correct. The configuration result includes the new mode of the smart switch (load or multi-control) and the associated device address information. If the smart switch is configured as a multi-control switch, the configuration result may also include its stored list of load switch addresses. Finally, the smart switch will feed back the configuration result to the target object, such as the user's mobile app, via the network. The feedback information should clearly show the current operating mode and connection status of the smart switch, allowing the user to confirm whether the configuration was completed as expected.
[0066] In the above embodiments, by receiving switch configuration commands and setting the load mode or multi-control mode of the smart switch in the mode configuration interface, as well as determining the connection relationship between related devices, the smart switch network can flexibly adapt to different control needs. The configuration result feedback mechanism ensures that users can verify the configuration effect in real time, improving system availability and user satisfaction.
[0067] Obviously, the embodiments described above are only some embodiments of this application, and not all embodiments. To better understand the above method, the following description, in conjunction with embodiments, illustrates the process, but is not intended to limit the technical solutions of the embodiments of this application:
[0068] Dual / multi-control smart switches are a core function of smart homes. Existing multi-control smart switch systems typically consist of: a multi-control switch (without a direct load, only sending control commands, including buttons, indicator lights, and a communication module), a load switch (connected to loads such as lights, executing commands, including load interfaces, indicator lights, and a communication module), and a gateway (acting as a communication hub, responsible for command forwarding, status synchronization, and storing device associations). These three components must work together to achieve multi-control functionality. A common implementation is as follows: during user configuration, the association between the multi-control switch and the load switch is directly stored on the gateway; after receiving on / off button messages from the multi-control switch, the gateway sends load on / off control commands to the load switch; upon receiving a successful control response from the load switch, it sends indicator light on / off control commands to the multi-control switch. Because the system relies on the gateway for sending and receiving control commands, a response delay may occur.
[0069] Based on this, this application provides a method for controlling the state of a device. Referring to Figure 3, which is a schematic diagram of the architecture involved in the method for controlling the state of a device:
[0070] As shown in Figure 3, the entire process of device status control involves: a mobile app, smart switch A (i.e., multi-control switch 1), smart switch B (i.e., multi-control switch 2), and smart switch C (load switch). The mobile app is used only during the configuration phase, supporting the configuration of smart switches as load switches or multi-control switches, and sending the load switch MAC address to the multi-control switch. Smart switches include BLE Mesh modules, 1-4 sets (buttons, load switches, indicator lights); they can be configured via the mobile app as: load switches (e.g., smart switch C): button, load, and indicator light functions are bound; pressing the button activates the load switch, and the corresponding indicator light turns on or off; it can receive unicast commands from the multi-control switch and control the load, broadcasting its own status after execution, and does not store any multi-control switch addresses. Multi-control switches (e.g., smart switch A, smart switch B): button, load, and indicator light functions are separated; pressing the button does not change the load or indicator light; it stores the load switch MAC address, sends unicast control commands after pressing the button, receives load switch broadcasts, and updates the indicator lights.
[0071] During the configuration phase, the mobile app can interact with smart switch A and smart switch B to complete the MAC address configuration of smart switch C and determine the device control commands. During the operation phase, smart switch A and smart switch B can send device control commands to smart switch C via unicast. After executing the device control commands, smart switch C can synchronize its status with smart switch A and smart switch B via broadcast, without any third-party intermediaries.
[0072] As shown in Table 1, all BLE Mesh unicast / broadcast data uses a unified format, and the fields and their meanings are as follows:
[0073] Table 1
[0074]
[0075] Referring to Figure 4, the flowchart for configuring a smart switch via a mobile app is as follows: Configure smart switch C as a load switch: Access the device details page of smart switch C; Configure button 1 of smart switch C as load mode; Send the configuration to smart switch C: Configure button 1 as load mode; Configure smart switch A as a dual-control / multi-control switch: Access the device details page of smart switch A; Configure button 1 of smart switch A as dual-control / multi-control mode; Select the switch load to be controlled as load 1 of switch C; Send the configuration to smart switch A: Configure button 1 as dual-control / multi-control mode, and save the MAC address of switch C.
[0076] Referring to Figure 5, which is a flowchart of a device state control method in one embodiment, Figure 5 uses smart switch A controlling smart switch C, with smart switch C synchronizing its state to smart switches A and B as an example. Specifically, after a button is pressed, the current indicator light state is determined, and the switch state (source address A, destination address C) is sent via BLE Mesh unicast. If it is on, 0-off is sent; if it is off, 1-on is sent. Based on the received BLE Mesh unicast control data at destination address C, the load and indicator light are controlled according to the switch state. The multi-control switch receives the broadcast data at source address C and controls the indicator light according to the switch state.
[0077] The control module of smart switch A reads its own indicator light status: if the indicator light is on (indicating that smart switch C is currently on), it generates the following command: Mode=32, Key=1, State=0, Source MAC=A's MAC address, Dest MAC=C's MAC address; if the indicator light is off (indicating that C is currently off), it generates the following command: Mode=32, Key=1, State=1, Source MAC=A's MAC address, Dest MAC=C's MAC address; the control module of A → BLE Mesh module → sends the command to the MAC address of C in unicast form.
[0078] The BLE Mesh module of smart switch C receives data and parses the Dest MAC: if the Dest MAC is not equal to its own MAC, the data is discarded directly; if the Dest MAC is equal to its own MAC, the State value is parsed: if State=1, the load is powered on and the indicator light is on; if State=0, the load is powered off and the indicator light is off.
[0079] After completing load control, smart switch C immediately generates a broadcast command: Mode=32, Key=1, State=current load state (1 / 0), Source MAC=C's MAC, Dest MAC=broadcast identifier; data flow: C's control module → BLE Mesh module → broadcast to all surrounding BLE Mesh devices.
[0080] The BLE Mesh modules of smart switches A and B receive broadcast data and parse the Source MAC: if the Source MAC is not equal to the MAC of the load switch stored in itself (i.e., the MAC of C), the data is discarded directly; if the Source MAC is equal to the MAC of C, the State value is parsed and the state of its own indicator light is updated to the State value (State=1→on, State=0→off); the state of the indicator lights of A and B is completely consistent with the state of the load / indicator light of C.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0082] This embodiment also provides a device for controlling the state of a device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0083] Figure 6 is a structural block diagram of a device for controlling the state of an equipment according to an embodiment of the present application. The device includes:
[0084] The determination module 62 is used to determine the status information of the target device that matches the target device identifier when the multi-control switch receives a switch control command sent by the target object; wherein the switch control command carries the target device identifier of the target device;
[0085] The generation module 64 is used to generate device control instructions for the target device connected to the load switch based on the status information and the target switch address of the load switch.
[0086] The control module 66 is used to send the device control command to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
[0087] The aforementioned device, upon receiving a switch control command from the target device via a multi-control switch, determines the status information of the target device. Based on the acquired status information and the pre-stored target switch address of the load switch, a corresponding device control command can be generated. This generated device control command is sent to the load switch, instructing it to control the status of the target device based on the received command. By eliminating the gateway as an intermediary, direct communication reduces data transmission layers, significantly lowers control latency, achieves near-instantaneous response, and improves overall efficiency.
[0088] In an exemplary embodiment, the determining module 62 is further configured to obtain a status mapping table, wherein the status mapping table includes at least: multiple device identifiers and indicator light statuses corresponding to the multiple device identifiers; match the target device identifier of the target device with the multiple device identifiers in the status mapping table to determine the device identifier that matches the target device identifier; determine the target indicator light status corresponding to the device identifier that matches the target device identifier; and determine the status information of the target device based on the target indicator light status.
[0089] In an exemplary embodiment, the generation module 64 is further configured to determine the control intent of the target object based on the status information; and generate a device control instruction for the target device connected to the load switch according to the intent identifier matching the control intent, the target switch address of the load switch, and the source switch address of the multi-control switch.
[0090] In an exemplary embodiment, the control module 66 is further configured to send the device control command to the load switch, instructing the load switch to extract the target switch address carried in the device control command, and compare the target switch address with a pre-stored stored switch address to obtain a first comparison result; and control the device state of the target device if the first comparison result is that the target switch address and the stored switch address are consistent.
[0091] In an exemplary embodiment, the device further includes an update module; the update module is configured to receive an indicator light signal fed back by the load switch and extract a stored switch address carried by the indicator light signal, wherein the indicator light signal is determined based on a control result obtained after controlling the device state of the target device; compare the stored switch address with the target switch address to obtain a second comparison result; and update a state mapping table based on the indicator light state carried by the indicator light signal when the second comparison result indicates that the stored switch address is consistent with the target switch address, wherein the state mapping table is a pre-constructed mapping table for storing indicator light states.
[0092] In an exemplary embodiment, the above-described apparatus further includes: a processing module, configured to receive a switch configuration instruction sent by the target object, wherein the switch configuration instruction is used to indicate the switch mode of the smart switch; enter the mode configuration interface of the smart switch based on the switch configuration instruction, and configure the smart switch in the mode configuration interface to obtain a configuration result.
[0093] In an exemplary embodiment, the processing module is further configured to: set the mode of the smart switch to load mode in the mode configuration interface in response to the load configuration instruction, so as to configure the smart switch as a load switch; and set the mode of the smart switch to multi-control mode in the mode configuration interface in response to the multi-control configuration instruction, so as to configure the smart switch as a multi-control switch; determine the connection relationship between the load switch and the multi-control switch, and determine the configuration result based on the connection relationship.
[0094] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0095] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0096] S1, when the multi-control switch receives a switch control command sent by the target object, determine the status information of the target device that matches the target device identifier; wherein, the switch control command carries the target device identifier of the target device;
[0097] S2, Based on the status information and the target switch address of the load switch, generate device control instructions for the target device connected to the load switch;
[0098] S3, the device control command is sent to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
[0099] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0100] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0101] An embodiment of this application also provides an electronic device, as shown in FIG7, which includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps of any of the above method embodiments through the computer program.
[0102] Optionally, in this embodiment, the processor 704 can be configured to perform the following steps via a computer program:
[0103] S1, when the multi-control switch receives a switch control command sent by the target object, determine the status information of the target device that matches the target device identifier; wherein, the switch control command carries the target device identifier of the target device;
[0104] S2, Based on the status information and the target switch address of the load switch, generate device control instructions for the target device connected to the load switch;
[0105] S3, the device control command is sent to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
[0106] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0107] Optionally, those skilled in the art will understand that the structure shown in FIG7 is merely illustrative and does not limit the structure of the electronic device described above. For example, the electronic device may also include more or fewer components (such as network interfaces) than shown in FIG7, or have a different configuration than that shown in FIG7.
[0108] The memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the device state control method and apparatus in this embodiment. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, thereby realizing the aforementioned device state control method. The memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include memory remotely located relative to the processor 704, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 702 may be used, but is not limited to, to store information such as system configuration files. As an example, as shown in FIG7, the memory 702 may include, but is not limited to, the determination module 62, generation module 64, and control module 66 in the aforementioned device state control apparatus. In addition, it may include, but is not limited to, other module units in the aforementioned device state control apparatus (such as the first determination module and the second determination module), which will not be described in detail in this example.
[0109] Optionally, the transmission device 706 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 704 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one example, the transmission device 704 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0110] In addition, the above-mentioned electronic device also includes: a display 708; and a connection bus 710 for connecting the various module components in the above-mentioned electronic device.
[0111] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.
[0112] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.
[0113] The embodiments described herein also provide a computer program that includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the above method embodiments.
[0114] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0115] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0116] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for controlling the state of equipment, characterized in that, Performed by a smart switch; The smart switch includes: a multi-control switch and a load switch connected to the multi-control switch; it includes: when the multi-control switch receives a switch control command sent by a target object, determining the status information of a target device that matches a target device identifier; wherein the switch control command carries the target device identifier of the target device; generating a device control command for the target device connected to the load switch based on the status information and the target switch address of the load switch; and sending the device control command to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
2. The method according to claim 1, characterized in that, Determining the status information of the target device includes: obtaining a status mapping table, wherein the status mapping table includes at least: multiple device identifiers and indicator light statuses corresponding to the multiple device identifiers; matching the target device identifier of the target device with the multiple device identifiers in the status mapping table to determine the device identifier that matches the target device identifier; determining the target indicator light status corresponding to the device identifier that matches the target device identifier; and determining the status information of the target device based on the target indicator light status.
3. The method according to claim 1, characterized in that, Based on the status information and the target switch address of the load switch, a device control instruction for the target device connected to the load switch is generated, including: determining the control intention of the target object based on the status information; and generating the device control instruction for the target device connected to the load switch according to the intention identifier matching the control intention, the target switch address of the load switch, and the source switch address of the multi-control switch.
4. The method according to claim 1, characterized in that, Sending the device control command to the load switch to instruct the load switch to control the device state of the target device based on the device control command includes: sending the device control command to the load switch, instructing the load switch to extract the target switch address carried in the device control command, and comparing the target switch address with a pre-stored switch address to obtain a first comparison result; and controlling the device state of the target device if the first comparison result shows that the target switch address and the stored switch address are consistent.
5. The method according to claim 1, characterized in that, After sending the device control command to the load switch to instruct the load switch to control the device state of the target device based on the device control command, the method further includes: receiving an indicator light signal fed back by the load switch and extracting the stored switch address carried by the indicator light signal, wherein the indicator light signal is determined based on the control result obtained after controlling the device state of the target device; comparing the stored switch address with the target switch address to obtain a second comparison result; and updating the state mapping table based on the indicator light state carried by the indicator light signal when the second comparison result indicates that the stored switch address and the target switch address are consistent, wherein the state mapping table is a pre-constructed mapping table for storing indicator light states.
6. The method according to claim 1, characterized in that, Before determining the status information of the target device that matches the target device identifier when the multi-control switch receives a switch control command sent by the target object, the method further includes: receiving a switch configuration command sent by the target object, wherein the switch configuration command is used to indicate the switch mode of the smart switch; entering the mode configuration interface of the smart switch based on the switch configuration command, configuring the smart switch in the mode configuration interface, and obtaining the configuration result.
7. The method according to claim 6, characterized in that, The switch configuration instructions include: a load configuration instruction and a multi-control configuration instruction; configuring the smart switch in the mode configuration interface to obtain a configuration result includes: for the load configuration instruction, setting the mode of the smart switch to load mode in the mode configuration interface to configure the smart switch as a load switch; and for the multi-control configuration instruction, setting the mode of the smart switch to multi-control mode in the mode configuration interface to configure the smart switch as a multi-control switch; determining the connection relationship between the load switch and the multi-control switch, and determining the configuration result based on the connection relationship.
8. A device for controlling the status of equipment, characterized in that, include: A determination module is used to determine the status information of a target device that matches the target device identifier when the multi-control switch receives a switch control command sent by the target object; wherein the switch control command carries the target device identifier of the target device; a generation module is used to generate a device control command for the target device connected to the load switch based on the status information and the target switch address of the load switch; a control module is used to send the device control command to the load switch to instruct the load switch to control the device status of the target device based on the device control command.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.