xoseperez / espurna

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

Wich is the correct FW for the Shelly Plug S #2570

Open tschuchort opened 1 year ago

tschuchort commented 1 year ago

Device

Shelly Plug S (EU)

Version

No response

Question

Hi, can anyone please point me to the correct firmware for the Allterco Shelly Plug S or isn't this device supported? Thanks in advance.

mcspr commented 1 year ago

Not as-is, but based on the https://templates.blakadder.com/shelly_plug_S.html we should be able to use ALLTERCO_SHELLY1PM with some adjustments (obviously, calibration might be off)

// ...

#elif defined(ALLTERCO_SHELLY1PM)
    // Info
    #define MANUFACTURER        "ALLTERCO"
    #define DEVICE              "SHELLY_PLUG_S"

    // Status LEDs
    #define LED1_PIN            0
    #define LED1_PIN_INVERSE    1

    #define LED2_PIN            2
    #define LED2_PIN_INVERSE    1

    // Buttons
    #define BUTTON1_PIN         4
    #define BUTTON1_CONFIG      BUTTON_SWITCH | BUTTON_DEFAULT_BOOT
    #define BUTTON1_RELAY       1
    #define BUTTON1_PRESS       BUTTON_ACTION_TOGGLE
    #define BUTTON1_RELEASE     BUTTON_ACTION_TOGGLE

    #define BUTTON2_PIN         2
    #define BUTTON2_CONFIG      BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
    #define BUTTON2_LNGCLICK    BUTTON_ACTION_RESET
    #define BUTTON2_LNGLNGCLICK BUTTON_ACTION_FACTORY

    // Relays
    #define RELAY1_PIN          15
    #define RELAY1_TYPE         RELAY_TYPE_NORMAL

    // HJL01 / BL0937
    #define HLW8012_SUPPORT             1
    #define HLW8012_SEL_PIN             12
    #define HLW8012_CF1_PIN             14
    #define HLW8012_CF_PIN              5

    #define HLW8012_SEL_CURRENT         LOW
    #define HLW8012_CURRENT_RATIO       25740
    #define HLW8012_VOLTAGE_RATIO       313400
    #define HLW8012_POWER_RATIO         3414290
    #define HLW8012_INTERRUPT_ON        FALLING

    //Temperature
    #define NTC_SUPPORT        1
    #define SENSOR_SUPPORT     1
    #define NTC_BETA           3350
    #define NTC_R_UP           32000
    #define NTC_R_DOWN         0
    #define NTC_R0             10000

// ...

Runtime config is (partially) described in the wiki; we need to adjust ledGpio..., relayGpio0 and hlw8012CF1 pins in settings storage if you mean to run PM .bin first https://github.com/xoseperez/espurna/wiki/Buttons-and-switches