Disclosure of Invention
In order to solve the problem that home management response in the current smart home management system is not timely enough, the invention aims to provide an intelligent home Internet of things communication method based on an Aliskiu IoT Hub platform.
The technical scheme adopted by the invention is as follows:
an Alicloud IoT Hub platform-based intelligent home Internet of things communication method comprises the following steps:
s101, after accessing a network server and generating a home equipment control request message through man-machine interaction operation by a user terminal, uploading the home equipment control request message to the network server, wherein the home equipment control request message comprises a control request unique number, a user terminal unique identifier, a target home ID, a target equipment ID and control request content, and the control request content comprises a target equipment attribute ID and an equipment attribute value required to be updated;
s102, after receiving the household equipment control request message, the network server converts the household equipment control request message into a control instruction, and then issues the control instruction as a first Payload message to a first Topic of an Alice cloud IoT Hub platform according to an MQTT communication protocol, so that an online target family gateway subscribing to the first Topic instantly receives the control instruction, wherein the target family gateway corresponds to the target family IDs one by one;
s103, after receiving the control instruction, the target home gateway analyzes the control instruction, and then controls the target home equipment to execute a corresponding equipment attribute updating action according to the target equipment attribute ID and the equipment attribute value obtained through analysis, wherein the target home equipment is uniquely determined according to the target equipment ID obtained through analysis;
s104, after the target household equipment is executed, feeding back control receipt information to a target home gateway which is connected with the target household equipment;
s105, after receiving the control receipt information, the target home gateway issues the control receipt information and the corresponding control request unique number as a second Pay load message to a second Topic of the IoT Hub platform according to an MQTT communication protocol, so that an online network server subscribing to the second Topic instantly receives the control receipt information and the corresponding control request unique number;
and S106, after receiving the control receipt information and the corresponding control request unique number, the network server updates information corresponding to the control request unique number in the database according to the control receipt information, and informs the user terminal corresponding to the control request unique number through a silent push technology to refresh and display the state of the household equipment corresponding to the target equipment ID.
And optimally, the user terminal runs a client side APP program based on an android system or an iOS system, and the client side APP program is provided with functions of performing virtual key operation, voice input operation and/or detail page operation on each household device in a household device display interface.
And further optimally, displaying all the networked household equipment on the display interface of the household equipment by adopting a Table View technology.
Preferably, when a plurality of home equipment display interfaces corresponding to different houses one to one are created on the client APP, the home equipment display interfaces are subjected to sequencing display from near to far or sequencing display from far to near according to the geographical position degrees of the user terminal and the corresponding house.
Specifically, the client side APP program accesses the network server by calling an HTTP/HTTPS interface.
Further preferably, before the step S101, the following steps are further included:
s201, after a user terminal is associated with a home gateway to be activated by adopting a Bluetooth communication technology, the client APP transmits a locally stored home WiFi account and password and gateway triple information acquired from an Aliskiu IoT Hub platform to the home gateway to be activated through an established Bluetooth D2D network, wherein the gateway triple information comprises a unique gateway name, a gateway key and a gateway ciphertext;
and S202, after receiving the family WiFi account number, the password and the gateway triple information, starting and completing an activation program by the family gateway to be activated.
Further preferably, before the step S101, the following steps are further included:
s301, after the home gateway successfully completes the pairing with the D2D of the household equipment to be networked, the home gateway issues the generated equipment adding information as a third Payload message to a third Topic of an Alice cloud IoT Hub platform according to an MQTT communication protocol, so that an online network server subscribing to the third Topic instantly receives the equipment adding information, wherein the equipment adding information comprises a home ID and an equipment ID of the household equipment to be networked;
s302, after receiving the equipment adding information, the network server determines a corresponding user terminal according to the incidence relation between the locally bound family ID and the unique identification of the user terminal and the family ID in the equipment adding information, then binds the incidence relation between the user terminal and the equipment ID in the equipment adding information, and informs the user terminal to refresh and display the state of the household equipment corresponding to the equipment ID through a silent push technology.
Specifically, in step S102, the step of converting the home device control request message into a control instruction includes:
converting the household equipment control request message into a 16-system control instruction through a < 16-system to json/json to 16-system > script function.
Specifically, the user terminal is a smart phone or a tablet personal computer, the network server is an APP server or a Web server, and the home gateway is an intelligent wireless gateway based on a ZigBee communication technology and/or a WiFi communication technology.
Specifically, the target household equipment is a control switch, an air conditioner, a television, a door lock, a gas valve, a holder of an indoor camera, a visible talkback doorbell or a gas alarm.
The invention has the beneficial effects that:
(1) the invention provides a novel intelligent household Internet of things communication method capable of meeting the requirement of user control feedback timeliness, namely, on one hand, subscription message transmission (namely transmission of a control instruction and a control receipt) between a network server and a household gateway is realized on an Aliyun IoT Hub platform by adopting an MQTT communication protocol, and the timeliness of information transmission can be guaranteed by utilizing the communication characteristics of the MQTT communication protocol, so that after a user terminal sends a control request, target household equipment can execute and respond as fast as possible, the receipt time is shortened to the maximum extent, the use state of the household equipment can be updated quickly, and the timeliness requirement of a user is met; on the other hand, the home gateway only needs to subscribe 1 publishing (publish) theme and 1 subscription (subscribe) theme, so that a plurality of devices in the operating room can be operated, the purposes of economy, practicability and easy popularization can be achieved;
(2) the intelligent home Internet of things communication method has the characteristics of automatic gateway activation, convenience in equipment addition, easiness in multi-house management and the like, can provide a simple operation interface, is convenient to operate, and is particularly suitable for old people to control home equipment through an APP;
(3) the embodiment also improves the safety of remote control, and the Alicloud IoT Hub platform can be adopted for the cloud-entering authentication of the equipment, so that the safety is higher; at a user terminal, key information (such as gateway triple information) also adopts an AES encryption technology (an advanced encryption standard which can break a secret key for ten thousand years), so that the sufficient safety of the information is ensured; when the home gateway sends an unlocking instruction to the door lock, a nonrepetitive encryption instruction can be adopted, even if a hacker intercepts the unlocking instruction at a certain position through some devices and technologies, the door lock cannot be opened when the instruction is copied and sent to the door lock again, and the instruction is discarded after being used once;
(4) the home gateway adopting the ZigBee communication technology can realize the transmission distance of 100 meters and the connection performance of tens of thousands of sub-devices, and can be applied to places with large occupied area and more devices, such as villas, retirees and the like;
(5) because the Aliskiu IoT Hub platform is adopted, a proxy server is not required to be built by self, the technology is simple, the development period is short, the use is stable, the disconnection and downtime are avoided, and the failure rate is low.
Detailed Description
The invention is further described with reference to the following figures and specific embodiments. It should be noted that the description of the embodiments is provided to help understanding of the present invention, but the present invention is not limited thereto. Specific structural and functional details disclosed herein are merely illustrative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of example embodiments of the present invention.
It should be understood that, for the term "and/or" as may appear herein, it is merely an associative relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, B exists alone, and A and B exist at the same time; for the term "/and" as may appear herein, which describes another associative object relationship, it means that two relationships may exist, e.g., a/and B, may mean: a exists independently, and A and B exist independently; in addition, for the character "/" that may appear herein, it generally means that the former and latter associated objects are in an "or" relationship.
It will be understood that when an element is referred to herein as being "connected," "connected," or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. Conversely, if a unit is referred to herein as being "directly connected" or "directly coupled" to another unit, it is intended that no intervening units are present. In addition, other words used to describe the relationship between elements should be interpreted in a similar manner (e.g., "between … …" versus "directly between … …", "adjacent" versus "directly adjacent", etc.).
It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments of the invention. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises," "comprising," "includes" and/or "including," when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, numbers, steps, operations, elements, components, and/or groups thereof.
It should also be noted that, in some alternative implementations, the functions/acts noted may occur out of the order noted in the figures. For example, two figures shown in succession may, in fact, be executed substantially concurrently, or the figures may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
It should be understood that specific details are provided in the following description to facilitate a thorough understanding of example embodiments. However, it will be understood by those of ordinary skill in the art that the example embodiments may be practiced without these specific details. For example, systems may be shown in block diagrams in order not to obscure the examples in unnecessary detail. In other instances, well-known processes, structures and techniques may be shown without unnecessary detail in order to avoid obscuring example embodiments.
Example one
As shown in fig. 1 to 2, the smart home internet of things communication method based on the aricloud IoT Hub platform provided in this embodiment may include, but is not limited to, the following steps S101 to S106.
S101, after accessing a network server and generating a home device control request message through man-machine interaction operation by a user terminal, uploading the home device control request message to the network server, wherein the home device control request message can but is not limited to include a control request unique number, a user terminal unique identifier, a target home ID, a target device ID, control request content and the like, and the control request content can but is not limited to include a target device attribute ID, a device attribute value requesting updating and the like.
In the step S101, the user terminal is an electronic device owned by a resident, so that the resident can perform remote control, remote monitoring, multimedia communication, and the like on networked home devices; specifically, the user terminal may be, but is not limited to, a smart phone or a tablet computer. The home device control request message is used for prompting the network server to generate a corresponding control instruction so as to be transmitted to the target home gateway, and the target home device is controlled to execute actions corresponding to the control request content, such as turning off a light, turning on the light, adjusting the temperature or setting a working mode. The home device control request message may be generated, but not limited to, through a human-computer interaction operation performed by a client APP program running on a user terminal, that is, optimized, where the user terminal runs a client APP program based on an android system or an iOS system, and the client APP program provides functions of performing a virtual key operation, a voice input operation, and/or a detail page operation on each home device in a display interface of the home device, for example, remotely controlling indoor home devices such as a lamp control switch, a window pusher, and a curtain device by clicking a switch virtual button or a voice input mode at an iPhone terminal; in addition, an air conditioner, a television, a door lock, a gas valve, a rotating cradle head of an indoor camera, a visual intercom doorbell and an outdoor person can be operated and started on the detail page of the equipment. In addition, specifically, the client APP program accesses the web server by calling an HTTP/HTTPs interface, so as to implement communication connection between the user terminal and the web server.
In the step S101, optimally, each networked home device may be displayed on the home device display interface by using a Table View technology. The Table View technology is an existing Table View technology, home equipment can be listed on one page as much as possible, an interface is simple and clear, operation is simple, and for example, the operation of turning on and off a light can be completed only by clicking a cell.
In the step S101, optimally, when a plurality of home device display interfaces respectively corresponding to different houses one to one are created on the client APP program, the home device display interfaces are subjected to sequential display from near to far or sequential display from far to near according to the degree of the geographical position of the user terminal and the corresponding house. Therefore, the method is applicable to the condition that the resident has multiple sets of properties, not only can conveniently create multiple home equipment display interfaces, but also can conveniently perform centralized control on home equipment in different houses, and is beneficial to user management and operation.
Before step S101, the gateway device serving as the target home gateway needs to be activated, that is, an operation of writing a WiFi account and a password into the gateway is completed, which is called "cloud on device", and only when the gateway is cloud on, the control instruction corresponding to the home device control request message can be received by the target home gateway, so that the method further includes the following steps: s201, after a user terminal associates a home gateway to be activated by adopting a Bluetooth communication technology, the client APP transmits a locally stored home WiFi account and password and gateway triple information acquired from an Ali cloud IoT Hub platform to the home gateway to be activated through an established Bluetooth D2D network (terminal direct connection), wherein the gateway triple information comprises a unique gateway name, a gateway secret key and a gateway ciphertext; and S202, after receiving the family WiFi account number, the password and the gateway triple information, starting and completing an activation program by the family gateway to be activated. In the foregoing step S201, the unique gateway name is a field in a topic subscribed by the home gateway, called deviceName, each home gateway is a device and needs to have a unique different deviceName, the aristoloc IoT Hub platform allocates a gateway key, namely a productKey, and a gateway ciphertext, namely a productSecret, to each home gateway, and these three groups are combined together to be called triplet information, and they may be used for performing operations such as authentication when logging in aristoloc after processing such as encryption, so as to achieve the purpose of security. In addition, the binding of the families and the home gateways is in one-to-one correspondence, one family corresponds to one home gateway, the user terminal can only transmit the target home ID when uploading the home equipment control request message, and the network server can convert the target home ID into the unique gateway name of the target home gateway according to the binding relationship information stored in the database so as to achieve the purpose of remotely controlling the home equipment. Compared with the mainstream gateway activating mode in the market at present (namely, a mobile phone is connected with a Wi-Fi signal sent by a gateway in an AP mode, so that networking of the mobile phone and the gateway is realized, and then an SSID and a password of a household WiFi are manually written into the gateway, in the process, the distances among the mobile phone, the gateway and a household Wi-Fi router are kept within 1.5 meters, the time for writing data is long, about 15-30 seconds or even longer, the activation failure is easy to occur in the process, the activation can be successfully realized by repeating for many times, and the user experience is influenced), the method can simplify the activating steps, so that the activation only needs 3 seconds, the success rate is high, and the user experience is good.
Before the step S101, it is further required to add the home device serving as the target home device in the home device display interface, that is, the optimization method further includes the following steps: s301, after the home gateway successfully completes the pairing with the D2D of the household equipment to be networked, the home gateway issues the generated equipment adding information as a third Payload message to a third Topic of an Alice cloud IoT Hub platform according to an MQTT communication protocol, so that an online network server subscribing to the third Topic instantly receives the equipment adding information, wherein the equipment adding information comprises a home ID and an equipment ID of the household equipment to be networked; s302, after receiving the equipment adding information, the network server determines a corresponding user terminal according to the incidence relation between the locally bound family ID and the unique identification of the user terminal and the family ID in the equipment adding information, then binds the incidence relation between the user terminal and the equipment ID in the equipment adding information, and informs the user terminal to refresh and display the state of the household equipment corresponding to the equipment ID through a silent push technology. In the step S302, the association relationship between the home ID and the unique identifier of the user terminal may be manually bound after the home gateway is activated and the home device display interface is created, so that one unique identifier of the user terminal may correspond to a plurality of different home gateways (the home gateways generally correspond to the home device display interfaces one to one), and thus through the steps S301 to S302, adding of devices may be particularly convenient, and only one hand is required to press the home gateway pairing key and the other hand is required to press the pairing key of the home devices to realize pairing, and after the pairing is successful, only a client APP program is refreshed, a newly added home device may be seen, and it may be ensured that the one-time pairing success rate is large, user experience is optimized, and no code scanning pairing is required, and many operation steps are omitted.
And S102, after receiving the household equipment control request message, the network server converts the household equipment control request message into a control instruction, and then issues the control instruction as a first Payload message to a first Topic of an IoT Hub platform of the Alice cloud according to an MQTT communication protocol, so that an online target family gateway subscribing to the first Topic instantly receives the control instruction, wherein the target family gateway corresponds to the target family ID one to one.
In step S102, the network server is an electronic device owned by a service provider, and is configured to convert the home device control request message, generate and issue a corresponding control instruction, receive information such as a control receipt, and store data related to management in a cloud; specifically, the network server may be, but is not limited to, an APP server or a Web server. In order to ensure that the control command can be identified by the home gateway, specifically, the step of converting the home device control request message into the control command includes converting the home device control request message into a 16-system control command through a < 16-system to json/json to 16-system > script function, where the < 16-system to json/json to 16-system > script function is an existing script function for realizing 16-system to json text conversion. The Alice cloud IoT Hub platform is a cloud platform which provides safe and reliable equipment connection communication capability at present, supports equipment data acquisition and cloud uploading, and supports a rule engine to transfer data and cloud data to an equipment sending end, and the adopted communication protocol is mainly the existing MQTT protocol.
The MQTT protocol (Message Queuing Telemetry Transport) is a Message protocol based on a publish/subscribe paradigm under an ISO standard (ISO/IEC PRF 20922), works on a TCP/IP protocol family, is a publish/subscribe Message protocol designed for remote equipment with low hardware performance and under the condition of poor network condition, namely a Message publish/subscribe Transport protocol based on a client-server, has the characteristics of light weight, simplicity, openness and easiness in implementation, and has a very wide application range due to the characteristics; in many cases, including in restricted environments, such as: machine-to-machine (M2M) communication and internet of things (IoT); it has found widespread use in communicating sensors over satellite links, occasionally dial-up medical devices, smart homes, and some miniaturized devices. There are three identities in the MQTT protocol communication process: publisher (Publish), Broker (i.e., platform server), subscriber (Subscribe); the message publisher and the message subscriber are clients, the message broker is a server, and the message publisher can be a subscriber at the same time; the transmitted messages of the MQTT are divided into: theme (Topic) and Payload (Payload); topic, which can be understood as the type of message, after a subscriber subscribes (Subscribe), the subscriber will receive the message content (Payload) of the Topic; payload, which may be understood as the content of a message, refers to content that a subscriber specifically wants to use. Therefore, in this embodiment, the network server may serve as a publisher to transmit the control command to the target home gateway (which serves as a subscriber in this case); it is also possible to receive control receipt information and the like from the target home gateway (which is also a publisher at this time) as a subscriber, and device addition information from the home gateway (which is also a publisher at this time) to which the device is being added. In addition, the target home gateway can be, but is not limited to, an intelligent wireless gateway based on a ZigBee communication technology and/or a WiFi communication technology, and the like.
And S103, after receiving the control instruction, the target home gateway analyzes the control instruction, and then controls the target home equipment to execute a corresponding equipment attribute updating action according to the target equipment attribute ID and the equipment attribute value acquired through analysis, wherein the target home equipment is uniquely determined according to the target equipment ID acquired through analysis.
In the step S103, the target household device may be, but is not limited to, a control switch, an air conditioner, a television, a door lock, a gas valve, a pan-tilt head of an indoor camera, a visual intercom doorbell, a gas alarm, or the like. In addition, the requested control behavior can be completed by controlling the target household equipment to execute corresponding equipment attribute updating actions, for example, the equipment attribute value of a certain lamp is updated and set to be in an on state, and the control of turning on the lamp can be realized; or the attribute value of equipment of a certain lamp is updated and set to be in a closed state, so that the control of closing the lamp can be realized.
And S104, after the target household equipment is executed, feeding back control receipt information to the target household gateway which is connected with the target household equipment.
And S105, after receiving the control receipt information, the target home gateway issues the control receipt information and the corresponding control request unique number as a second Payload message to a second Topic of the IoT Hub platform according to an MQTT communication protocol, so that an online network server subscribing to the second Topic instantly receives the control receipt information and the corresponding control request unique number.
In step S105, the target home gateway serves as a publisher of the control receipt information, and the web server serves as a subscriber of the control receipt information.
And S106, after receiving the control receipt information and the corresponding control request unique number, the network server updates information corresponding to the control request unique number in the database according to the control receipt information, and informs the user terminal corresponding to the control request unique number through a silent push technology to refresh and display the state of the household equipment corresponding to the target equipment ID.
In step S106, the silent push technology is an existing message push method launched after the iOS7 system, and is different from other push methods in that it allows an application to run a piece of code in a background (background) state after receiving a notification, which can be used for the client APP program to obtain updated content from the web server.
Through the steps S101 to S106, on one hand, because the MQTT communication protocol is adopted to realize subscription message transmission (i.e., transmission of a control instruction and a control receipt) between the network server and the home gateway on the aristoloc IoT Hub platform, the timeliness of information transmission can be guaranteed by using the communication characteristics of the MQTT communication protocol, so that after the user terminal sends a control request, the target home equipment can execute and respond as fast as possible, the time for receiving the receipt is shortened to the maximum extent, the use state of the home equipment can be updated quickly, and the timeliness requirement of the user is met; on the other hand, the home gateway only needs to subscribe 1 publishing (publish) theme and 1 subscription (subscribe) theme, so that a plurality of devices in the operating room can be completed, the purposes of economy, practicability and easy popularization are achieved. In addition, still can provide brief operation interface, convenient operation is particularly suitable for the old person user to pass through the equipment of APP control family.
In summary, the intelligent home internet of things communication method based on the arriyun IoT Hub platform provided by the embodiment has the following technical effects:
(1) on one hand, subscription message transmission (namely transmission of a control instruction and a control receipt) between a network server and a home gateway is realized on an Ali cloud IoT Hub platform by adopting an MQTT communication protocol, and the timeliness of the information transmission can be guaranteed by utilizing the communication characteristics of the MQTT communication protocol, so that after a user terminal sends a control request, target home equipment can execute and respond as fast as possible, the time for receiving the receipt is shortened to the maximum extent, the use state of the home equipment can be updated fast, and the timeliness requirement of a user is met; on the other hand, the home gateway only needs to subscribe 1 publishing (publish) theme and 1 subscription (subscribe) theme, so that a plurality of devices in the operating room can be operated, the purposes of economy, practicability and easy popularization can be achieved;
(2) the intelligent home Internet of things communication method has the characteristics of automatic gateway activation, convenience in equipment addition, easiness in multi-house management and the like, can provide a simple operation interface, is convenient to operate, and is particularly suitable for old people to control home equipment through an APP;
(3) the embodiment also improves the safety of remote control, and the Alicloud IoT Hub platform can be adopted for the cloud-entering authentication of the equipment, so that the safety is higher; at a user terminal, key information (such as gateway triple information) also adopts an AES encryption technology (an advanced encryption standard which can break a secret key for ten thousand years), so that the sufficient safety of the information is ensured; when the home gateway sends an unlocking instruction to the door lock, a nonrepetitive encryption instruction can be adopted, even if a hacker intercepts the unlocking instruction at a certain position through some devices and technologies, the door lock cannot be opened when the instruction is copied and sent to the door lock again, and the instruction is discarded after being used once;
(4) the home gateway adopting the ZigBee communication technology can realize the transmission distance of 100 meters and the connection performance of tens of thousands of sub-devices, and can be applied to places with large occupied area and more devices, such as villas, retirees and the like;
(5) because the Aliskiu IoT Hub platform is adopted, a proxy server is not required to be built by self, the technology is simple, the development period is short, the use is stable, the disconnection and downtime are avoided, and the failure rate is low.
The various embodiments described above are merely illustrative, and may or may not be physically separate, as they relate to elements illustrated as separate components; if reference is made to a component displayed as a unit, it may or may not be a physical unit, and may be located in one place or distributed over 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. One of ordinary skill in the art can understand and implement it without inventive effort.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: modifications of the technical solutions described in the embodiments or equivalent replacements of some technical features may still be made. And such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Finally, it should be noted that the present invention is not limited to the above alternative embodiments, and that various other forms of products can be obtained by anyone in light of the present invention. The above detailed description should not be taken as limiting the scope of the invention, which is defined in the claims, and which the description is intended to be interpreted accordingly.