Internet of things equipment linkage control method, system and device and storage medium
1. A linkage control method for Internet of things equipment is characterized by comprising the following steps:
receiving state information uploaded by each independent device by using a centralized control program;
acquiring first-class state information uploaded by corresponding first-class independent equipment from the centralized control program by using a first linkage management program and a corresponding first communication mapping relation;
calling a control program corresponding to the first type state information of the first type independent equipment by using the first linkage management program to generate corresponding control information;
sending the control information to the centralized control program by using the first linkage management program;
and sending the control information to corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
2. The internet of things equipment linkage control method according to claim 1, wherein the process of acquiring the first type of state information uploaded by the corresponding first type of independent equipment from the centralized control program by using the first linkage management program and the corresponding communication mapping relation comprises the following steps:
and the first linkage management program loads a corresponding state information acquisition script by using the first communication mapping relation, and acquires the first type of state information uploaded by the corresponding first type of independent equipment from the centralized control program by using the state information acquisition script.
3. The internet of things equipment linkage control method according to claim 2, wherein the process of calling a control program corresponding to the first type of state information of the first type of independent equipment by using the first linkage management program to generate corresponding control information comprises:
the first linkage management program searches a control script function corresponding to the first type state information by utilizing the first type state information of the first type independent equipment and a pre-generated information control mapping relation;
and the first linkage management program runs the control script function and generates corresponding control information according to the first type of state information.
4. The utility model provides a thing networking device coordinated control system which characterized in that includes:
the state information receiving module is used for receiving the state information uploaded by each independent device by using the centralized control program;
the state information acquisition module is used for acquiring first-class state information uploaded by corresponding first-class independent equipment from the centralized control program by utilizing a first linkage management program and a corresponding first communication mapping relation;
the control information generation module is used for calling a control program corresponding to the first type state information of the first type independent equipment by using the first linkage management program to generate corresponding control information;
the control information sending module is used for sending the control information to the centralized control program by utilizing the first linkage management program;
and the control information synchronization module is used for sending the control information to the corresponding independent equipment and other corresponding linkage management programs by utilizing the centralized control program so as to control each equipment and synchronize the control information.
5. The internet of things equipment linkage control system according to claim 4, wherein the status information acquisition module is specifically configured to load a corresponding status information acquisition script by the first linkage management program using the first communication mapping relationship, and acquire the first type of status information uploaded by the corresponding first type of independent equipment from the centralized control program using the status information acquisition script.
6. The Internet of things equipment linkage control system according to claim 5, wherein the control information generation module comprises:
the script searching unit is used for searching a control script function corresponding to the first type of state information by the first linkage management program by utilizing the first type of state information of the first type of independent equipment and a pre-generated information control mapping relation;
and the script running unit is used for the first linkage management program to run the control script function and generate corresponding control information according to the first type of state information.
7. The utility model provides a thing networking device coordinated control device which characterized in that includes:
a memory for storing a computer program;
a processor for executing the computer program to implement the internet of things device linkage control method according to any one of claims 1 to 3.
8. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the internet of things device linkage control method according to any one of claims 1 to 3.
Background
With the development of the internet and intelligent terminals, in order to further facilitate the life experience of people, various devices are networked so as to be convenient for receiving the remote control of people, and the concept of the internet of things is greatly developed.
The method for establishing linkage in the prior art is that a specified comparison rule and a specified action are set in an equipment management program (for example, if the value of an address 1 is greater than 20, data 10 is sent to an address 2), the linkage can only be applicable to linkage between simple data transformation, complex conditions cannot be realized, a logic basic rule is written down, code upgrading programs need to be modified when linkage rules are dynamically expanded, and the implementation and flexibility are insufficient.
Therefore, an internet of things equipment control method is needed, which is more flexible and has stronger functions.
Disclosure of Invention
In view of this, the present invention provides a method, a system, a device and a computer readable storage medium for linkage control of internet of things devices, which are more flexible and have stronger functions. The specific scheme is as follows:
an Internet of things equipment linkage control method comprises the following steps:
receiving state information uploaded by each independent device by using a centralized control program;
acquiring first-class state information uploaded by corresponding first-class independent equipment from the centralized control program by using a first linkage management program and a corresponding first communication mapping relation;
calling a control program corresponding to the first type state information of the first type independent equipment by using the first linkage management program to generate corresponding control information;
sending the control information to the centralized control program by using the first linkage management program;
and sending the control information to corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
Optionally, the process of acquiring the first type of state information uploaded by the corresponding first type of independent device from the centralized control program by using the first linkage management program and the corresponding communication mapping relationship includes:
and the first linkage management program loads a corresponding state information acquisition script by using the first communication mapping relation, and acquires the first type of state information uploaded by the corresponding first type of independent equipment from the centralized control program by using the state information acquisition script.
Optionally, the process of calling, by using the first linkage management program, a control program corresponding to the first type of state information of the first type of independent device, and generating corresponding control information includes:
the first linkage management program searches a control script function corresponding to the first type state information by utilizing the first type state information of the first type independent equipment and a pre-generated information control mapping relation;
and the first linkage management program runs the control script function and generates corresponding control information according to the first type of state information.
The invention also discloses a linkage control system of the Internet of things equipment, which comprises the following components:
the state information receiving module is used for receiving the state information uploaded by each independent device by using the centralized control program;
the state information acquisition module is used for acquiring first-class state information uploaded by corresponding first-class independent equipment from the centralized control program by utilizing a first linkage management program and a corresponding first communication mapping relation;
the control information generation module is used for calling a control program corresponding to the first type state information of the first type independent equipment by using the first linkage management program to generate corresponding control information;
the control information sending module is used for sending the control information to the centralized control program by utilizing the first linkage management program;
and the control information synchronization module is used for sending the control information to the corresponding independent equipment and other corresponding linkage management programs by utilizing the centralized control program so as to control each equipment and synchronize the control information.
Optionally, the status information obtaining module is specifically configured to load, by the first linkage management program, a corresponding status information obtaining script by using the first communication mapping relationship, and obtain, by using the status information obtaining script, the first type of status information uploaded by the corresponding first type of independent device from the centralized control program.
Optionally, the control information generating module includes:
the script searching unit is used for searching a control script function corresponding to the first type of state information by the first linkage management program by utilizing the first type of state information of the first type of independent equipment and a pre-generated information control mapping relation;
and the script running unit is used for the first linkage management program to run the control script function and generate corresponding control information according to the first type of state information.
The invention also discloses a linkage control device of the Internet of things equipment, which comprises:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the linkage control method of the equipment of the Internet of things.
The invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the linkage control method of the internet of things equipment is realized.
In the invention, the linkage control method of the Internet of things equipment comprises the following steps: receiving state information uploaded by each independent device by using a centralized control program; acquiring first-class state information uploaded by corresponding first-class independent equipment from a centralized control program by using a first linkage management program and a corresponding first communication mapping relation; calling a control program corresponding to the first type state information of the first type independent equipment by using a first linkage management program to generate corresponding control information; sending control information to a centralized control program by utilizing a first linkage management program; and sending the control information to the corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
The invention uses the centralized control program to collect the state information of each independent device, realizes the unified information collection of the independent devices, uses each pre-designed linkage management program to obtain the required state information, and calls the corresponding control program according to the state information by each linkage management program, realizes the effect of linkage control on a plurality of independent devices according to the state information of the plurality of independent devices, and simultaneously can realize the control sharing among the linkage control programs.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flow chart of a linkage control method for internet of things equipment according to an embodiment of the invention;
fig. 2 is a schematic flow chart of another method for controlling linkage of internet of things devices according to the embodiment of the invention;
fig. 3 is a schematic flow chart of a linkage management program implementation according to an embodiment of the disclosure;
fig. 4 is a schematic view of a linkage control logic of an internet of things device disclosed in the embodiment of the present invention;
fig. 5 is a schematic structural diagram of an internet of things device linkage control system disclosed by the embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
The embodiment of the invention discloses a linkage control method for equipment of the Internet of things, which is shown in figure 1 and comprises the following steps:
s11: and receiving the state information uploaded by each independent device by using a centralized control program.
Specifically, each device in the internet of things, for example, a sensor such as a thermometer, and a response device such as an air conditioner and a washing machine, may upload its own state information to the centralized control program through a corresponding device management program.
The state information includes an operation state and output parameters of the device, for example, a temperature value detected by the thermometer, whether the air conditioner is operating, a set temperature, and an operation mode.
Specifically, the centralized control program is used for receiving the status information of each independent device in the designated area, and realizing unified management, so that the status information of each device is collected uniformly, and a subsequent program can acquire various device information conveniently.
S12: and acquiring the first-class state information uploaded by the corresponding first-class independent equipment from the centralized control program by utilizing the first linkage management program and the corresponding first communication mapping relation.
Specifically, because there may be a plurality of independent devices, and some independent devices may have a small correlation and are not easily controlled in a combined manner, a plurality of linkage management programs may be simultaneously operated, and different linkage management programs may respectively control a plurality of different independent devices, thereby implementing combined control of a plurality of independent devices in one area or a plurality of areas.
For example, one linkage management program may be used to logically control a plurality of lights, another linkage management program may be used to control a plurality of air conditioners in a linkage manner, and one linkage management program may be used to control a part of lights and air conditioners in a linkage manner.
Specifically, each linkage management program has a corresponding communication mapping relationship, and the communication mapping relationship linkage management program can acquire the first-class state information uploaded by the first-class independent device which needs linkage control at this time, so that the linkage control of the first-class independent device is realized. The first-class independent equipment refers to one or more independent equipment to be subjected to linkage control by the first linkage management program, and the first-class state information comprises state information of each independent equipment in the first-class independent equipment.
It can be understood that the independent device required to be controlled by each linkage management program can be appointed by setting and modifying the communication mapping relation, so that the user can conveniently define and control the device, and the device is more flexible.
S13: and calling a control program corresponding to the first type state information of the first type independent equipment by using the first linkage management program to generate corresponding control information.
Specifically, after the first type state information of the first type independent device is acquired, a control program corresponding to the first type state information can be called, the first type state information is input into the control program, and the control program generates corresponding control information according to the first type state information under the condition that the first type state information is met, so that the first type independent device is controlled to work.
S14: and sending the control information to the centralized control program by utilizing the first linkage management program.
Specifically, after the control information is generated by the control program in the first linkage management program, the control information can be sent to the centralized control program, so that the centralized control program can serve as a transfer program to forward the control information to each independent device.
S15: and sending the control information to the corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
Specifically, since the control information between the linkage management programs can also be used as a trigger action, after the centralized control program receives the control information, the control information can be forwarded to the corresponding linkage management program, so that other linkage management programs can judge whether to execute the corresponding linkage management according to the control information.
Specifically, the linkage management programs may be associated with each other in advance, and therefore, the centralized control program may forward the control information generated by the current first linkage management program to the corresponding other linkage management programs according to the pre-established association, so as to implement the intercommunication between the linkage management programs.
Specifically, in an actual application scenario, for example, the action may be triggered only when 4 conditions of pm2.5>100, air conditioner temperature >30, lighting on in a living room and lighting on a curtain are all satisfied, for example, when the above 4 conditions are all satisfied, the 4 actions of turning on an air conditioner, turning off lighting on a main bed, turning off a curtain and turning on fresh air are executed, and if the first linkage management program receives that the value of pm2.5 is 200, if the temperature is 20 degrees, the condition is not triggered; in the above example, the independent devices include a pm sensor, an air conditioner, a lamp and a curtain control device, a first communication mapping relation in a first linkage management program records first type state information uploaded by 4 first type independent devices of a pm value, an air conditioner temperature, a living room light state and a curtain state, which are required to be acquired by a first linkage management program, the first linkage management program judges whether conditions of pm2.5>100, an air conditioner temperature >30 and a living room light opening and curtain opening are met or not through the first type state information, if the conditions are met, a corresponding control program is called to generate control information for executing 4 actions of opening the air conditioner, closing the main and lying lights, closing the curtain and opening the fresh air, and the control information is sent to each independent device through a centralized management program to realize linkage control.
In the above example, the control information may include 4 sub-control information corresponding to 4 actions of executing the action to open the air conditioner, close the main and horizontal lights, close the curtain, and open the fresh air, and the centralized management program correspondingly sends the 4 sub-control information to the corresponding devices respectively.
Therefore, the embodiment of the invention utilizes the centralized control program to uniformly collect the state information of each independent device, realizes the uniform information collection of the independent devices, utilizes each pre-designed linkage management program to obtain the required state information, and calls the corresponding control program according to the state information by each linkage management program, realizes the effect of linkage control on a plurality of independent devices according to the state information of the plurality of independent devices, and simultaneously can realize the control sharing among the linkage control programs.
The embodiment of the invention discloses a specific method, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Referring to fig. 2, specifically:
s21: receiving state information uploaded by each independent device by using a centralized control program;
s22: and the first linkage management program loads the corresponding state information acquisition script by using the first communication mapping relation, and acquires the first type of state information uploaded by the corresponding first type of independent equipment from the centralized control program by using the state information acquisition script.
Specifically, according to the independent device which is required to be controlled by the first linkage management program and designed in the first communication mapping relationship, the first linkage management program obtains the first type state information which is required to be obtained and uploaded by the first type independent device and recorded in the first communication mapping relationship through a script function.
Specifically, the independent equipment required to be controlled by the first linkage management program is set through the first communication mapping relation, and the control range can be changed in the future.
Specifically, referring to fig. 3, the first communication mapping relationship may be in the form of an address mapping table, and the address connection with the serial port capable of acquiring the state information of the independent device through the centralized control program is established by using a corresponding logic function.
S23: the first linkage management program searches a control script function corresponding to the first type state information by using the first type state information of the first type independent equipment and a pre-generated information control mapping relation.
Specifically, a corresponding preset control script function is searched in the information control mapping relation according to the first type of state information, so that corresponding control information can be generated by using the control script function in the following process, and control script functions corresponding to different first type of state information are designed according to the information control mapping relation, so that the effect of independent control according to different states of the independent equipment is achieved.
Specifically, referring to fig. 3, the first linkage management program starts a corresponding logic function according to the timer mapping table, starts the corresponding logic function recorded in the address mapping table at intervals of a preset time, loads the serial port mapping table, i.e., the logic function in the information control mapping relationship, i.e., the control script function, determines whether the serial port has data or a corresponding serial port handle, and generates corresponding control information as described in S24 if the serial port has data or a corresponding serial port handle.
S24: and the first linkage management program runs the control script function and generates corresponding control information according to the first type of state information.
S25: sending control information to a centralized control program by utilizing a first linkage management program;
s26: and sending the control information to the corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
Specifically, a logical framework of an embodiment of the present invention is shown in fig. 4.
Specifically, as shown in fig. 3 and 4, the overall process of the embodiment of the present invention includes that when the linkage management program is started, some basic functions are loaded into the script, then the script is loaded, the address/timer/serial port mapping table in the script is analyzed, an address/timer id/serial port handle is established in the memory — mapping to the script trigger function, then the management program monitors the report of the device status, the trigger of the timer and the data at the serial port end, and if corresponding data is received, the mapping table is searched, a corresponding script function is found, and a corresponding script function is executed.
When receiving the device data, the device data is stored in the memory, and a query function GETVAL is provided, and the script can directly call GETVAL (addr) to obtain the data of the address corresponding to the device.
The timer is realized in the management program, the creation is created by calling a c + + interface in the script, and after being triggered, the corresponding script function is called directly according to the id of the timer
And for the data of the serial port, after the data of the serial port is received, the data is assembled into an array format of the script, the data is transmitted into the script, and a callback function for receiving the data of the serial port is called. The received data can be directly processed in the script.
Specifically, the embodiment of the present invention further discloses a specific script implementation method, which includes:
the rules of the linkage script are as follows
The WISER _ INIT is a function for initializing operation, performs some initialization operations, and can be in default; ADDTIMER is create timer and id UART OPEN of return timer is handle returned by OPEN port.
Wherein gtimerffunc gaurtfunc gffunc is 3 fixed variables used to implement mapping, for example:
gtimerfunction [ time ] function 1-the trigger function for the timer corresponding to the time is designated as function1
gUartFunc [ fd ] ═ function2- -the received data processing function for which the open handle is a serial port of fd is designated as function2
gFunc [ addr1: addr2: addr3] - -function 3- -the trigger function for device address addr1addr2 addr3 is designated as function3 (function 3 is triggered by receipt of addr1addr2 addr 3)
Specifically, the above shows the simplest script writing rule, and the widget provides some script interface functions, specifically as follows:
SLEEP (seconds) delay time of second
MSLEEP (mseconds) delay milliseconds
READ (addr) to read the value of the address addr by the device
READDRUP ({ addr }) goes to the device to read the value of the bulk address addrs
SEND (addr, type, val) sets the value of the device address addr
SENGDRUP ({ addr, type, val }) sets the value of device multiple addresses addrs
PUSH (msg) message msg to handset
UART _ OPEN (dev, bug, data, parity, stopbit) OPENs the serial port
UART _ CLOSE (fd) turning off serial port
UART _ SCOSE (dev) shutdown serial port
UART _ SEND _ STRING (handle, str) UART sending character STRING
UART _ SEND _ BYTES (handle, { data }) UART SENDs data
Type of GETTYPE (addr) acquisition address
ADDDATETIMER (week, hour, min, sec) increases the hour, minute and second timer
ADDTIMER (msec) increased millisecond timer
DELTIMER (TIMED) DELTIMED DELIVERY TIMER
Address transition from ADDR2INT (ADDR) "1/1/1" class to INT
MODBUS _ RTU _ OPEN (dev, baudrates, bytes, parity, stocks) OPENs serial MODBUS
Modbus with MODBUS _ TCP _ OPEN (ip, port) opening TCP
MODBUS _ CLOSE (handle) CLOSE MODBUS
MODBUS _ READ _ BITS (handle, slave, addr, count, { data }) READs a plurality of BITS
MODBUS _ READ _ INPUT _ BITS (handle, slave, addr, count, { addr: data }) READs multiple consecutive BITS
MODBUS _ READ _ REGISTERS (handle, slave, addr, count, data) MODBUS READs values of multiple addresses
MODBUS _ READ _ INPUT _ REGISTERS (handle, slave, addr, count, { addr: data }) MODBUS READs multiple continuous values of multiple registers
MODBUS _ WRITE _ BIT (handle, slave, addr, data) MODBUS WRITEs a single BIT
MODBUS _ WRITE _ BITS (handle, slave, addr, { data }) MODBUS WRITEs multiple bit values
MODBUS _ WRITE _ REGISTER (handle, slave, addr, data) MODBUS WRITEs a single REGISTER value
MODBUS _ WRITE _ REGISTERS (handle, slave, addr, { data }) MODBUS WRITEs a plurality of register values
GETVAL (addr) obtaining device address value
CHECK _ TIME ({ weeks }, firmware, section) CHECK TIME
Correspondingly, the embodiment of the invention also discloses a linkage control system of the internet of things equipment, and as shown in fig. 5, the system comprises:
the state information receiving module 11 is used for receiving the state information uploaded by each independent device by using a centralized control program;
the state information acquisition module 12 is configured to acquire, from the centralized control program, first type state information uploaded by the corresponding first type independent device by using the first linkage management program and the corresponding first communication mapping relationship;
the control information generating module 13 is configured to invoke a control program corresponding to the first type state information of the first type independent device by using the first linkage management program, and generate corresponding control information;
a control information sending module 14, configured to send control information to the centralized control program by using the first linkage management program;
and the control information synchronization module 15 is used for sending control information to the corresponding independent equipment and other corresponding linkage management programs by using the centralized control program so as to control each equipment and synchronize the control information.
Therefore, the embodiment of the invention utilizes the centralized control program to uniformly collect the state information of each independent device, realizes the uniform information collection of the independent devices, utilizes each pre-designed linkage management program to obtain the required state information, and calls the corresponding control program according to the state information by each linkage management program, realizes the effect of linkage control on a plurality of independent devices according to the state information of the plurality of independent devices, and simultaneously can realize the control sharing among the linkage control programs.
Specifically, the status information obtaining module 12 is specifically configured to load a corresponding status information obtaining script by the first linkage management program through the first communication mapping relationship, and obtain the first type of status information uploaded by the corresponding first type of independent device from the centralized control program through the status information obtaining script.
Specifically, the control information generating module 13 includes:
the script searching unit is used for the first linkage management program to search a control script function corresponding to the first type of state information by utilizing the first type of state information of the first type of independent equipment and a pre-generated information control mapping relation;
and the script running unit is used for the first linkage management program to run the control script function and generate corresponding control information according to the first type of state information.
In addition, the embodiment of the invention also discloses a linkage control device of the internet of things equipment, which comprises:
a memory for storing a computer program;
and the processor is used for executing a computer program to realize the linkage control method of the equipment of the Internet of things.
In addition, the embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the method for linkage control of the internet of things equipment is realized.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The technical content provided by the present invention is described in detail above, and the principle and the implementation of the present invention are explained in this document by applying specific examples, and the above description of the examples is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.