Open aguirrea0960 opened 3 months ago
Thanks for the suggestion. You can setup a custom device type for this I believe.
https://help.sinric.pro/pages/custom-templates
you can setup a range control with value 0 (closed) 100 fullly open or mode controller with different values for open, closed, opening, closing ext
The solution to this is simple:
The doorState
parameter is a reference.
You can return the current state here.
bool onDoorState(const String& deviceId, bool& doorState) {
if (doorState) {
// code to move the door
doorState = false; // return that the door is still open
} else {
// code to move the door
doorState = true; // return that the door is still closed
}
return true; // callback handled successfully
}
Later in your code, when the limit switches are triggered, send the apropiate event sendDoorStateEvent()
with the value true
or false
.
Hi @sivar2311 thanks for your reply, but I think that maybe I didn't explain well. It hapens that the Web App or the MobileApp always respond inmediatly when you push the open or close buttons. And the slide door is still moving towards the end of career position, and is not complete. Meanwhile the app should indicate that the door is still Closing... or Opening... and have a timer to supervise the EOC (EndOfCareer) process by means of the two physical switches installed for that purpose. That's the only way to detect a failure on the equipment. ( Mechanical failure, blocked or stucked rail, etc.).
In conclusion: there are no intermediate states contemplated in the actual app , because you have only a boolean variable to indicate open or close state. On a slide door controller you may have another states that can give you feedback information of the SlideDoor ether when execute a close or open command.
Best regards.
Hi @aguirrea0960
Yes, I understood your explanation. The value that is returned via the DoorState parameter is displayed in the app / dashboard.
The parameter works in both directions. Initially, it is delivered to the callback with the desired state (open or close). However, the value can be changed within the callback (from open to close or vice versa). The value that is stored in the parameter after leaving the callback is sent back to the Sinric server and is displayed in the app / dashboard.
If the value is not changed within the callback, the initially desired state is returned to the server.
A "third state" can be determined over time, for example. In short: Start a timer in the callback that is stopped by the contacts. If the contacts are not closed within a certain amount of time, a jam has taken place.
Hi Guys, I Have estudied the behavour of the actual GarageDoor controller and it has the posibility to handle a boolean type for command, and it's ok. But what if:
1) Once you, for example do an "OPEN" command and after that, the system checks the limitswitches status (real door movement state), and reports "Opening....." while the door in in transition to open ( my example is for an SlideDoor with a motorized operator ). Once the door is finally closed, then the app indicates the "CLOSED" state. ( Actually it gives you a Closed state even is not true). 2) Once you, for example do a "CLOSE" command and after that, the system checks the limitswitches status (real door movement state), and reports "Closing....." while the door in in transition to close ( my example is for an SlideDoor with a motorized operator ). Once the door is finally opened, then the app indicates the "OPEN" state. ( Actually it gives you an Open state even is not true).
Normally, a SlideDoor like mine has two discrete limitswitches that indicate the "end of career" state, so in the case we have several RF remote controls ( as usually), Addicionally I want to know if there's a "command in progress" from one of these remote controls also.
Because of that condition I have modified the two header files named "DoorController.h" and "SinricProGarageDoor.h" to make some tests on my own. and the state variable is an uint8_t type and the responses are: 0: for Open; 1: for Close ( to be compatible with actual boolean type), 2: for transition to close or simply "Closing..." and finally 3: for transition to open or simply "Opening...".
This kind of approach may serve also to indicate a Door Mecanism Failure, etc.
Best Regards,