Summary of the invention
The purpose of the embodiment of the present invention is that providing the method and apparatus and machine readable storage for controlling equipment folding
Medium to solve the above technical problems or at least is partially solved above-mentioned technical problem.
To achieve the goals above, the embodiment of the present invention provides a kind of method for controlling equipment folding, for including
The first switch panel of first switch, which comprises the first switch is associated with second switch;When described first
When the state change of switch, the status change notification of state after indicating first switch variation is sent to including described second opening
The second switch panel of pass, so that the state of the second switch is consistent with the state of the first switch;Wherein, described
At least one of one switch and the second switch are connect with the control loop of the equipment controlled.
Optionally, it is described by the first switch it is associated with second switch include: transmission association request, the association is asked
Seek the mark ID including the first switch;Receive the association confirmation from the second switch panel, the association confirmation packet
Include the ID of the second switch;According to it is received association confirmation in include second switch ID, by the first switch with
The second switch is associated.
Optionally, it is described by the first switch it is associated with second switch include: to receive from the second switch face
The association request of plate, the association request include the ID of the second switch;According to include in received association request
The ID of two switches, the first switch is associated with the second switch;Association confirmation is sent to the second switch panel,
The association confirmation includes the ID of the first switch.
Optionally, the method also includes: receive the status change notification from the second switch panel, the state
Change notification indicates state after the second switch variation;According to the instruction of received status change notification the second switch
The state of first switch described in Status Change after variation, so that the state phase of the state of the first switch and the second switch
Unanimously.
Optionally, the method also includes: send and cancel association notice to the second switch panel, cancellations is associated with
Notice includes the ID of the first switch;And/or it receives the cancellation from the second switch panel and is associated with notice, the cancellation
Associate notification includes the ID of the second switch, and cancels institute according to the ID for cancelling the second switch for including in association notice
State being associated with for first switch and the second switch.
According to another aspect of the present invention, a kind of device opened and closed for controlling equipment is provided, for opening including first
The first switch panel of pass, described device include: relating module, for the first switch is associated with second switch;Become
Change module, the state for when the state change of the first switch, sending state after the instruction first switch changes becomes
Change notice to the second switch panel for including the second switch, so that the state of the second switch and the first switch
State is consistent;Wherein, the control loop of at least one of the first switch and the second switch and the equipment controlled
Connection.
Optionally, for the relating module for sending association request, the association request includes the mark of the first switch
Know ID;The association confirmation from the second switch panel is received, the association confirmation includes the ID of the second switch;According to
It is received association confirmation in include second switch ID, the first switch is associated with the second switch.
Optionally, the relating module for receiving the association request from the second switch panel, ask by the association
Seek the ID including the second switch;According to include in received association request second switch ID, described first is opened
It closes associated with the second switch;Association confirmation is sent to the second switch panel, and association confirmation includes described the
The ID of one switch.
Optionally, the variation module is also used to receive the status change notification from the second switch panel, described
Status change notification indicates state after the second switch variation;According to the instruction of received status change notification described second
The state of first switch described in Status Change after switch change, so that the shape of the state of the first switch and the second switch
State is consistent.
Optionally, described device further include: cancel module, cancel association notice to the second switch face for sending
Plate, the ID for cancelling associate notification and including the first switch;And/or it receives the cancellation from the second switch panel and closes
Connection knows, the ID for cancelling associate notification and including the second switch, and cancels include in association notice the according to described
The ID of two switches cancel being associated with for the first switch and the second switch.
According to another aspect of the invention, a kind of machine readable storage medium is provided, on the machine readable storage medium
It is stored with instruction, which is used for so that machine execution is aforementioned described in any item for controlling equipment opening/closing method.
Through the above technical solutions, the first switch is associated with second switch, when the state change of first switch
When, the status change notification of state after instruction first switch variation is sent to the second switch panel for including second switch, so that
The state of second switch and the state of first switch are consistent, and at least one of first switch and the second switch is set with what is controlled
Standby control loop connection;It so, it is possible to be associated between different switches, single control switch may be implemented flexibly to rise
Grade;And dual control function can be realized without practical wiring support, increases the flexibility of switch and control relationships among devices.
The other feature and advantage of the embodiment of the present invention will the following detailed description will be given in the detailed implementation section.
Specific embodiment
It is described in detail below in conjunction with specific embodiment of the attached drawing to the embodiment of the present invention.It should be understood that this
Locate described specific embodiment and be merely to illustrate and explain the present invention embodiment, is not intended to restrict the invention embodiment.
Fig. 1 is according to an embodiment of the present invention for controlling the flow chart of the method for equipment folding;This method can be used for out
It closes in panel.Switch panel can be intelligent switch, and switch panel may include microcontroller, relay, communication component.According to relay
The number of device can respectively constitute all the way, two tunnels, three-way switch panel.As shown in Fig. 2, microcontroller controls relay by I/O port
Normally opened contact open and close, to realize the open and close of load circuit, while microcontroller is able to detect load circuit
Current state.Wireless communication technique can be used in communication component, and (ZigBee (ZigBee protocol) 433MHz) is communicated.It opens
The control of pass and state can be transferred to intelligent gateway by communication component, and switch panel can be taken by communication component and cloud
Business device and the place APP (application) terminal are communicated.It can also carry out passing through interaction by communication component between switch panel.Such as Fig. 1
Shown, this method is used for the first switch panel including first switch, and this method may include following steps.
In step s 110, first switch is associated with second switch.
Wherein, at least one of first switch and the second switch is connect with the control loop of the equipment controlled.
First switch and first switch can be relay shown in Fig. 2.For example, in the scenario shown in fig. 3,
Switch panel 1 includes switch 1-1 and switch 1-2, and switch panel 2 includes switch 2-1 and switch 2-2.Use opening for switch panel 1
The switch 2-1 of pass 1-1 and switch panel 2 realizes the dual control to lamp L1.The control loop of lamp L1 is connect with switch 2-1, is opened in this way
The opening and closing for closing 2-1 can control lighting and extinguishing for lamp L1.In order to realize control of the switch 1-1 to lamp L1, need by
Switch 1-1 is associated with switch 2-1.For example, switch 1-1 and switch 2-1 is triggered 5~10 seconds simultaneously, switch panel 1 and switching surface
Plate 2 knows that switch 1-1 and switch 2-1 enter association mode respectively, at this point, switch 1-1 and switch 2-1 passes through communication component each other
Bi-directional exchanges of information is carried out, switch panel 1 corresponds to the ID that switch 1-1 stores associated switch 2-1 after the completion of information exchange
(mark), switch panel 2 correspond to switch 2-1 and store its ID for being associated with switch 1-1.In this way, realizing switch 1-1 and switch 2-
Association between 1.
In one embodiment, as shown in figure 4, by first switch it is associated with second switch may include following steps.
In step S402, association request is sent.
Wherein, association request includes the ID of first switch.
In step s 404, the association confirmation from second switch panel is received.
Wherein, association confirmation includes the ID of second switch.
In step S406, according to include in received association confirmation second switch ID, by first switch and the
Two switches are associated.
In one embodiment, as shown in figure 5, by first switch it is associated with second switch may include following steps.
In step S502, the association request from second switch panel is received.
Wherein, association request includes the ID of second switch.
In step S504, according to include in received association request second switch ID, by first switch and the
Two switches are associated.
In step S506, association confirmation is sent to second switch panel.
Wherein, association confirmation includes the ID of first switch.
For example, switch panel 1 broadcasts association request for the switch 1-1 under association mode, includes in association request
The ID of switch 1-1.Switch panel 2 is directed to the switch 2-1 under association mode and receives association request, determines switch 2-1 and switch 1-1
It is associated, to the ID of inductive switch 2-1 storage lower switch 1-1, and association confirmation is replied, includes the ID of switch 2-1 in association confirmation.
Switch panel 1 receives the confirmation of the association from switch panel 2 for switch 1-1, will according to the ID of switch 2-1 in association confirmation
Switch 1-1 is associated with switch 2-1, to the ID of inductive switch 1-1 storage lower switch 2-1.Switch panel 2 is directed to opening under association mode
It closes 2-1 and broadcasts association request, include the ID of switch 2-1 in association request.Switch panel 1 is directed to the switch 1-1 under association mode
Association request is received, discovery switch 1-1 is associated with switch 2-1, then abandons the association request received, do not retransmit pass
Connection confirmation.Being associated with for switch 1-1 and switch 2-1 so may be implemented.Association is issued first by switch 1-1 in the example above to ask
It asks, realization switch 1-1 is associated with switch 2-1's;Association request can also be issued first by switch 2-1 to realize switch 1-1 and open
Close the association of 2-1.The sequencing of switch 1-1 and switch 2-1 transmission association request can be random, such as be accessed by the two
The randomness of channel determines.
In the step s 120, when the state change of first switch, the state of state after instruction first switch variation is sent
Change notification is to the second switch panel for including second switch, so that the state phase one of the state of second switch and first switch
It causes.
For example, when trigger switch 1-1 is closed, switch panel 1 sends instruction switch 1-1 by communication component and is closed
Status change notification to switch panel 2 communication component.Switch 2-1 is closed by switch panel 2 according to status change notification, in
It is that lamp L1 is lit.When trigger switch 1-1 is disconnected, switch panel 1 sends the shape that instruction switch 1-1 is disconnected by communication component
State change notification is to the communication component of switch panel 2, and according to status change notification by switch 2-1 disconnection, lamp L1 is put out switch panel 2
It goes out.
When switch panel 1-1 is received from external control command, such as passing through APP remote control switch 1-1
In the case where closing or opening, switch 1-1 closing or opening and is sent shape to switch panel 1 by control command based on the received
State change notification indicates switch 1-1 closing or opening to switch panel 2.After switch panel 2 receives status change notification, root
According to status change notification instruction by the Status Change of switch 2-1 be closing or opening.
In one embodiment, as shown in fig. 6, method may also include the steps of.
In step S602, the status change notification from second switch panel is received.
Wherein, state after the variation of status change notification instruction second switch.
In step s 604, according to the instruction of received status change notification second switch variation after Status Change first
The state of switch, so that the state of first switch is consistent with the state of second switch.
For example, when trigger switch 2-1 is closed, lamp L1 is lighted, and Simultaneous Switching panel 2 is referred to by communication component transmission
Show the status change notification of switch 2-1 closure to switch panel 1.Switch panel 1 receives state change by communication component and leads to
Know, be closed switch 1-1 according to the instruction of status change notification so that switch 1-1 and switch 2-1 state are consistent, all for
Closure.When trigger switch 2-1 is disconnected, lamp L1 extinguishes, and switch panel 2 sends what instruction switch 2-1 was disconnected by communication component
Status change notification is to switch panel 1.Switch panel 1 receives status change notification by communication component, according to state change
The instruction of notice disconnects switch 1-1, so that switch 1-1 and switch 2-1 state are consistent, it is all disconnection.
In one embodiment, the method also includes: send and cancel association notice to second switch panel.Wherein, cancel
Associate notification includes the ID of first switch.
Alternatively, the method may also include that the cancellation association notice received from second switch panel, cancel association notice
ID including second switch, and first switch and described second is cancelled according to the ID for cancelling the second switch for including in association notice
The association of switch.
For example, switch 1-1 continuous trigger is multiple, such as 3 times, switch 1-1 starts to carry out cancellation association.Switching surface
Plate 1 is broadcasted by communication component cancels association notice, cancels the ID that associate notification includes switch 1-1.Switch panel 2, which receives, to be taken
After the association notice that disappears, cancellation will be associated between switch 2-1 and switch 1-1 according to association notice is cancelled.
Using method in invention, three control functions can also be realized.As shown in fig. 7, increasing switch panel on the basis of Fig. 3
3, switch panel 3 includes switch 3-1 and switch 3-2.Switch 1-1, switch 2-1 and switch 3-2 in Fig. 7 can be associated.Example
Such as, while by switch 1-1, switch 2-1 and switch 3-2 it triggers 5~10 seconds, switch panel 1, switch panel 2 and switch panel 3 divide
Do not know that switch 1-1, switch 2-1 and switch 3-2 enter association mode, at this point, switch 1-1, switch 2-1 and switch 3-2 pass through
Communication component carries out bi-directional exchanges of information each other, and it is associated to correspond to switch 1-1 storage for switch panel 1 after the completion of information exchange
The ID (mark) of switch 2-1 and switch 3-2, switch panel 2 correspond to switch 2-1 and store its association switch 1-1's and switch 3-2
ID, switch panel 3 correspond to switch 3-2 and store its ID for being associated with switch 1-1 and switch 2-1.In this way, realizing switch 1-1, opening
Close the association between 2-1 and switch 3-2.When any one state change in switch 1-1, switch 2-1 and switch 3-2, institute
Status change notification is sent in switch panel to indicate the state after variation, other associated switches are corresponding to carry out state change,
So keep the consistent of the state of association switch room.It is closed when one any in switch 1-1, switch 2-1 and switch 3-2 issues to cancel
When connection is known, other associated switches are cancelled and being associated between the switch.
Middle method through the invention, for switch panel, no replacement is required hardware can realize multiple open by operation processing
Association between pass, and then dual control, three controls or more controls are carried out to equipment;This method flexible operation increases without carrying out practical wiring
The efficiency of operation, and saved wiring cost.
Fig. 8 is according to an embodiment of the present invention for controlling the structure chart of the device of equipment folding;The device can be used for wrapping
The first switch panel of first switch is included, as shown in figure 8, the device may include following module.
Relating module 810, for first switch is associated with second switch.
Change module 820, for when the state change of first switch, sending the shape of state after instruction first switch changes
State change notification is to the second switch panel for including second switch, so that the state phase one of the state of second switch and first switch
It causes.
Wherein, at least one of first switch and the second switch is connect with the control loop of the equipment controlled.
In one embodiment, for relating module 810 for sending association request, association request includes the mark of first switch
ID;The association confirmation from second switch panel is received, association confirmation includes the ID of second switch;It is true according to the received association of institute
The ID for the second switch for including in recognizing, first switch is associated with second switch.
In one embodiment, relating module 810 is for receiving the association request from second switch panel, association request packet
Include the ID of second switch;According to include in received association request second switch ID, by first switch and second switch
It is associated;Association confirmation is sent to second switch panel, association confirmation includes the ID of first switch.
In one embodiment, variation module 820 is also used to receive the status change notification from second switch panel, state
Change notification indicates state after second switch variation;According to the instruction of received status change notification second switch variation after shape
State changes the state of first switch, so that the state of first switch is consistent with the state of second switch.
In one embodiment, as shown in figure 9, device, which may also include that, cancels module 910, cancel association notice for sending
To second switch panel, cancel the ID that associate notification includes first switch;And/or it receives the cancellation from second switch panel and closes
Connection is known, cancels the ID that associate notification includes second switch, and take according to the ID for cancelling the second switch for including in association notice
The first switch that disappears is associated with the second switch.
Above-mentioned apparatus is corresponding with preceding method, specific embodiment, reference can be made to being described in detail in preceding method, herein not
It repeats again.
The invention also discloses a kind of machine readable storage medium, it is stored with instruction on the machine readable storage medium, it should
Instruction is used for so that machine execution is aforementioned described in any item for controlling equipment opening/closing method.
The optional embodiment of example of the present invention is described in detail in conjunction with attached drawing above, still, the embodiment of the present invention is simultaneously unlimited
Detail in above embodiment can be to the embodiment of the present invention in the range of the technology design of the embodiment of the present invention
Technical solution carry out a variety of simple variants, these simple variants belong to the protection scope of the embodiment of the present invention.
It is further to note that specific technical features described in the above specific embodiments, in not lance
In the case where shield, it can be combined in any appropriate way.In order to avoid unnecessary repetition, the embodiment of the present invention pair
No further explanation will be given for various combinations of possible ways.
It will be appreciated by those skilled in the art that implementing the method for the above embodiments is that can pass through
Program is completed to instruct relevant hardware, which is stored in a storage medium, including some instructions are used so that one
The whole of a (can be single-chip microcontroller, chip etc.) or processor (processor) execution each embodiment the method for the application
Or part steps.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), magnetic or disk etc. are various can store journey
The medium of sequence code.
In addition, any combination can also be carried out between a variety of different embodiments of the embodiment of the present invention, as long as it is not
The thought of the embodiment of the present invention is violated, equally should be considered as disclosure of that of the embodiment of the present invention.