CN114205178A - Equipment linkage method and device, storage medium and electronic equipment - Google Patents
Equipment linkage method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN114205178A CN114205178A CN202111506142.1A CN202111506142A CN114205178A CN 114205178 A CN114205178 A CN 114205178A CN 202111506142 A CN202111506142 A CN 202111506142A CN 114205178 A CN114205178 A CN 114205178A
- Authority
- CN
- China
- Prior art keywords
- equipment
- state information
- linkage
- state
- preset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 230000005540 biological transmission Effects 0.000 claims description 18
- 238000004891 communication Methods 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 12
- 238000010586 diagram Methods 0.000 description 6
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2803—Home automation networks
- H04L12/2807—Exchanging configuration information on appliance services in a home automation network
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Automation & Control Theory (AREA)
- Computer Networks & Wireless Communication (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a method and a device for equipment linkage, a storage medium and electronic equipment, and belongs to the technical field of intelligent home furnishing. Wherein, the method comprises the following steps: acquiring first state information of first equipment; judging whether the first state information of the first equipment meets a preset linkage condition or not; and if the preset linkage condition is met, controlling the equipment state of the second equipment. According to the invention, the state information of the first equipment is acquired through the second equipment, and whether the second equipment needs linkage control is judged, so that the technical problem that the equipment in the prior art consumes server resources in linkage is solved, mutual subscription and linkage control among the equipment are realized, when the equipment reaches the preset linkage condition, the equipment judges the preset linkage condition, executes the preset operation to realize linkage among the equipment, and the consumption of the server resources is reduced.
Description
Technical Field
The invention relates to the technical field of smart home, in particular to a method and a device for equipment linkage, a storage medium and electronic equipment.
Background
In the prior art, along with the development of the internet of things, more and more users are interested in using intelligent household equipment. With the increase of the number of home intelligent devices, it is slightly troublesome to control a plurality of devices, so that linkage among the intelligent devices is generated at the same time.
In the prior art, equipment is triggered by a sensor to serve as a linkage condition or report to a server, and when the linkage preset condition is met, the server judges and sends an instruction to another equipment, so that the consumption of server resources is increased.
In view of the above problems in the related art, no effective solution has been found at present.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a device linkage method and device, a storage medium and electronic equipment.
According to an aspect of an embodiment of the present application, there is provided a method for linking devices, including: acquiring first state information of first equipment; judging whether the first state information of the first equipment meets a preset linkage condition or not; and if the preset linkage condition is met, controlling the equipment state of the second equipment.
Further, acquiring the first state information of the first device includes: receiving a first theme message sent by a Message Queue Telemetry Transmission (MQTT) server, wherein the MQTT server is connected with the first device and the second device through message middleware; extracting a device identification of the first device from the first subject message; judging whether the first device and the second device are in the same family group or not based on the device identification;
and if the first device and the second device are in the same family group, extracting the first state information from the first theme message.
Further, after controlling the device state of the second device, the method further comprises: generating second state information of the second device; searching a second subject matched with the second state information; and pushing the second state information serving as the load data of the second theme to an MQTT server.
Further, before determining whether the first state information of the first device satisfies a preset linkage condition, the method further includes: receiving a control instruction issued by an MQTT server, wherein the control instruction is used for indicating a linkage condition for linkage with the second equipment; storing the linkage condition to the second device.
According to an aspect of an embodiment of the present application, there is provided another method for linking devices, including: judging whether the equipment state of the first equipment is changed or not; if the equipment state of the first equipment is changed, acquiring the latest first state information from the first equipment through Message Queue Telemetry Transmission (MQTT) and storing the latest first state information to a first theme; and pushing the first state information to second equipment so that the second equipment controls the equipment state of the second equipment through the first state information, wherein the first equipment and the second equipment are connected with an MQTT server through message middleware.
Further, before pushing the first state information to the second device, the method further comprises: receiving a control instruction submitted by a control terminal, wherein the control instruction is used for indicating the mutual linkage of the first equipment and the second equipment and linkage conditions; judging whether the first device and the second device are in the same family group; and if the first equipment and the second equipment are in the same family group, the control instruction is sent to the second equipment.
Further, determining whether the first device and the second device are in the same family group includes: acquiring a first MAC address of the first device and acquiring a second MAC address of the second device; searching a first family ID to which the first MAC address belongs and a second family ID to which the second MAC address belongs;
judging whether the first family ID is the same as the second family ID; and if the first family ID is the same as the second family ID, determining that the first equipment and the second equipment are in the same family group.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for linking devices, including: the acquisition module is used for acquiring first state information of the first equipment; the judging module is used for judging whether the first state information of the first equipment meets a preset linkage condition; and the control module is used for controlling the equipment state of the second equipment if the preset linkage condition is met.
Further, the obtaining module comprises: the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a first theme message sent by a message queue telemetry transmission MQTT server, and the MQTT server is connected with the first equipment and the second equipment through message middleware; a first extracting unit, configured to extract a device identifier of the first device from the first subject message; a first judging unit, configured to judge whether the first device and the second device are in a same family group based on the device identifier; a second extracting unit, configured to extract the first status information from the first topic message if the first device and the second device are in the same family group.
Further, the apparatus further comprises: the generating module is used for generating second state information of the second equipment after the control module controls the equipment state of the second equipment; the searching module is used for searching a second theme matched with the second state information; and the pushing module is used for pushing the second state information serving as the load data of the second theme to the MQTT server.
Further, the apparatus further comprises: the receiving module is used for receiving a control instruction sent by an MQTT server before the judging module judges whether the first state information of the first equipment meets the preset linkage condition, wherein the control instruction is used for indicating the linkage condition for linkage with the second equipment; and the storage module is used for storing the linkage condition to the second equipment.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for linking devices, including: the judging module is used for judging whether the equipment state of the first equipment is changed or not; the acquisition module is used for acquiring latest first state information from the first equipment through Message Queue Telemetry Transmission (MQTT) and storing the latest first state information to a first theme if the equipment state of the first equipment is changed; and the pushing module is used for pushing the first state information to second equipment so that the second equipment controls the equipment state of the second equipment through the first state information, wherein the first equipment and the second equipment are connected with the MQTT server through message middleware.
Further, the apparatus further comprises: the receiving module is used for receiving a control instruction submitted by a control terminal, wherein the control instruction is used for indicating the mutual linkage of the first equipment and the second equipment and the linkage condition; the second judgment module is used for judging whether the first equipment and the second equipment are in the same family group; and the issuing module is used for issuing the control command to the second equipment if the first equipment and the second equipment are in the same family group.
Further, the second determination module includes: a first obtaining unit, configured to obtain a first MAC address of the first device, and obtain a second MAC address of the second device; a first searching unit, configured to search for a first home ID to which the first MAC address belongs and a second home ID to which the second MAC address belongs; a first judgment unit configured to judge whether the first home ID is the same as the second home ID; a first determining unit, configured to determine that the first device and the second device are in the same family group if the first family ID is the same as the second family ID.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for linking devices, including: the first judgment module is used for judging whether the equipment state of the first equipment is changed or not; the acquisition module is used for acquiring latest first state information from the first equipment through Message Queue Telemetry Transmission (MQTT) and storing the latest first state information to a first theme if the equipment state of the first equipment is changed; and the pushing module is used for pushing the first state information to second equipment so that the second equipment controls the equipment state of the second equipment through the first state information, wherein the first equipment and the second equipment are connected with the MQTT server through message middleware.
Further, the apparatus further comprises: the receiving module is used for receiving a control instruction submitted by a control terminal before the pushing module pushes the first state information to the second equipment, wherein the control instruction is used for indicating the mutual linkage and linkage condition of the first equipment and the second equipment; the second judgment module is used for judging whether the first equipment and the second equipment are in the same family group; and the issuing module is used for issuing the control command to the second equipment if the first equipment and the second equipment are in the same family group.
Further, the second determination module includes: an obtaining unit, configured to obtain a first MAC address of the first device and obtain a second MAC address of the second device; a searching unit, configured to search for a first home ID to which the first MAC address belongs and a second home ID to which the second MAC address belongs; a determination unit configured to determine whether the first home ID is the same as the second home ID; a determining unit, configured to determine that the first device and the second device are in the same family group if the first family ID is the same as the second family ID.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program, wherein the program performs the above-mentioned method steps when executed.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein: a memory for storing a computer program; a processor for executing the above method steps by executing the program stored in the memory.
Embodiments of the present application also provide a computer program product containing instructions, which when run on a computer, cause the computer to perform the steps of the above method.
According to the invention, first state information of the first equipment is obtained; judging whether the first state information of the first equipment meets a preset linkage condition or not; if the preset linkage condition is met, the equipment state of the second equipment is controlled, the state information of the first equipment is obtained through the second equipment, whether the second equipment needs linkage control or not is judged, the technical problem that equipment linkage consumes server resources in the prior art is solved, mutual subscription and linkage control among the equipment are achieved, when the equipment reaches the preset linkage condition, the preset linkage condition is judged through the equipment, preset operation is executed to achieve linkage among the equipment, and consumption of the server resources is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a block diagram of the hardware architecture of a device of an embodiment of the present invention;
FIG. 2 is a flow chart of a method of device linkage according to an embodiment of the present invention;
FIG. 3 is a flow chart of another method of device linkage according to an embodiment of the present invention;
FIG. 4 is an overall flow chart of a method of device linkage according to an embodiment of the present invention;
FIG. 5 is a block diagram of an apparatus for linkage of equipment according to an embodiment of the present invention;
fig. 6 is a block diagram of another apparatus for linking devices according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
The method provided by the first embodiment of the application can be executed in smart home equipment, an MQTT server or similar operation devices. Taking the operation on the smart home device as an example, fig. 1 is a hardware structure block diagram of the smart home device according to the embodiment of the present invention. As shown in fig. 1, the smart home device may include one or more processors 102 (only one is shown in fig. 1) (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, and optionally, the smart home device may further include a transmission device 106 for communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the smart home device. For example, smart home devices may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a smart home device program, for example, a software program and a module of application software, such as a device linkage program corresponding to a device linkage method in an embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the device linkage program stored in the memory 104, that is, implementing the method described above. The memory 104 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 examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the smart home devices via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The specific example of the network may include a wireless network provided by a communication provider of the smart home device. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In the present embodiment, a method for linking devices is provided, and fig. 2 is a flowchart of a method for linking devices according to an embodiment of the present invention, applied to a second device, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring first state information of first equipment;
in one embodiment of this embodiment, the second device obtains first state information of the first device, where the first state information represents current state information of the first device, and the state information may be changed. Optionally, the number of the second devices is greater than or equal to one, and here, a plurality of devices may also obtain the first state information of the first device at the same time.
Step S204, judging whether the first state information of the first equipment meets a preset linkage condition;
in an implementation manner of this embodiment, after the second device receives the first state information of the first device, it is determined whether the first state information of the first device meets a preset linkage condition, where the preset linkage condition is stored in the second device, optionally, the number of the second devices is greater than or equal to one, where there may also be multiple devices that simultaneously determine whether the first state information of the first device meets the preset linkage condition, so as to implement a timely linkage operation of the multiple smart home devices.
And step S206, if the preset linkage condition is met, controlling the equipment state of the second equipment.
In one implementation of this embodiment, when the state of the first device meets the linkage condition preset in the second device, the second device changes its state to complete the linkage between the devices, optionally, the number of the second devices is greater than or equal to one, and the multiple devices can simultaneously realize the linkage, thereby avoiding the problem of complex operation caused by controlling the multiple devices.
Through the steps, first state information of the first equipment is obtained; judging whether the first state information of the first equipment meets a preset linkage condition or not; if the preset linkage condition is met, the equipment state of the second equipment is controlled, the state information of the first equipment is obtained through the second equipment, whether the second equipment needs linkage control or not is judged, the technical problem that equipment linkage consumes server resources in the prior art is solved, mutual subscription and linkage control among the equipment are achieved, when the equipment reaches the preset linkage condition, the preset linkage condition is judged through the equipment, preset operation is executed to achieve linkage among the equipment, and consumption of the server resources is reduced.
In this embodiment, acquiring the first state information of the first device includes:
s11, receiving a first topic Message sent by a Message Queue Telemetry Transport (MQTT) server, where the MQTT server is connected to the first device and the second device through a Message middleware;
the first subject message includes state information of the first device, identification information of the device, and the like, and the second device can analyze the ciphertext through the server public key and the device public key after receiving the data in the first subject message.
S12, extracting the device identification of the first device from the first subject message;
the subscribed first subject message contains device identification, such as MAC address information of the device, etc., because such identification information is unique, the device-related family dependency can be queried through such unique information.
S13, judging whether the first device and the second device are in the same family group based on the device identification;
s14, if the first device and the second device are in the same family group, extracting the first status information from the first theme message.
In the above steps, whether the devices are in the same family group or not is inquired through the device identification, and if the devices are in the same family group, the first state information can be extracted from the first subject message. The definition of the family group is determined by the user through the actual situation, the number of the devices in the family group can be set, the family group can comprise more than two devices, the user can pull other users into the family group, and at the moment, the devices of the two parties are in the same family group.
The first state information can be extracted from the first theme message only after the equipment is identified and inquired in the same family group, optionally, the step of inquiring whether the equipment is in the same family group or not can be carried out before the equipment subscribes the theme, whether the equipment is in the same family group or not is firstly inquired and judged by the equipment identification, the corresponding themes can be mutually subscribed between the equipment when the equipment is in the same family group, so that the linkage safety of the equipment is ensured, and then the state information in the theme can be acquired without judging whether the equipment is in the same family group or not.
In this embodiment, after controlling the device state of the second device, the method further includes: generating second state information of the second device; searching a second subject matched with the second state information; and pushing the second state information serving as the load data of the second theme to an MQTT server.
After the device state of the second device is changed in the above steps, current second state information is generated and recorded, a second theme matched with the second state information is searched, and data is pushed to the MQTT server, where the current second state information is provided for subscribing other devices, and different devices correspond to corresponding themes.
Optionally, after the state information of the second device is changed, after the other devices acquire the second state information of the second device in the second theme, whether preset linkage conditions related to the second device, stored in the other devices, are met is continuously judged, and if the preset linkage conditions related to the second device are met, the linkage conditions of the devices can be set through linkage of the other devices, so that the devices are sequentially judged to be linked.
In this embodiment, before determining whether the first state information of the first device satisfies the preset linkage condition, the method further includes: receiving a control instruction issued by an MQTT server, wherein the control instruction is used for indicating a linkage condition for linkage with the second equipment; storing the linkage condition to the second device.
The steps store the preset linkage conditions to the equipment by receiving the control instruction issued by the MQTT server, and the issuing of the linkage conditions needs to be confirmed by the server, namely the equipment of the same family group can be linked, so that the linkage safety is ensured.
In this embodiment, a method for linking devices is further provided, and fig. 3 is a flowchart of another method for linking devices according to an embodiment of the present invention, which is applied to an MQTT server, as shown in fig. 3, the flowchart includes the following steps:
step S302, judging whether the equipment state of the first equipment is changed;
step S304, if the equipment state of the first equipment is changed, obtaining the latest first state information from the first equipment through message queue telemetry transmission MQTT, and storing the latest first state information to a first theme;
step S306, pushing the first state information to a second device, so that the second device controls a device state of the second device through the first state information, where the first device and the second device are connected to an MQTT server through a message middleware.
In an implementation manner of this embodiment, the MQTT server determines whether state information of the first device changes, and if the state information of the first device changes, acquires the latest first state information of the first device, stores the latest first state information to the first theme, and pushes the first state information to the second device through the message middleware. When the device state information changes, data are sent to an IOT (Internet of Things) server through the MQTT, the data are encrypted through a device key when the data are sent by the device, and the IOT server decrypts the data through a server public key. After data are decrypted, encryption protection is carried out by using a secret key of the server and the data are forwarded to the MQTT server, the IOT server and the MQTT server are mutually independent and can interact through a network, the public key of the server is solidified into the server by both the IOT server and the MQTT server when the server is established, and the public key of equipment in the equipment is also solidified into the equipment. Since the server public key is not transmitted through the network but is solidified in the device, there is no possibility of leakage, i.e., security is guaranteed.
In the embodiment, the server does not need to issue the control command for linkage, so that the problems of linkage failure and the like caused by the loss of the issued command do not need to be worried about, and the usability of the linkage method is ensured.
In this embodiment, before pushing the first state information to the second device, the method further includes: receiving a control instruction submitted by a control terminal, wherein the control instruction is used for indicating the mutual linkage of the first equipment and the second equipment and linkage conditions; judging whether the first device and the second device are in the same family group; and if the first equipment and the second equipment are in the same family group, the control instruction is sent to the second equipment.
In the above steps, the user presets the linkage condition by submitting the control instruction to the control terminal, the server judges that the equipment sends the preset linkage condition to the equipment after the equipment is in the same family group, the linkage safety is ensured, and the equipment can acquire the equipment state information in the theme after the equipment is judged in the same family group in the previous step or can subscribe the corresponding theme mutually after the equipment is judged in the same family group, so that the double safety guarantee of equipment linkage is realized.
In this embodiment, determining whether the first device and the second device are in the same family group includes: acquiring a first MAC address of the first device and acquiring a second MAC address of the second device; searching a first family ID to which the first MAC address belongs and a second family ID to which the second MAC address belongs; judging whether the first family ID is the same as the second family ID; and if the first family ID is the same as the second family ID, determining that the first equipment and the second equipment are in the same family group.
Optionally, in the above step, the number of the obtained MAC addresses is greater than or equal to two, and the number of the searched home IDs is defined by the user according to the actual situation.
Fig. 4 is an overall flowchart of a method for linking devices according to an embodiment of the present invention, including: a device state change; encrypting by using the equipment key; the IOT server decrypts the data by using the server public key and encrypts and transmits the data to the MQTT server by using the server public key; devices of the same family group subscribe to each other; judging whether the equipment reaches a preset condition or not; and if the preset conditions are met, the devices are linked.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus necessary general mechanical equipment, and certainly can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solution of the present invention or portions thereof contributing to the prior art may be embodied in the form of software controlled mechanical device, where the software is stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk), and includes several instructions for enabling a mechanical device (e.g. smart home device, etc.) to execute the method according to the embodiments of the present invention.
Example 2
In this embodiment, a device for linking devices is further provided, which is used to implement the above embodiments and preferred embodiments, and the description of the device is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of an apparatus for linking devices according to an embodiment of the present invention, applied to a first device, as shown in fig. 5, the apparatus including: an acquisition module 50, a decision module 52, a control module 54, wherein,
an obtaining module 50, configured to obtain first status information of a first device;
the judging module 52 is configured to judge whether the first state information of the first device meets a preset linkage condition;
and the control module 54 is configured to control the device state of the second device if the preset linkage condition is met.
Optionally, the obtaining module includes: the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a first theme message sent by a message queue telemetry transmission MQTT server, and the MQTT server is connected with the first equipment and the second equipment through message middleware; a first extracting unit, configured to extract a device identifier of the first device from the first subject message; a first judging unit, configured to judge whether the first device and the second device are in a same family group based on the device identifier; a second extracting unit, configured to extract the first status information from the first topic message if the first device and the second device are in the same family group.
Optionally, the apparatus further comprises: the generating module is used for generating second state information of the second equipment after the control module controls the equipment state of the second equipment; the searching module is used for searching a second theme matched with the second state information; and the pushing module is used for pushing the second state information serving as the load data of the second theme to the MQTT server.
Optionally, the apparatus further comprises: the receiving module is used for receiving a control instruction sent by an MQTT server before the judging module judges whether the first state information of the first equipment meets the preset linkage condition, wherein the control instruction is used for indicating the linkage condition for linkage with the second equipment; and the storage module is used for storing the linkage condition to the second equipment.
Fig. 6 is a block diagram of another device linkage apparatus according to an embodiment of the present invention, which is applied to an MQTT server, and as shown in fig. 6, the apparatus includes: a first determining module 60, an obtaining module 62, and a pushing module 64, wherein,
a first determining module 60, configured to determine whether a device state of the first device changes;
an obtaining module 62, configured to obtain latest first state information from the first device through message queue telemetry transmission MQTT if a device state of the first device changes, and store the latest first state information in a first theme;
a pushing module 64, configured to push the first state information to a second device, so that the second device controls a device state of the second device through the first state information, where the first device and the second device are connected to an MQTT server through message middleware.
Optionally, the apparatus further comprises: the receiving module is used for receiving a control instruction submitted by a control terminal before the pushing module pushes the first state information to the second equipment, wherein the control instruction is used for indicating the mutual linkage and linkage condition of the first equipment and the second equipment; the second judgment module is used for judging whether the first equipment and the second equipment are in the same family group; and the issuing module is used for issuing the control command to the second equipment if the first equipment and the second equipment are in the same family group.
Optionally, the second determining module includes: an obtaining unit, configured to obtain a first MAC address of the first device and obtain a second MAC address of the second device; a searching unit, configured to search for a first home ID to which the first MAC address belongs and a second home ID to which the second MAC address belongs; a determination unit configured to determine whether the first home ID is the same as the second home ID; a determining unit, configured to determine that the first device and the second device are in the same family group if the first family ID is the same as the second family ID.
The embodiment also provides a system, which comprises the first device and the second device in the above embodiments, and an MQTT server.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Example 3
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring first state information of the first device;
s2, judging whether the first state information of the first equipment meets a preset linkage condition;
and S3, if the preset linkage condition is met, controlling the equipment state of the second equipment.
Optionally, in this embodiment, the storage medium may be further configured to store a computer program for executing the following steps:
s1, judging whether the device state of the first device is changed;
s2, if the equipment state of the first equipment changes, obtaining the latest first state information from the first equipment through message queue telemetry transmission MQTT, and storing the latest first state information to a first theme;
and S3, pushing the first state information to a second device, so that the second device controls the device state of the second device through the first state information, wherein the first device and the second device are connected with an MQTT server through message middleware.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic device may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring first state information of the first device;
s2, judging whether the first state information of the first equipment meets a preset linkage condition;
and S3, if the preset linkage condition is met, controlling the equipment state of the second equipment.
Optionally, in this embodiment, the processor may be further configured to execute, by the computer program, the following steps:
s1, judging whether the device state of the first device is changed;
s2, if the equipment state of the first equipment changes, obtaining the latest first state information from the first equipment through message queue telemetry transmission MQTT, and storing the latest first state information to a first theme;
and S3, pushing the first state information to a second device, so that the second device controls the device state of the second device through the first state information, wherein the first device and the second device are connected with an MQTT server through message middleware.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.
Claims (10)
1. A method of linking devices, comprising:
acquiring first state information of first equipment;
judging whether the first state information of the first equipment meets a preset linkage condition or not;
and if the preset linkage condition is met, controlling the equipment state of the second equipment.
2. A method of linking devices according to claim 1, wherein obtaining first status information of a first device comprises:
receiving a first theme message sent by a Message Queue Telemetry Transmission (MQTT) server, wherein the MQTT server is connected with the first device and the second device through message middleware;
extracting a device identification of the first device from the first subject message;
judging whether the first device and the second device are in the same family group or not based on the device identification;
and if the first device and the second device are in the same family group, extracting the first state information from the first theme message.
3. A method of linking devices according to claim 1, wherein after controlling the device state of the second device, the method further comprises:
generating second state information of the second device;
searching a second subject matched with the second state information;
and pushing the second state information serving as the load data of the second theme to an MQTT server.
4. The method for linking the devices according to claim 1, wherein before determining whether the first state information of the first device satisfies the preset linking condition, the method further comprises:
receiving a control instruction issued by an MQTT server, wherein the control instruction is used for indicating a linkage condition for linkage with the second equipment;
storing the linkage condition to the second device.
5. A method of linking devices, comprising:
judging whether the equipment state of the first equipment is changed or not;
if the equipment state of the first equipment is changed, acquiring the latest first state information from the first equipment through Message Queue Telemetry Transmission (MQTT) and storing the latest first state information to a first theme;
and pushing the first state information to second equipment so that the second equipment controls the equipment state of the second equipment through the first state information, wherein the first equipment and the second equipment are connected with an MQTT server through message middleware.
6. The method of device linkage according to claim 5, wherein prior to pushing the first status information to the second device, the method further comprises:
receiving a control instruction submitted by a control terminal, wherein the control instruction is used for indicating the mutual linkage of the first equipment and the second equipment and linkage conditions;
judging whether the first device and the second device are in the same family group;
and if the first equipment and the second equipment are in the same family group, the control instruction is sent to the second equipment.
7. The method of claim 6, wherein determining whether the first device and the second device are in the same family group comprises:
acquiring a first MAC address of the first device and acquiring a second MAC address of the second device;
searching a first family ID to which the first MAC address belongs and a second family ID to which the second MAC address belongs;
judging whether the first family ID is the same as the second family ID;
and if the first family ID is the same as the second family ID, determining that the first equipment and the second equipment are in the same family group.
8. An apparatus for linking devices, comprising:
the acquisition module is used for acquiring first state information of the first equipment;
the judging module is used for judging whether the first state information of the first equipment meets a preset linkage condition;
and the control module is used for controlling the equipment state of the second equipment if the preset linkage condition is met.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program is operative to perform the method steps of any of the preceding claims 1 to 7.
10. An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; wherein:
a memory for storing a computer program;
a processor for performing the method steps of any of claims 1 to 7 by executing a program stored on a memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111506142.1A CN114205178B (en) | 2021-12-10 | 2021-12-10 | Equipment linkage method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111506142.1A CN114205178B (en) | 2021-12-10 | 2021-12-10 | Equipment linkage method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114205178A true CN114205178A (en) | 2022-03-18 |
CN114205178B CN114205178B (en) | 2022-10-11 |
Family
ID=80652408
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111506142.1A Active CN114205178B (en) | 2021-12-10 | 2021-12-10 | Equipment linkage method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114205178B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114785850A (en) * | 2022-05-07 | 2022-07-22 | 北京卡特加特智能科技有限公司 | Scene linkage synchronization method and system |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160127145A1 (en) * | 2014-10-29 | 2016-05-05 | Xiaomi Inc. | Method and server for controlling smart devices based on predefined scenario mode |
CN106357745A (en) * | 2016-08-29 | 2017-01-25 | 北京小米移动软件有限公司 | Linkage method and device for intelligent terminals |
CN107179698A (en) * | 2017-05-25 | 2017-09-19 | 青岛海信日立空调系统有限公司 | The inter-linked controlling method and device of a kind of home appliance |
US20180091391A1 (en) * | 2015-06-30 | 2018-03-29 | Amazon Technologies, Inc. | Device State Management |
CN111629259A (en) * | 2020-05-22 | 2020-09-04 | 海信视像科技股份有限公司 | Image quality adjusting method and display device |
CN112073273A (en) * | 2020-08-26 | 2020-12-11 | 北京小米移动软件有限公司 | Device state control method, device state control apparatus, and storage medium |
CN112099968A (en) * | 2020-08-26 | 2020-12-18 | 珠海格力电器股份有限公司 | Equipment control method, device, system, storage medium and electronic device |
CN112230616A (en) * | 2020-10-28 | 2021-01-15 | 腾讯科技(深圳)有限公司 | Linkage control method and device and linkage middleware |
CN113141383A (en) * | 2020-01-18 | 2021-07-20 | 佛山市云米电器科技有限公司 | Device information subscription method, client, server, system and storage medium |
CN113516331A (en) * | 2020-11-25 | 2021-10-19 | 腾讯科技(深圳)有限公司 | Building data processing method and device |
CN113542078A (en) * | 2020-04-14 | 2021-10-22 | 深圳爱根斯通科技有限公司 | Equipment linkage method and device, electronic equipment and storage medium |
CN113741273A (en) * | 2021-09-01 | 2021-12-03 | 珠海太川云社区技术股份有限公司 | Multi-gateway scene linkage control method and system |
-
2021
- 2021-12-10 CN CN202111506142.1A patent/CN114205178B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160127145A1 (en) * | 2014-10-29 | 2016-05-05 | Xiaomi Inc. | Method and server for controlling smart devices based on predefined scenario mode |
US20180091391A1 (en) * | 2015-06-30 | 2018-03-29 | Amazon Technologies, Inc. | Device State Management |
CN106357745A (en) * | 2016-08-29 | 2017-01-25 | 北京小米移动软件有限公司 | Linkage method and device for intelligent terminals |
CN107179698A (en) * | 2017-05-25 | 2017-09-19 | 青岛海信日立空调系统有限公司 | The inter-linked controlling method and device of a kind of home appliance |
CN113141383A (en) * | 2020-01-18 | 2021-07-20 | 佛山市云米电器科技有限公司 | Device information subscription method, client, server, system and storage medium |
CN113542078A (en) * | 2020-04-14 | 2021-10-22 | 深圳爱根斯通科技有限公司 | Equipment linkage method and device, electronic equipment and storage medium |
CN111629259A (en) * | 2020-05-22 | 2020-09-04 | 海信视像科技股份有限公司 | Image quality adjusting method and display device |
CN112073273A (en) * | 2020-08-26 | 2020-12-11 | 北京小米移动软件有限公司 | Device state control method, device state control apparatus, and storage medium |
CN112099968A (en) * | 2020-08-26 | 2020-12-18 | 珠海格力电器股份有限公司 | Equipment control method, device, system, storage medium and electronic device |
CN112230616A (en) * | 2020-10-28 | 2021-01-15 | 腾讯科技(深圳)有限公司 | Linkage control method and device and linkage middleware |
CN113516331A (en) * | 2020-11-25 | 2021-10-19 | 腾讯科技(深圳)有限公司 | Building data processing method and device |
CN113741273A (en) * | 2021-09-01 | 2021-12-03 | 珠海太川云社区技术股份有限公司 | Multi-gateway scene linkage control method and system |
Non-Patent Citations (2)
Title |
---|
VANIA,KANISIUS KARYONO,I. HARGYO TRI NUGROHO: "Smart dog feeder design using wireless communication, MQTT and Android client", 《2016 INTERNATIONAL CONFERENCE ON COMPUTER, CONTROL, INFORMATICS AND ITS APPLICATIONS (IC3INA)》 * |
吴启亮: "基于规则的智能家居设备联动机制的研究与实现", 《中国优秀硕士学位论文全文数据库》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114785850A (en) * | 2022-05-07 | 2022-07-22 | 北京卡特加特智能科技有限公司 | Scene linkage synchronization method and system |
Also Published As
Publication number | Publication date |
---|---|
CN114205178B (en) | 2022-10-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112995348B (en) | Control method, device and system of Internet of things equipment | |
CN102802059B (en) | The method of configuration machine top box, Apparatus and system | |
US11449319B2 (en) | Method and apparatus for downloading bundle to smart secure platform by using activation code | |
CN104137618A (en) | Shared network access via a peer-to-peer link | |
CN106789378B (en) | Information prevents leakage method and system in smart home | |
CN107041171B (en) | Low-power-consumption Bluetooth BLE device, data updating system and method | |
CN106713004B (en) | Router adaptation method and system | |
CN104412629A (en) | Immediate connection following device discovery | |
CN112130461A (en) | Smart home control method and device, storage medium and electronic device | |
CN106571942B (en) | Configuration data updating method, client and server | |
CN111859127A (en) | Subscription method and device of consumption data and storage medium | |
CN114205178B (en) | Equipment linkage method and device, storage medium and electronic equipment | |
CN105517102A (en) | Method, device and equipment for enabling wireless network equipment to be connected with hot spot | |
CN112637931A (en) | Method and device for establishing network connection | |
CN112689316A (en) | Binding method and device of intelligent equipment, storage medium and electronic device | |
CN111541772A (en) | Intelligent reminding method and system and cloud server | |
CN106452828A (en) | Provision protocol transmission-based terminal configuration method and system | |
CN111787514A (en) | Method and device for acquiring equipment control data, storage medium and electronic device | |
CN107872533B (en) | Information-pushing method, device, server and storage medium | |
CN113965904A (en) | Device registration method, device and storage medium | |
CN106231393B (en) | Video information processing method, device and system | |
CN111141015A (en) | Remote air conditioner control method | |
CN113076380B (en) | Data synchronization method, device, system, equipment and storage medium | |
CN113660645B (en) | Device configuration method and device, electronic device and storage medium | |
CN114301989A (en) | Information transmission method, device and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |