rstrouse / ESPSomfy-RTS

A controller for Somfy RTS shades and blinds
The Unlicense
428 stars 32 forks source link

Question or Feature request : detect close and open #391

Open JohnLandien opened 4 weeks ago

JohnLandien commented 4 weeks ago

Describe you new feature you'd like

Sometimes shades will not work because there is an internal error, like a wire is gone loose or a motor has a defect, I would like to add a contact to a GPIO pin for up-detected and a pin for down-detected. When the shade is up, the pin for up-detected is low and when the shade moves down the pin up-detected would go high when all is working but it stays low when there is an error. Also so when the shade is (fully) down the down-detected pin is low and when you give a command to go up, the down-detected pin should go to high and when not there is an error. So this feature should have something like an a check after .. mSec if the pin is changed ans also an error feedback on the UI and MQTT and HASS integration. I would like to participate in the solution but looking at the code there I am missing some comment to find out where I should change the code.
screen Somfy - tab Shade screen Home with error

rstrouse commented 4 weeks ago

In the firmware there is a single method where the processing for something like this would reside. That is SomfyShade::setGPIOs. This is appropriately called whenever the transitions need to be evaluated for the GPIO. However, the storage of such values will also need to be taken care of and you will find all loading and saving of the data in ConfigFile.cpp under SomfyShade::writeShadeRecord and SomfyShade::readShadeRecord. This data is versioned to validate and maintain backup and restore files appropriately.

For the UI all of this is in the index.js located in the data directory. All of the UI rendering has to be performed on the browser since the MCU does not do server side processing for web pages. They start out static then use Ajax to get the interface up. So all javascript and DOM.