Control Shelly Dimmer with buttons via Arduino

  • Since the I3 does not provide the required actions to seamlessly use remote momentary buttons as though they are directly wired to the dimmer (specifically, the way long presses work)I decided to implement this myself using an Arduino ESP8266 Wemos Mini (necessity being the mother of invention)

    It works like a charm! I can make the code available if anyone else is interested.

    Here's the core code required to make it work (plus the usual wifi setup code) - its pretty simple to use and extend as I have made everything use classes - just connect your buttons to negative and the digital inputs you specify (D3 and 4 in the example below). Up to 6 buttons can be accommodated by 1 board. They operate as though directly wired to the dimmer.

    I have also written another class that controls any number of dimmers as a bank via MQTT

    #include <ShellyDimmer.h>

    #include <Pushbutton.h>

    longPressDelay = 800;

    debounce = 60;

    IPAddress hallway_ip(xxx,xxx,xxx, xxx);

    ShellyDimmer hallwayDimmer = ShellyDimmer("Hallway", hallway_ip, longPressDelay, debounce);

    ShellyDimmerUp pb1 = ShellyDimmerUp(&hallwayDimmer, "Hallway-Up", D3);

    ShellyDimmerDown pb2 = ShellyDimmerDown(&hallwayDimmer, "Hallway-Down", D4);

    void loop()

    {

    pb1.loop();

    pb2.loop();

    }