xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.99k stars 637 forks source link

Electrodragon IO4, IO5 & IO15 support request #760

Closed xavier0smith closed 6 years ago

xavier0smith commented 6 years ago

Hello

I'm using the Electrodragon IoT Relay to control all the shutters of my house (with FHEM and Tablet UI interface).

esp-relay-board-il-01

It works wonderfully, but now my family also wants physical push-button near each window.

Would it be possible to expand the firmware in order to use the IO4, IO5 and IO15 inputs on the board?

Please, tell me yes or I will have to disassemble everything...

xoseperez commented 6 years ago

You can configure the 3 GPIOs in the header to be buttons if you want. Just add this code to the device definition in the hardware.h file (take some time to understand the settings below so you can tune them to your needs, there is a wiki page about button configuration settings).

#elif defined(ELECTRODRAGON_WIFI_IOT)

    // Info
    #define MANUFACTURER        "ELECTRODRAGON"
    #define DEVICE              "WIFI_IOT"

    // Buttons
    #define BUTTON1_PIN         4
    #define BUTTON2_PIN         5

    #define BUTTON1_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
    #define BUTTON2_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP

    #define BUTTON1_RELAY       1
    #define BUTTON2_RELAY       2

    // Relays
    #define RELAY1_PIN          12
    #define RELAY2_PIN          13

    #define RELAY1_TYPE         RELAY_TYPE_NORMAL
    #define RELAY2_TYPE         RELAY_TYPE_NORMAL

    // LEDs
    #define LED1_PIN            16
    #define LED1_PIN_INVERSE    0

I have noticed the version you have is not the same as in the definition but if the relays are working then GPIOs must be the same. In the configuration I'm assuming you connect two push buttons between IO4 and IO5 and ground, with software pull-ups. Clicking them would be the same as turning the switches on/off in the web ui. You might want to be there BUTTON_SWITCHES instead.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.