Disclosure of Invention
In view of the above, embodiments of the present application are expected to provide a terminal control system based on the internet of things, a terminal control method based on the internet of things, a server and a storage medium.
The technical scheme of the application is realized as follows:
on the one hand, the application provides a terminal control system based on thing networking.
The terminal control system based on thing networking that this application embodiment provided includes:
the sensing layer comprises at least one controller, the controller is connected with a data sensor arranged on a terminal and used for controlling the data sensor to acquire current first state data of the terminal and transmitting the first state data to the platform layer;
the platform layer is in communication connection with the controller and is used for analyzing the received first state data into second state data which can be identified by the supply layer, wherein the data format of the first state data is different from that of the second state data;
and the application layer is connected with the platform layer and is used for receiving and identifying the second state data from the platform layer through the standard API and obtaining the current state of the terminal.
In some embodiments, the application layer is further configured to generate a control instruction based on input preset state information, and issue the control instruction to the platform layer, where the preset state information is used to indicate an expected state entered by the terminal;
the platform layer is further configured to generate third state data based on the received control instruction, and send the third state data to the controller, so that the controller controls the terminal to enter the expected state according to the third state data.
In some embodiments, the terminal control system further comprises:
the gateway is connected between the controller and the platform layer and supports a LoRaWAN long-distance wireless communication protocol; the gateway is used for establishing communication between the controller and the platform layer based on a LoRaWAN protocol.
In some embodiments, a communication module supporting an NB-IoT narrowband internet of things protocol is disposed within the platform tier, the communication module configured to establish communication between the controller and the platform tier based on the NB-IoT protocol.
In some embodiments, an access plug-in supporting HTTP hypertext transfer protocol is disposed within the platform tier, the access plug-in for establishing communication between the controller and the platform tier based on HTTP protocol.
In some embodiments, the platform layer has an easylaccess data viewer therein, which supports the controller to transmit data to the platform layer according to the easylaccess access standard set by the platform layer.
In some embodiments, the platform layer is further configured to establish an object model corresponding to the device ID based on the device ID identification number of the terminal; the device IDs corresponding to terminals of different device types are different, and the object models correspondingly established by different device IDs are different;
the object model at least comprises function information representing the equipment functions of the terminal and an access mode of a controller corresponding to the terminal accessing the platform layer; the access modes of controllers corresponding to terminals with different equipment IDs accessing the platform layer are different; the controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer.
In some embodiments, the first state data is multi-system data, and the second state data is JSON field data, where the multi-system data and the JSON field data are both used to indicate the state information of the terminal, and the system data at different positions in the first state data correspond to different JSON fields, and the system data at different positions indicate that the state information of the terminal is different.
In some embodiments, the application layer comprises at least:
the system overview module is used for displaying the system architecture of the control system and various functions of the control system through a display window;
the alarm module is used for sending out an alarm signal when the terminal is monitored to be in an abnormal working state or sending out an alarm signal when the terminal is monitored to have fire safety hidden danger indoors;
and the management module is used for adjusting the current state of the terminal according to the working environment of the terminal.
In some embodiments, the management module comprises at least one of:
the energy consumption management module is used for controlling the power of the terminal accessed to the terminal control system;
the power monitoring module is used for monitoring the power consumption of the terminal accessed to the terminal control system in real time;
the indoor positioning module is used for monitoring the indoor position of the terminal accessed to the terminal control system in real time;
the light management module is used for adjusting the switch distribution and the light intensity of indoor light in real time according to the indoor personnel condition;
and the indoor temperature control module is used for monitoring the indoor temperature and starting the air conditioner when the indoor temperature is within a preset temperature range.
On the other hand, the application also provides a terminal control method based on the internet of things, which is applied to a platform layer, and the method comprises the following steps:
acquiring current first state data of the terminal, which is acquired by a data sensor;
resolving the first state data into second state data which can be identified by a supply application layer, wherein the data format of the first state data is different from that of the second state data;
and sending the second state data to an application layer, wherein the second state data is used for being recognized by the application layer through a standard API application program interface to obtain the current state of the terminal.
In some embodiments, the method further comprises:
receiving a control instruction which is generated based on input preset state information and sent by the application layer, wherein the preset state information is used for indicating an expected state entered by the terminal;
generating third state data based on the received control instruction;
and sending the third state data to the controller, so that the controller can control the terminal to enter the expected state according to the third state data.
In some embodiments, before acquiring the current first state data of the terminal, the method includes:
establishing communication between the controller and the platform layer based on a gateway supporting a LoRaWAN long-distance wireless communication protocol; the controller is connected with the data sensor and used for controlling the data sensor to acquire the current first state data of the terminal.
In some embodiments, before acquiring the current first state data of the terminal collected by the data sensor, the method further includes:
establishing an object model corresponding to the equipment ID based on the equipment ID identification number of the terminal; the device IDs corresponding to terminals of different device types are different, and the object models correspondingly established by different device IDs are different;
the object model at least comprises function information representing the equipment functions of the terminal and an access mode of a controller corresponding to the terminal accessing the platform layer; the access modes of controllers corresponding to terminals with different equipment IDs accessing the platform layer are different; the controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer.
In another aspect, the present application further provides a server.
The server provided by the embodiment of the application comprises: the terminal control method comprises a processor and a memory, wherein the memory is used for storing a computer program capable of running on the processor, and when the processor runs the computer program, the processor is used for executing the steps of the terminal control method based on the internet of things provided by the embodiment of the application.
In yet another aspect, the present application further provides a computer-readable storage medium.
The computer-readable storage medium provided by the embodiment of the present application stores thereon a computer program, and the computer program, when executed by a processor, implements the steps of the terminal control method based on the internet of things provided by the embodiment of the present application.
The terminal control system based on the Internet of things comprises a sensing layer, a platform layer and an application layer. The sensing layer comprises at least one controller, and the controller can control the data sensor to acquire the current first state data of the terminal and transmit the first state data to the platform layer. And the platform layer is in communication connection with the controller and analyzes the received first state data into second state data which can be identified by the supply layer. And the application layer is connected with the platform layer through a standard API application program interface, and receives and identifies the second state data from the platform layer through the standard API application program interface to obtain the current state of the terminal. Due to the fact that the types of terminals accessed to the internet of things are various, communication modes of communication between a sensing layer and the terminals are different, terminal data collected by a controller are different in data format, but the communication protocol of external communication of an application layer is fixed, and therefore the application layer cannot directly read all the collected terminal data of various types. Therefore, in the application, the platform layer between the sensing layer and the application layer is provided to realize the analysis and the compilation between the first state data and the second state data, and a standard API interface is formed to allow the application layer to read the second state data corresponding to various terminals analyzed by the platform layer to obtain the current state of the terminal. Therefore, the flexibility of application program development of the application layer is improved under the condition of not replacing the access equipment through the analysis and the compilation between the first state data and the second state data of the platform layer, so that the development of the application layer is not limited to equipment of a certain type of physical communication protocol any more.
Detailed Description
The technical solution of the present invention is further described in detail with reference to the drawings and the specific embodiments of the specification. Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
However, with the development of the internet of things technology, more and more terminals are accessed to the network, the types of the terminals accessed to the network are more and more extensive, and how to realize the interaction between various different types of terminals and a control platform becomes a problem to be solved first for realizing the interconnection of everything.
The application provides a terminal control system based on the Internet of things. Fig. 1 is a schematic structural diagram illustrating a terminal control system based on the internet of things according to an exemplary embodiment. As shown in fig. 1, the terminal control system based on the internet of things includes:
the sensing layer 1 comprises at least one controller, wherein the controller is connected with a data sensor arranged on a terminal and used for controlling the data sensor to acquire current first state data of the terminal and transmitting the first state data to a platform layer;
the platform layer 2 is in communication connection with the controller and is used for analyzing the received first state data into second state data which can be identified by the provisioning layer, wherein the data format of the first state data is different from that of the second state data;
and the application layer 3 is connected with the platform layer, is provided with a standard API application program interface and is used for receiving and identifying the second state data from the platform layer through the standard API application program interface to obtain the current state of the terminal.
In the present exemplary embodiment, the sensing layer includes at least one controller. Each controller may have a data sensor connected thereto. The data sensor is used for acquiring current first state data of the terminal. The terminals accessed to the internet of things comprise various types of terminal equipment, such as air conditioners, televisions, computers, electric lamps and the like. The collected first state data formats corresponding to different types of terminal devices may be different, for example, when the first state data is multilevel data, the first state data collected for the air conditioner may be set as hexadecimal data, the first state data collected for the television may be set as octal data, and the first state data collected for the electric lamp may be set as binary data.
When the format of the first state data collected by the terminal is set, the data format of the first state data can be determined according to the number of items of the data collected by the terminal. The more items including the collected data, the more data scale numbers for determining the first state data. For example, the collected data of the air conditioner includes more items of data such as an ambient temperature, a switch state, a currently set temperature of the air conditioner, power, a wind speed, humidity, and the like, and at this time, a data format of the first state data collected for the air conditioner may be set to be hexadecimal data. When the data collected by the lamp only includes the data of the items with less on-off state, brightness and power, the data format of the first state data collected by the lamp can be set as binary data. Thereby being beneficial to distinguishing the terminal type through the number of the carry digit.
The second state data is data that the application layer can recognize through a standard API application program interface, and includes JSON field data and the like. The standard API application program interface can be developed by itself and is connected with the platform layer and the application layer. The standard API application program interface can contain function information corresponding to the second state data and various collected data of various terminals. For example, taking an air conditioner as an example, when the second state data is JSON field data, the standard API may include multiple JSON fields, JSON field parameters, and function information corresponding to each JSON field, where the function information includes an on-off state of the air conditioner corresponding to air-switch, an on-off mode of the air conditioner corresponding to air-mode, and a wind speed of the air conditioner corresponding to air-wind _ speed. Wherein, the functions in the function information corresponding to different parameter values in one JSON field are different. For example, air _ switch0 corresponds to an off state of the air conditioner, and air _ switch1 corresponds to an on state of the air conditioner. The air _ wind _ speed0 corresponds to the automatic wind speed of the air conditioner, and the air _ wind _ speed 1-5 correspond to the 1-5 level wind speed of the air conditioner respectively. When the second state data is JSON field data, the second state data may include a JSON field and JSON field parameters. Therefore, when the application layer cannot directly read the first state data, the application layer can directly read the second state data through a standard API (application program interface) to obtain the current state of the terminal.
When the platform layer analyzes the first state data, the first state data can be analyzed according to a self-defined application data protocol. The application data protocol includes a conversion mode or data correspondence for performing mutual data conversion between the first state data and the second state data.
When an application data protocol is established, data items needing data acquisition for the terminal are determined firstly. For example, when the terminal is an air conditioner, determining that the data items to be acquired sequentially comprise from left to right according to the first state data:
air conditioner switch, air conditioner mode, air conditioner wind speed, air conditioner temperature, ambient temperature, power consumption, power, on-off state. The data bits of each item of data in the first state data can be determined according to the possible value range of the item of data. For example, the air conditioner switch only has on or off states, and the air conditioner switch only occupies two data bits. The power value of the air conditioner is larger and can reach 1200 watts, and the data item can be set to four data bits and the like. The data bit occupied by each data item can be set according to the requirement. In this example, the air-conditioning switch is set to occupy two data bits, the air-conditioning mode occupies two data bits, the air-conditioning wind speed occupies two data bits, the air-conditioning temperature occupies two data bits, the ambient temperature occupies two data bits, the power consumption occupies four data bits, and the power-on/off state occupies two data bits.
Then, the corresponding relation between the data value in each data item and the terminal state is established. For example, the data item: the air conditioner switch comprises a starting state and a shutdown state, wherein the data value corresponding to the starting state can be 01, and the data value corresponding to the shutdown state can be 00; the air-conditioning mode comprises 5 modes of automatic, heating, refrigerating, dehumidifying and ventilating, wherein a data value corresponding to an automatic state can be 01, a data value corresponding to a heating state can be 02, a data value corresponding to a refrigerating state can be 03, a numerical value corresponding to a dehumidifying state can be 04, a data value corresponding to a ventilating state can be 05 and the like. Different states of each data item air conditioner respectively correspond to different data values. The amount of power consumption can be directly represented by the value of the data item, for example, the power consumption is 95 kwh, which can be represented by 005F bits, and the environmental temperature is 26 ℃, which can be represented by 1A. When the air conditioner is in a power-on state, the starting, refrigerating, 2-level air and air conditioner temperature are set to be 24 ℃, the environment temperature is 26 ℃, the power consumption is 95 kwh, the power is 1200W, and the first state data collected by the data sensor is 010302181A005F04B 001. At this time, the correspondence relationship between each data item in the first state data and the second state data is as shown in table 1 and table 2. Table 1 is a first relational comparison table of each data item in the first state data and the second state data. And table 2 is a second relational comparison table of each data item in the first state data and the second state data.
TABLE 1 relationship of data items in first State data to second State data
TABLE 2 relational lookup tables between data items in first State data and second State data
The terminal control system based on the Internet of things comprises a sensing layer, a platform layer and an application layer. The sensing layer comprises at least one controller, and the controller can control the data sensor to acquire the current first state data of the terminal and transmit the first state data to the platform layer. And the platform layer is in communication connection with the controller and analyzes the received first state data into second state data which can be identified by the supply layer. And the application layer is connected with the platform layer through a standard API application program interface, and receives and identifies the second state data from the platform layer through the standard API application program interface to obtain the current state of the terminal. Due to the fact that the types of terminals accessed to the internet of things are various, communication modes of communication between a sensing layer and the terminals are different, terminal data collected by a controller are different in data format, but the communication protocol of external communication of an application layer is fixed, and therefore the application layer cannot directly read all the collected terminal data of various types.
Therefore, in the application, the platform layer between the sensing layer and the application layer is provided to realize the analysis and the compilation between the first state data and the second state data, and a standard API interface is formed to allow the application layer to read the second state data corresponding to various terminals analyzed by the platform layer to obtain the current state of the terminal. Therefore, the flexibility of application program development of the application layer is improved under the condition of not replacing the access equipment through the analysis and the compilation between the first state data and the second state data of the platform layer, so that the development of the application layer is not limited to equipment of a certain type of physical communication protocol any more.
In some embodiments, the application layer is further configured to generate a control instruction based on input preset state information, and issue the control instruction to the platform layer, where the preset state information is used to indicate an expected state entered by the terminal;
the platform layer is further configured to generate third state data based on the received control instruction, and send the third state data to the controller, so that the controller controls the terminal to enter the expected state according to the third state data.
In the exemplary embodiment, after acquiring the current state of the terminal, the application layer adjusts the state of the terminal according to the current environment of the terminal to enter the desired state. For example, taking an air conditioner as an example, when the current temperature of the air conditioner is not suitable for the current ambient temperature, the cooling temperature of the air conditioner needs to be adjusted, and at this time, the control command may be generated based on the input preset state information. The preset state information is used for indicating the expected state that the air conditioner needs to enter, including the cooling temperature and the like. The platform layer generates third state data based on the received control instruction. The data format of the third state data may be the same as the data format of the first state data. The third status data may include a data value corresponding to each data item, for example, 010302161a005F04B 001. The current refrigerating temperature of the air conditioner is adjusted from 24 ℃ to 22 ℃ and the like. The third status data is data that the controller can directly read to adjust the status of the terminal.
In some embodiments, the terminal control system further comprises:
the gateway is connected between the controller and the platform layer and supports a LoRaWAN long-distance wireless communication protocol; the gateway is used for establishing communication between the controller and the platform layer based on a LoRaWAN protocol.
In the exemplary embodiment, the platform layer is provided with a gateway supporting a LoRaWAN long-distance wireless communication protocol, and the gateway is used for connecting a controller and supports controller access of the LoRaWAN protocol.
The LoRa is one of low-power-consumption wide area network communication technologies, and is an ultra-long-distance wireless transmission technology based on a spread spectrum technology. LoRaWAN is a set of communication protocol and system architecture designed for LoRa long-distance communication network, and is a Media Access Control (MAC) layer protocol. Spread spectrum technology is a technology for expanding a baseband signal to a wider frequency band by injecting a higher frequency signal, and is basically characterized in that the bandwidth of a signal used for transmitting information is far larger than the bandwidth of the information. A LoRaWAN gateway is arranged on a platform layer of the terminal control system to support the controller access of a LoRaWAN protocol.
In some embodiments, a communication module supporting an NB-IoT narrowband internet of things protocol is disposed within the platform tier, the communication module configured to establish communication between the controller and the platform tier based on the NB-IoT protocol.
In the exemplary embodiment, the platform layer is provided with a communication module supporting the NB-IoT protocol, and is used for connecting the controller and supporting the controller access of the NB-IoT protocol.
NB-IoT (Narrow Band Internet of Things) is an important branch of the Internet of everything. NB-IoT is an emerging technology in the IoT domain that supports cellular data connectivity for low power devices over wide area networks, also known as Low Power Wide Area Networks (LPWANs). The NB-IoT is constructed in a cellular network, only consumes about 180kHz bandwidth, and can be directly deployed in a GSM network, a UMTS network or an LTE network so as to reduce the deployment cost and realize smooth upgrading. NB-IoT supports efficient connectivity for devices with long standby time and high requirements for network connectivity. A platform layer of the terminal control system is provided with a communication module supporting an NB-IoT protocol so as to support controller access of the NB-IoT protocol.
In some embodiments, an access plug-in supporting HTTP hypertext transfer protocol is disposed within the platform tier, the access plug-in for establishing communication between the controller and the platform tier based on HTTP protocol.
In the exemplary embodiment, the platform layer is provided with an access plug-in supporting the HTTP protocol for connecting the controller, and the controller access supporting the HTTP protocol.
HTTP (Hypertext Transfer Protocol) is a request-response Protocol that specifies what messages a client may send to a server and what responses it gets, based on a client/server model, a connection-oriented transport Protocol. An access plug-in supporting the HTTP is arranged on a platform layer of the terminal control system to support the controller access of the HTTP.
In some embodiments, the platform layer has an easylaccess data viewer therein, which supports the controller to transmit data to the platform layer according to the easylaccess access standard set by the platform layer.
In the present exemplary embodiment, there is an easylaccess data viewer within the platform layer. The controller which is not accessed to the platform layer can directly transmit the collected data to the platform layer according to the EasyAccess access standard or specification set by the platform layer.
FIG. 2 is a schematic diagram illustrating the structure of an application layer and a platform layer, according to an example embodiment. As shown in fig. 2, the platform layer plays a role of starting and stopping, and the platform layer makes an intersection with the sensing layer and the internet of things network and is in butt joint with the application platform. The device accesses the devices of various communication modes and protocols through the device access system, not only supports standard LoRaWAN protocols, NB-IoT protocols, HTTP protocol plug-ins and the like, but also supports cloud docking with a third-party platform, and also supports the device to automatically push data to the platform according to the EasyAccess access specification defined by the platform. EasyAccess is a self-defined set of equipment access specifications, and a third-party device can push data to a platform layer in an HTTP or other mode according to the specifications, so that the development of access plug-ins on a platform is not needed.
The equipment development comprises equipment object model definition, equipment development debugging and equipment later-stage management, and the data format and the API (application program interface) interface of the equipment can be standardized through the object model definition. And the equipment development and debugging are carried out for the second time, so that the cloud platform and the equipment data are communicated, and the equipment data analysis, downlink control and the like are realized. The device management realizes the device flow management, the online and offline management and the whole life cycle management, and can manage all the developed device libraries. After one device is developed, debugged and verified, a standard API interface can be formed to support the pushing of device data to a third-party platform, so that the separation of the device and the application can be realized.
In some embodiments, the platform layer is further configured to establish an object model corresponding to the device ID based on the device ID identification number of the terminal; the device IDs corresponding to terminals of different device types are different, and the object models correspondingly established by different device IDs are different;
the object model at least comprises function information representing the equipment functions of the terminal and an access mode of a controller corresponding to the terminal accessing the platform layer; the access modes of controllers corresponding to terminals with different equipment IDs accessing the platform layer are different; the controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer.
In the present exemplary embodiment, terminals of different device types may be defined as different device IDs, for example, an air conditioner may be defined as a first device ID, and the first device ID may be composed of letters, for example, qwrerw. The electric light may be defined as a second device ID, which may be composed of numbers, such as 123456 or the like. I.e. the ID numbers of the terminal-defined device IDs of different device types have different composition patterns. And the controllers corresponding to the terminals with different ID number forming modes have different access modes for accessing the platform layer. The controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer. For example, a controller controlling an air conditioner may be accessed based on a LoRaWAN protocol gateway. The controller controlling the electric lamp may be accessed based on a communication module supporting NB-IoT protocol, etc. At this time, it is merely an exemplary illustration, and the specific device access platform layer may select an access mode access platform layer according to a protocol type supported by the specific device.
In this exemplary embodiment, on the basis that the access device supports the relevant protocol, the access modes of the controller access platform layers corresponding to different device ID terminals may also be the same. For example, in the case that both the controller for controlling the air conditioner and the controller for controlling the electric lamp support the NB-IoT protocol, the platform layer can be accessed through the communication module supporting the NB-IoT protocol.
In some embodiments, the first state data is multi-system data, and the second state data is JSON field data, where the multi-system data and the JSON field data are both used to indicate the state information of the terminal, and the system data at different positions in the first state data correspond to different JSON fields, and the system data at different positions indicate that the state information of the terminal is different.
In the present exemplary embodiment, the status information includes the above-described data items, including an air conditioner switch, an air conditioner mode, an air conditioner wind speed, an air conditioner temperature, an ambient temperature, an amount of electricity used, power, an on/off state, and the like. As shown in table 1, the binary data at different positions in the first state data correspond to different JSON fields, and the binary data at different positions indicate that the state information of the terminal is different. For example, the first two bits from left to right in the first status data correspond to the JSON field air _ switch, which corresponds to the status of the air conditioner switch.
In some embodiments, the application layer comprises at least:
the system overview module is used for displaying the system architecture of the control system and various functions of the control system through a display window;
the alarm module is used for sending out an alarm signal when the terminal is monitored to be in an abnormal working state or sending out an alarm signal when the terminal is monitored to have fire safety hidden danger indoors;
and the management module is used for adjusting the current state of the terminal according to the working environment of the terminal.
In the present exemplary embodiment, as shown in fig. 2, the application layer includes a basic function module and a service function module. The basic function module comprises a system overview module which is used for displaying the system architecture of the control system and various functions of the control system through a display window; and the alarm module is used for sending out an alarm signal when monitoring that the terminal is in an abnormal working state, or sending out an alarm signal when monitoring that the indoor fire safety hidden danger exists, and the like. And the equipment monitoring module is used for carrying out data display and control on the Internet of things equipment in a graphical mode. All basic function modules support flexible construction and are used for realizing the most basic functions of an application platform.
The other part is that the service function module, namely the management module comprises an energy consumption management module which is used for controlling the power of the terminal accessed to the terminal control system; the power monitoring module is used for monitoring the power consumption of the terminal accessed to the terminal control system in real time; the indoor positioning module is used for monitoring the indoor position of the terminal accessed to the terminal control system in real time; the light management module is used for adjusting the switch distribution and the light intensity of indoor light in real time according to the indoor personnel condition; and the indoor temperature control module is used for monitoring the indoor temperature and starting an air conditioner and the like when the indoor temperature is within a preset temperature range. The service function module also comprises modules for power utilization safety, environment monitoring, door lock management, indoor security and the like. The service function module can be used for further understanding the service function and deepening the function of the application layer.
As shown in fig. 2, the whole device design process is divided into 3 blocks, namely, whole function requirement definition, hardware development and debugging, and device application development and debugging. Taking the requirements of the smart home system as an example, it is first determined which functions need to be implemented by the smart home to be made, such as lighting control, air conditioning control, environmental monitoring, curtain control or fire safety management. The functional modules need to be mapped to hardware equipment, the hardware equipment needs to be defined, developed and debugged, the equipment can be monitored and controlled in an application layer, accordingly, the development of the whole Internet of things equipment is completed, and the whole intelligent home system is realized through configuration or simple secondary development. Besides the energy home system, the development and debugging of other intelligent fire-fighting systems, intelligent agricultural systems, intelligent logistics systems, intelligent business systems and intelligent traffic systems are also performed as described above.
FIG. 3 is a flow diagram illustrating platform tier based device development debugging in accordance with an exemplary embodiment. As shown in fig. 3, the device development debugging process includes:
step 31: defining functions of the comprehensive practical training system, including hardware functions and software functions;
step 32: defining a hardware product comprising a product type, an application data protocol, an API interface and the like;
step 33: developing a bottom hardware product comprising embedded software and hardware;
step 34: carrying out secondary protocol development and debugging on the platform layer;
step 35: equipment monitoring and downlink control are realized in an application layer in a graphical mode, and complete equipment function verification is realized by using linkage control, alarm information pushing, space management, user management and the like;
step 36: and selecting a service function module for service function test, and simultaneously, self-defining and developing the service function module according to a data interface, and building a real application system based on the equipment function.
The platform layer in the application supports equipment access of various communication modes and protocols and supports user-defined equipment models. The user can manage the type of the device by customizing the model of the device. Taking LoRaWAN communication as an example, in an intelligent home system, air conditioner management is generally required, so that an LoRaWAN air conditioner controller can be defined to monitor the on-off, mode, wind speed and temperature of an air conditioner, remotely control the state of the air conditioner, and realize timing control and the like. And simultaneously, defining the data type and the application data communication protocol of the equipment according to the functional requirements of the equipment. When the equipment definition of the LoRaWAN air conditioner controller is made, a corresponding large product type can be selected, the product type is the air conditioner controller, and the product type is convergence of similar equipment. The air conditioner controller is mainly used for realizing air conditioner state monitoring and remote control, main parameters (data items) of the air conditioner controller include a switch, a mode, a wind speed, a temperature, an ambient temperature and the like, and common parameters (data items) of the air conditioner controller are defined as shown in table 1.
The defined LoRaWAN air conditioner controller is a specific model of the air conditioner controller under the product type, has common public parameters of the air conditioner controller, and also needs other functions aiming at an intelligent household scene, such as statistics of the power consumption of an air conditioner, power, the power on/off state of equipment and the like, so that when the product parameters are selected, unique parameters of the LoRaWAN air conditioner controller need to be defined on the basis of selecting the public parameters.
After functional requirements and parameters of the product are defined, hardware development can be carried out. And a universal hardware kit and a communication module are selected for connection and combination on hardware, and then embedded software development is carried out, so that the embedded software and hardware of the LoRaWAN air conditioner controller can be developed and verified locally by using a single chip microcomputer system.
After the development and debugging of the hardware local control function are finished, the function joint debugging and development with the platform are needed, and the data is uploaded to the platform and the platform issues the control function.
Fig. 4 is a schematic diagram illustrating a data transmission manner in a terminal control system based on the internet of things according to an exemplary embodiment. As shown in fig. 4, during the uplink data transmission, the first status data uploaded to the platform by the air conditioner controller is 16-ary data. Assume that the data content uploaded by the device is 010302181a005F04B 001. And after receiving the data of the air conditioner controller, the gateway transmits the data to the platform layer.
The data format of the data forwarded by the gateway is also 16-system, and the device data of the LoRaWAN communication can be debugged on the EINS through the unique device ID number. And according to a defined LoRaWAN air conditioner controller application data protocol, 16-system data is used for communicating with the air conditioner controller from the EINS platform, and the communication function is verified. Then, in order to form a standard data API interface for the application layer, a product model of the LoRaWAN air conditioner controller needs to be defined on the platform, data analysis is carried out according to an application data protocol of the LoRaWAN air conditioner controller, analyzed data viewing and debugging are achieved, the standard API interface is formed at the same time, and pushing to the application layer or a third party platform is supported. By defining the equipment model definition and writing the analysis program of the air conditioner controller, the received 16-system data can be converted into JSON field data. The specific value of the JSON field of the air conditioner can be directly obtained through the API, and the readability of the JSON field data is stronger compared with that of 16-system data.
The application layer such as an air conditioner management platform receives the air conditioner state data and pushes the air conditioner state data to the air conditioner management platform, meanwhile, the management platform can also obtain the current state of the air conditioner through a standard API interface, for example, an interface getAirconditionionstate () for obtaining the air conditioner state is called, and a return value of the management platform is an object, and the specific format is as follows:
{
"air_switch": "1",
"air_mode": "3",
"air_wind_speed": "3",
"air_temperature": 24
……
}
mapping to a specific meaning (value) according to the value (key value), for example, an air conditioner switch field air _ switch, wherein the value of 1 (key value) represents start-up (value), the value of 0 (key value) represents shutdown (value), and then displaying the start-up and shutdown in the form of an icon on an application platform. Therefore, the interaction of state and downlink control is realized in a graphical mode at an application layer.
Taking the example shown in table 2, the uploaded device data is 010302181a005F04B001, and by analyzing the data to convert the data, it can be known that the states are power on, cooling, 2-level wind, 24 ℃ of air conditioning temperature, 26 ℃ of ambient temperature, 95 kwh of power consumption, 1200w of power, and power on/off state is power on. When downlink control occurs, the air conditioner state can be changed, and the value of the JSON field can be synchronously changed. Through the equipment development of the platform layer, the third-party platform can acquire the corresponding parameters of the air conditioner only by calling the interface to acquire the JSON field value, so that the equipment data is quickly analyzed and the API interface is standardized.
The downstream control is just opposite to the upstream execution sequence. When user operation occurs in the application layer, the application layer can send data to the platform layer according to the defined JSON field format, and the platform layer can reversely analyze the data. The platform layer converts the JSON field data into 16-system data, and then sends the data to the gateway through the bottom EINS platform. And after receiving the data, the gateway transmits the data to the air conditioner controller. The air conditioner controller analyzes the 16-system data according to a defined application data protocol and controls the equipment to execute corresponding actions according to the meaning represented by the data.
In the whole data link, the platform layer plays a role in starting and stopping, secondary development can be carried out on the equipment, and therefore a powerful equipment debugging function is needed, and the specific working condition of the equipment and the data circulation condition can be conveniently analyzed. The equipment debugging and the equipment development are carried out simultaneously, when the equipment analysis program is developed, the program is cached into a version, and then the equipment debugging is carried out on the program. The equipment debugging is divided into three parts of equipment pipelining, downlink debugging and interface logging.
In the equipment pipeline part, screening can be carried out according to information such as items, groups, product models, equipment numbers and the like, and corresponding equipment data pipeline can be checked. The pipeline information includes basic device information (product type, product name, product model, device number, etc.), unresolved device data, and resolved device data. Whether the analysis is correct can be judged by comparing the data which is not analyzed with the data which is analyzed. If the analysis is correct, only the analyzed data needs to be checked in later actual use.
The downlink debugging is used for downlink control equipment, for example, a downlink instruction can be sent to the equipment according to an application data protocol, for example, the running state of an air conditioner is set, the downlink control type needs to be selected as air conditioner state control, and then JSON fields and default values needed in the air conditioner state control are displayed in a downlink debugging frame, as follows:
{
"air_switch": "0",
"air_mode": "1",
"air_wind_speed": "1",
"air_temperature": 24
}
and modifying values of 4 JSON fields of an air conditioner switch, a mode, a wind speed and a temperature, and realizing issuing by clicking and sending. The issuing debugging comprises log information which can be used for judging whether the platform issuing instruction is successful or not, and the log information can display the data for controlling the air conditioner state finally issued by the platform layer. Besides 4 JSON fields of air conditioner switch, mode, wind speed and temperature, the finally issued data also can be added with necessary data information related to equipment or communication. At this time, whether the downlink analysis of the platform layer is correct can be judged through comparison. While a normal device successfully receiving the data will return an ACK.
If the device is the control device, whether the data is transmitted and whether the data analysis is correct can be judged by judging whether the device executes the corresponding action.
The interface log is mainly used for checking platform data push information and information of data acquired by a third-party platform calling interface and used for managing data docking logs of a third-party application platform and a platform.
Compared with LoRaWAN equipment, equipment of other communication protocols is different only in the middle access mode, and the definition, development and debugging processes are basically the same, so that the development of the equipment used for all intelligent home practical training systems can be realized according to the same method.
The application layer among the terminal control system of this application supports through configuration basic function module and business function module, generates a SaaS application platform that has the practicality, and in intelligent home systems, the function commonly used has remote control air conditioner, light, according to environmental conditions automatic coordinated control air conditioner or new trend system, according to illumination condition automatic control (window) curtain etc. these functions all can be realized through simple configuration.
According to the application scene requirements, the application platform can directly select corresponding service modules such as air conditioner monitoring, light energy saving and environment monitoring, and meanwhile, linkage control and timing control are achieved through the rule engine module, a user can configure that the air conditioner is started when the temperature is higher than 30 ℃ or lower than 10 ℃, the light is automatically turned off after unmanned time delay for a period of time, and the like, and control logic is flexibly set up according to specific requirements. The alarm management comprises alarm rules, alarm templates and alarm receivers, and can be used for monitoring fire safety information of the intelligent home system, for example, when a smoke alarm gives an alarm or doors and windows are illegally opened at night, a short message or a mail can be sent to give an alarm, and a person is informed to check the alarm in time. And for the platform which does not support the service function temporarily, the user can call the data interface of the platform to carry out secondary development.
The primary development is to use the existing hardware products and platform functions to flexibly configure, realize the function of the whole practical training system, quickly change originality into reality, run through the whole development process of the internet of things and experience the interest of the development of the internet of things. The middle-level development can utilize the core function of the platform to design access hardware and self-define development service functions. Advanced development is carried out according to product thinking, each step in the development is deeply known, deep research is carried out on a sensor, a network layer and an application platform, a real productized practical training system is made by utilizing equipment management and a basic service module of the platform, mass popularization can be carried out, and other practical training systems can be expanded.
The terminal control system can also realize group batch control or timing control. Taking group batch control as an example, a standard service application interface can be provided after configuration by selecting an equipment list and setting a batch control mode on a platform, and a third-party application platform can realize a batch control function through the interface. Meanwhile, data interface expansion can be performed on batch control, the functions comprise group creation, group editing, group deletion, group query and the like, and developers can realize application service functions related to the air conditioner only by performing some light-weight functions. Meanwhile, the corresponding service function interfaces are also arranged on the service function modules of energy consumption management, electricity utilization safety, environment monitoring and the like, so that the service function modules are convenient for developers to call, and a solid foundation is laid for the development of the whole application system.
On the other hand, the application also provides a terminal control method based on the Internet of things, which is applied to a platform layer. Fig. 5 is a flowchart illustrating a terminal control method based on the internet of things according to an exemplary embodiment. As shown in fig. 5, the method includes:
step 51: acquiring current first state data of the terminal, which is acquired by a data sensor;
step 52: resolving the first state data into second state data which can be identified by a supply application layer, wherein the data format of the first state data is different from that of the second state data;
step 53: and sending the second state data to an application layer, wherein the second state data is used for being recognized by the application layer through a standard API application program interface to obtain the current state of the terminal.
In the present exemplary embodiment, the sensing layer includes at least one controller. Each controller is connected with a data sensor. The data sensor is used for acquiring current first state data of the terminal. The terminals accessed to the internet of things comprise various types of terminal equipment, such as air conditioners, televisions, computers, electric lamps and the like. The collected first state data formats corresponding to different types of terminal devices may be different, for example, when the first state data is multilevel data, the first state data collected for the air conditioner may be set as hexadecimal data, the first state data collected for the television may be set as octal data, and the first state data collected for the electric lamp may be set as binary data.
When the format of the first state data collected by the terminal is set, the data format of the first state data can be determined according to the number of items of the data collected by the terminal. The more items including the collected data, the more data scale numbers for determining the first state data. For example, the collected data of the air conditioner includes more items of data such as an ambient temperature, a switch state, a currently set temperature of the air conditioner, power, a wind speed, humidity, and the like, and at this time, a data format of the first state data collected for the air conditioner may be set to be hexadecimal data. When the data collected by the lamp only includes the data of the items with less on-off state, brightness and power, the data format of the first state data collected by the lamp can be set as binary data. Thereby being beneficial to distinguishing the terminal type through the number of the carry digit.
The second state data is data that the application layer can recognize through a standard API application program interface, and includes JSON field data and the like. The standard API application program interface can be developed by itself and is connected with the platform layer and the application layer. The standard API application program interface can contain function information corresponding to the second state data and various collected data of various terminals. For example, taking an air conditioner as an example, when the second state data is JSON field data, the standard API may include multiple JSON fields, JSON field parameters, and function information corresponding to each JSON field, where the function information includes an on-off state of the air conditioner corresponding to air-switch, an on-off mode of the air conditioner corresponding to air-mode, and a wind speed of the air conditioner corresponding to air-wind _ speed. Wherein, the functions in the function information corresponding to different parameter values in one JSON field are different. For example, air _ switch0 corresponds to an off state of the air conditioner, and air _ switch1 corresponds to an on state of the air conditioner. The air _ wind _ speed0 corresponds to the automatic wind speed of the air conditioner, and the air _ wind _ speed 1-5 correspond to the 1-5 level wind speed of the air conditioner respectively. When the second state data is JSON field data, the second state data may include a JSON field and JSON field parameters. Therefore, when the application layer cannot directly read the first state data, the application layer can directly read the second state data through a standard API (application program interface) to obtain the current state of the terminal.
When the platform layer analyzes the first state data, the first state data can be analyzed according to a self-defined application data protocol. The application data protocol includes a conversion mode or data correspondence for performing mutual data conversion between the first state data and the second state data.
When an application data protocol is established, data items needing data acquisition for the terminal are determined firstly. For example, when the terminal is an air conditioner, determining that the data items to be acquired sequentially comprise from left to right according to the first state data:
air conditioner switch, air conditioner mode, air conditioner wind speed, air conditioner temperature, ambient temperature, power consumption, power, on-off state. The data bits of each item of data in the first state data can be determined according to the possible value range of the item of data. For example, the air conditioner switch only has on or off states, and the air conditioner switch only occupies two data bits. The power value of the air conditioner is larger and can reach 1200 watts, and the data item can be set to four data bits and the like. The data bit occupied by each data item can be set according to the requirement. In this example, the air-conditioning switch is set to occupy two data bits, the air-conditioning mode occupies two data bits, the air-conditioning wind speed occupies two data bits, the air-conditioning temperature occupies two data bits, the ambient temperature occupies two data bits, the power consumption occupies four data bits, and the power-on/off state occupies two data bits.
Then, the corresponding relation between the data value in each data item and the terminal state is established. For example, the data item: the air conditioner switch comprises a starting state and a shutdown state, wherein the data value corresponding to the starting state can be 01, and the data value corresponding to the shutdown state can be 00; the air-conditioning mode comprises 5 modes of automatic, heating, refrigerating, dehumidifying and ventilating, wherein a data value corresponding to an automatic state can be 01, a data value corresponding to a heating state can be 02, a data value corresponding to a refrigerating state can be 03, a numerical value corresponding to a dehumidifying state can be 04, a data value corresponding to a ventilating state can be 05 and the like. Different states of each data item air conditioner respectively correspond to different data values. The amount of power consumption can be directly represented by the value of the data item, for example, the power consumption is 95 kwh, which can be represented by 005F bits, and the environmental temperature is 26 ℃, which can be represented by 1A. When the air conditioner is in a power-on state, the starting, refrigerating, 2-level air and air conditioner temperature are set to be 24 ℃, the environment temperature is 26 ℃, the power consumption is 95 kwh, the power is 1200W, and the first state data collected by the data sensor is 010302181A005F04B 001. At this time, the correspondence relationship between each data item in the first state data and the second state data is as shown in table 1 and table 2. Table 1 is a first relational comparison table of each data item in the first state data and the second state data. And table 2 is a second relational comparison table of each data item in the first state data and the second state data.
According to the terminal control method based on the Internet of things, the data sensor is controlled by the controller to acquire the current first state data of the terminal, and the first state data is transmitted to the platform layer. And the platform layer is in communication connection with the controller and analyzes the received first state data into second state data which can be identified by the supply layer. And the application layer is connected with the platform layer through a standard API application program interface, and receives and identifies the second state data from the platform layer through the standard API application program interface to obtain the current state of the terminal. Due to the fact that the types of terminals accessed to the internet of things are various, communication modes of communication between a sensing layer and the terminals are different, terminal data collected by a controller are different in data format, but the communication protocol of external communication of an application layer is fixed, and therefore the application layer cannot directly read all the collected terminal data of various types.
Therefore, in the application, the platform layer between the sensing layer and the application layer is provided to realize the analysis and the compilation between the first state data and the second state data, and a standard API interface is formed to allow the application layer to read the second state data corresponding to various terminals analyzed by the platform layer to obtain the current state of the terminal. Therefore, the flexibility of application program development of the application layer is improved under the condition of not replacing the access equipment through the analysis and the compilation between the first state data and the second state data of the platform layer, so that the development of the application layer is not limited to equipment of a certain type of physical communication protocol any more.
In some embodiments, the method further comprises:
receiving a control instruction which is generated based on input preset state information and sent by the application layer, wherein the preset state information is used for indicating an expected state entered by the terminal;
generating third state data based on the received control instruction;
and sending the third state data to the controller, so that the controller can control the terminal to enter the expected state according to the third state data.
In the exemplary embodiment, after acquiring the current state of the terminal, the application layer adjusts the state of the terminal according to the current environment of the terminal to enter the desired state. For example, taking an air conditioner as an example, when the current temperature of the air conditioner is not suitable for the current ambient temperature, the cooling temperature of the air conditioner needs to be adjusted, and at this time, the control command may be generated based on the input preset state information. The preset state information is used for indicating the expected state that the air conditioner needs to enter, including the cooling temperature and the like. The platform layer generates third state data based on the received control instruction. The data format of the third state data may be the same as the data format of the first state data. The third status data may include a data value corresponding to each data item, for example, 010302161a005F04B 001. The current refrigerating temperature of the air conditioner is adjusted from 24 ℃ to 22 ℃ and the like. The third status data is data that the controller can directly read to adjust the status of the terminal.
In some embodiments, before acquiring the current first state data of the terminal, the method includes:
establishing communication between the controller and the platform layer based on a gateway supporting a LoRaWAN long-distance wireless communication protocol; the controller is connected with the data sensor and used for controlling the data sensor to acquire the current first state data of the terminal.
In the exemplary embodiment, the platform layer is provided with a gateway supporting a LoRaWAN long-distance wireless communication protocol, and the gateway is used for connecting a controller and supports controller access of the LoRaWAN protocol.
The LoRa is one of low-power-consumption wide area network communication technologies, and is an ultra-long-distance wireless transmission technology based on a spread spectrum technology. LoRaWAN is a set of communication protocol and system architecture designed for LoRa long-distance communication network, and is a Media Access Control (MAC) layer protocol. Spread spectrum technology is a technology for expanding a baseband signal to a wider frequency band by injecting a higher frequency signal, and is basically characterized in that the bandwidth of a signal used for transmitting information is far larger than the bandwidth of the information. A LoRaWAN gateway is arranged on a platform layer of the terminal control system to support the controller access of a LoRaWAN protocol.
In some embodiments, before acquiring the current first state data of the terminal collected by the data sensor, the method further includes:
establishing an object model corresponding to the equipment ID based on the equipment ID identification number of the terminal; the device IDs corresponding to terminals of different device types are different, and the object models correspondingly established by different device IDs are different;
the object model at least comprises function information representing the equipment functions of the terminal and an access mode of a controller corresponding to the terminal accessing the platform layer; the access modes of controllers corresponding to terminals with different equipment IDs accessing the platform layer are different; the controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer.
In the present exemplary embodiment, terminals of different device types may be defined as different device IDs, for example, an air conditioner may be defined as a first device ID, and the first device ID may be composed of letters, for example, qwrerw. The electric light may be defined as a second device ID, which may be composed of numbers, such as 123456 or the like. I.e. the ID numbers of the terminal-defined device IDs of different device types have different composition patterns. And the controllers corresponding to the terminals with different ID number forming modes have different access modes for accessing the platform layer. The controllers which are accessed to the platform layer in different access modes have different corresponding communication protocols when establishing communication with the platform layer. For example, a controller controlling an air conditioner may be accessed based on a LoRaWAN protocol gateway. The controller controlling the electric lamp may be accessed based on a communication module supporting NB-IoT protocol, etc. At this time, it is merely an exemplary illustration, and the specific device access platform layer may select an access mode access platform layer according to a protocol type supported by the specific device.
In this exemplary embodiment, on the basis that the access device supports the relevant protocol, the access modes of the controller access platform layers corresponding to different device ID terminals may also be the same. For example, in the case that both the controller for controlling the air conditioner and the controller for controlling the electric lamp support the NB-IoT protocol, the platform layer can be accessed through the communication module supporting the NB-IoT protocol.
The application also provides a server. Fig. 6 is a schematic diagram illustrating a server architecture according to an example embodiment. As shown in fig. 6, a server provided in an embodiment of the present application includes: a processor 430 and a memory 420 for storing a computer program capable of running on the processor, wherein the processor 430 is configured to execute the steps of the method provided by the embodiments described above when running the computer program.
The present application also provides a computer-readable storage medium. The computer-readable storage medium provided by the embodiments of the present application stores thereon a computer program, which when executed by a processor implements the steps of the method provided by the above-mentioned embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
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, that is, 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, all the functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be separately used as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
In some cases, any two of the above technical features may be combined into a new method solution without conflict.
In some cases, any two of the above technical features may be combined into a new device solution without conflict.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media capable of storing program codes, such as a removable Memory device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, and an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.