esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
415 stars 26 forks source link

Shelly dimmer 2 support #949

Closed pixelspark closed 2 years ago

pixelspark commented 3 years ago

Describe the problem you have/What new integration you would like

Add support for the Shelly Dimmer 2. This is an esp8266-based dimmer that is very easy to flash (like the Shelly 1 switches, which work brillantly with ESPHome firmware!).

In the Dimmer 2, the ESP talks to an STM32 microcontroller on the board that performs the actual dimmers. Others have already reverse-engineered the communications protocol; see e.g. here. More discussion (involving the Shelly Dimmer 1) can be found over at the Tasmota project, here.

Please describe your use case for this integration and alternatives you've tried:

I would like to be able to use the Dimmer 2 like I use the Shelly Switches in ESPHome (e.g. have it function as a light in Home-assistant, for instance).

At this point only the Shelly factory firmware is usable (which works fine but does not integrate with ESPHome, which I use for almost all other equipment). Tasmota support appears to be underway.

Additional context

Thank you very much for making ESPHome! Device management is really convenient and an underestimated aspect of home automation.

craggyh commented 3 years ago

I would like to see this support added too. I’m waiting on a couple of Dimmer 2 modules to arrive and don’t want to go the Tasmota route. Has anyone ever managed to control an stm32 chip with esphome on any other device?

pixelspark commented 3 years ago

Has anyone ever managed to control an stm32 chip with esphome on any other device?

The STM32 is 'just' a microcontroller, running a piece of software written by Shelly in this case. The ESP talks to it using a serial protocol. Talking to a peripheral using a serial protocol using the ESP UART functionality has been done before, for instance to read and configure the MH-Z19 CO2 sensor.

craggyh commented 3 years ago

If the STM32 is just controlled by UART from the ESP chip then we may be able to do something like we did here for the Sonoff D1 dimmer - https://github.com/esphome/feature-requests/issues/611

JeffResc cleverly wrote a custom light component that controls the D1 dimming chip over UART and it works very well with esphome. Hopefully with some modifications to the code we could re-purpose for the Dimmer 2 module as the concept is pretty much the same.

pixelspark commented 3 years ago

Looks like Tasmota managed to get it working - should be fairly easy to copy over to ESPHome then? See https://github.com/arendst/Tasmota/issues/6914

kostko commented 3 years ago

I have work in progress support for the Shelly Dimmer in my branch. It uses the open source STM32 firmware developed by @jamesturton (the same firmware is also used by Tasmota) which is automatically flashed during component setup. I have only tested it on a single Shelly Dimmer 2 that I ordered recently and it seems to work, I need to do some more testing and cleanup and then I'll probably open a PR against upstream.

Example relevant part of config:

logger:
  baud_rate: 0

sensor:

light:
  # Dimmer.
  - platform: shelly_dimmer
    name: ${device_name} Light
    power:
      name: ${device_name} Power
    voltage:
      name: ${device_name} Voltage
    current:
      name: ${device_name} Current
pixelspark commented 3 years ago

Awesome! I am waiting for a new dimmer to be delivered, will test it with this firmware soon.

Do you happen to know if this firmware also includes the 'ant-flicker debounce' feature (not the button debounce)? Without it my lights will flicker every now and then due to some kind of signaling over the power line...

Edit: doesn't look like it. Still appears there are some flickering issues for people, could be due to this.

craggyh commented 3 years ago

Nice work. I look forward to trying it out. I have mine running on Tasmota at the minute. Should just be a case of uploading the bin?

kostko commented 3 years ago

Do you happen to know if this firmware also includes the 'ant-flicker debounce' feature (not the button debounce)? Without it my lights will flicker every now and then due to some kind of signaling over the power line...

That's the ripple control signal and yeah you're right, the firmware does not do any filtering at the moment, but the author said he will work on it:

It sounds like I will have to make some changes to how this firmware works to support the dimmer 2 with no neutral so I will add some filtering to cope with the ripple control signals while I'm at it.

curt7000 commented 3 years ago

Looking forward to this! Willing to test if necessary.

jamesturton commented 3 years ago

@kostko I have just added a communication protocol document which might help you when implementing a driver in ESPHome. If you have any questions about it then feel free to ping me and I will see how I can help out.

kostko commented 3 years ago

@jamesturton Thanks, I already figured it out from reading the code and I have everything working. Nice work on the firmware btw! I did notice that some of the commands/fields are ignored. E.g. setting brightness via the settings command doesn't seem to do anything and most settings (except leading/trailing edge config) seem to be ignored. Is the idea that support for those will be added later or are the fields there just because the struct is based on the original firmware?

jamesturton commented 3 years ago

I intend to implement settings as needed, but mainly they are there to maintain compatibility with the original firmware - however I do believe that Shelly have actually changed the protocol that they use now, so I'm not too sure how compatible they still are...

chriscrowe commented 3 years ago

Any updates on this support? My Shelly Dimmer 2's showed up today and I wrongfully assumed ESPHome already supported them :(

poldim commented 3 years ago

@kostko I see the last update was at the end of december. How is your shelly working? Any plans of updating & integrating into core?

@jamesturton Any updates from your end?

kostko commented 3 years ago

The branch I posted has a usable version, although I'm seeing some flickering and haven't had the time yet to debug more. Feel free to test it out.

jamesturton commented 3 years ago

@kostko I see the last update was at the end of december. How is your shelly working? Any plans of updating & integrating into core?

@jamesturton Any updates from your end?

I made a new testing version of the STM32 firmware to try and fix some of the flickering issues which I posted on the thread here: https://github.com/jamesturton/shelly-dimmer-stm32/issues/6. Maybe @kostko could try this out and see if it helps?

rnauber commented 3 years ago

Hi, I tested @kostko 's branch with @jamesturton 's firmware (at https://github.com/jamesturton/shelly-dimmer-stm32/commit/36977bdf4cb569a9acb9f676f467af6b70bef6da ). And it worked flawlessly even without a neutral wire! So I think it is ready for a PR (after updating the firmware).

Thank you for your grandiose work @kostko and @jamesturton ! doc_2021-04-28_19-21-41

curt7000 commented 3 years ago

Hi,

I tested @kostko 's branch with @jamesturton 's firmware (at https://github.com/jamesturton/shelly-dimmer-stm32/commit/36977bdf4cb569a9acb9f676f467af6b70bef6da ). And it worked flawlessly even without a neutral wire! So I think it is ready for a PR (after updating the firmware).

Thank you for your grandiose work @kostko and @jamesturton !

doc_2021-04-28_19-21-41

This is really awesome! Just curious, I see what I believe is a transient voltage spike right at the end, a burst of light, when turning off the bulb and dimming down. Are you seeing that occur with a higher load? Can't remember if the Shelly requires a minimum load with their dimmers. I know this is the case with others.

rnauber commented 3 years ago

This is really awesome! Just curious, I see what I believe is a transient voltage spike right at the end, a burst of light, when turning off the bulb and dimming down. Are you seeing that occur with a higher load?

Well, the load was quite high actually. This is a > 60 W infrared light bulb. But still, the flash is quite noticeable.

craggyh commented 3 years ago

Sorry if this is a stupid question but how do I use this custom branch in esphome? I’d like to test it out on my dimmer2.

rnauber commented 3 years ago

Sorry if this is a stupid question but how do I use this custom branch in esphome? I’d like to test it out on my dimmer2.

That is no stupid question!

You should first checkout the branch to some directory (e.g. esphome) and then install it with:

git clone ...
cd esphome
sudo pip3 install -e .

Then you can call esphome with: python3 -m esphome

craggyh commented 3 years ago

Can this be done on HassOS? I recently moved from Ubuntu with HASS on Docker to HassOS and find it very restricted at the command line.

rnauber commented 3 years ago

I don't know, but I doubt it...

craggyh commented 3 years ago

Any chance you managed to get this submitted to the latest esphome release today May 4th?

Bascht74 commented 3 years ago

I am interested in using ESPHome with Shelly dimmers as well. Looking forward to it.

AHH4485 commented 3 years ago

I am also interested, id would be nice if Shelly Dimmer support is available in the coming version of ESPHome

craggyh commented 3 years ago

Do we have any update on when Dimmer 2 support will be added to ESPhome? I was hoping to see it in the official updates by now but not sure if there is still testing or somethign else holding it up. Anything we can do to help get this pushed through?

craggyh commented 3 years ago

@kostko When I use your branch (https://github.com/kostko/esphome.git) and try to compile I get the following error:

Failed config light.shelly_dimmer: [source shelly_dimmer.yaml:32] Platform not found: 'light.shelly_dimmer'.

Any ideas or am I using the wrong branch?

edit: never mind. I was using the wrong branch. Should have been kostko/feature/shelly-dimmer

jeroenst commented 3 years ago

I have work in progress support for the Shelly Dimmer in my branch. It uses the open source STM32 firmware developed by @jamesturton (the same firmware is also used by Tasmota) which is automatically flashed during component setup. I have only tested it on a single Shelly Dimmer 2 that I ordered recently and it seems to work, I need to do some more testing and cleanup and then I'll probably open a PR against upstream.

Example relevant part of config:

logger:
  baud_rate: 0

sensor:

light:
  # Dimmer.
  - platform: shelly_dimmer
    name: ${device_name} Light
    power:
      name: ${device_name} Power
    voltage:
      name: ${device_name} Voltage
    current:
      name: ${device_name} Current

Is it possible to create a pull request for esphome with this code?

rnauber commented 3 years ago

Is it possible to create a pull request for esphome with this code?

I think the code is ready, what is missing is:

see PULL_REQUEST_TEMPLATE

BTW, if you want to quickly test kostko's branch without manually checking it out, just add this to your yaml:

external_components:
  - source:
      type: git
      url: https://github.com/kostko/esphome.git
      ref: kostko/feature/shelly-dimmer
    components: [ shelly_dimmer ]

So, who wants to go forward with it?

Bascht74 commented 3 years ago

Hi, does somebody have an complete yaml for a shelly dimmer 1 with support of the two buttons?

Here is what I patched together so far...

# Basic config
substitutions:
  devicename: lampe-eg-wohnzimmer-wandlampen
  upper_devicename: Lampe-EG-Wohnzimmer-Wandlampen
  pin_led1: GPIO15
  pin_switch2n: GPIO14
  pin_switch1n: GPIO12
  pin_temp: A0
  pin_button1: NONE # GPIO for reset button not found out so far
  max_temp: "90.0"

external_components:
  - source:
      type: git
      url: https://github.com/jbergler/esphome.src
      ref: shelly-dimmer
    components: [ shelly_dimmer ]

esphome:
  name: $devicename
  platform: ESP8266
  board: modwifi
  arduino_version: 2.7.4

# Enable logging
logger:
  #level: VERBOSE #Change the log level as required; during testing verbose is helpful. 
  # disable serial logging as we ar eusing the pins as button inputs
  baud_rate: 0

# Enable Web server (optional).
web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

# Enable Home Assistant API
api:
  password: !secret api_password

# Enable OTA updates
ota:
  password: !secret ota_password

wifi:
  ssid: !secret ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${upper_devicename}
    password: !secret fb_password

captive_portal:

# Sensors with general information.
sensor:
  # WiFi Signal sensor.
  - platform: wifi_signal
    name: ${upper_devicename} Signal strength
    update_interval: 60s
    # NTC Temperature
  - platform: ntc
    sensor: temp_resistance_reading
    name: ${upper_devicename} Temperature
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    icon: "mdi:thermometer"
    calibration:
      b_constant: 3350
      reference_resistance: 10kOhm
      reference_temperature: 298.15K
    on_value_range:
      - above: ${max_temp}
        then:
          - light.turn_off: shelly_dimmer_1
          - homeassistant.service:
              service: persistent_notification.create
              data:
                title: Message from ${devicename}
              data_template:
                message: Switch turned off because temperature exceeded ${max_temp}°C

  - platform: resistance
    id: temp_resistance_reading
    sensor: temp_analog_reading
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: adc
    id: temp_analog_reading
    pin: ${pin_temp}
  - platform: uptime
    name: Uptime Sensor
    id: uptime_sensor
    update_interval: 60s
    internal: True # don't report to HA
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_HA
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? String(days) + "d " : "") +
                (hours ? String(hours) + "h " : "") +
                (minutes ? String(minutes) + "m " : "") +
                (String(seconds) + "s")
              ).c_str();

binary_sensor:
  - platform: gpio
    pin:
      number: ${pin_switch1n}
      mode: INPUT
      inverted: False
    filters:
      - delayed_on_off: 100ms
    name: ${upper_devicename} Switch1
    internal: True # don't report to HA
    id: switch1
    on_multi_click: 
      - timing: # double click -> Dim to 100%
          - ON for at most 1s
          - OFF for at most 1s
          - ON for at most 1s
          - OFF for at least 0.2s    
        then:
          - logger.log: "Switch1: double pressed"
          - light.turn_on:
              id: shelly_dimmer_1
              brightness: 100%
      - timing: # single click
          - ON for at most 1s
          - OFF for at least 0.5s
        then:
          - logger.log: "Switch1: short pressed"
          - light.toggle:
              id: shelly_dimmer_1
    on_press:
      - delay: 0.75s # we need this delay (and then to look for binary_sensor.is_on) to ensure it's not a multi-click
      - while:
          condition:
            binary_sensor.is_on: switch1
          then:
            - logger.log: "Switch1: pressed"
            - light.dim_relative:
                id: shelly_dimmer_1
                relative_brightness: 5%
                transition_length: 0.1s
            - delay: 0.1s

  - platform: gpio
    pin:
      number: ${pin_switch2n}
      mode: INPUT
      inverted: False
    filters:
      - delayed_on_off: 100ms
    name: ${upper_devicename} Switch2
    internal: True # don't report to HA
    id: switch2
    on_multi_click: 
      - timing: # double click -> Dim to 100%
          - ON for at most 1s
          - OFF for at most 1s
          - ON for at most 1s
          - OFF for at least 0.2s    
        then:
          - logger.log: "Switch2: double pressed"
          - light.turn_on:
              id: shelly_dimmer_1
              brightness: 100%
      - timing: # single click
          - ON for at most 1s
          - OFF for at least 0.5s
        then:
          - logger.log: "Switch2: short pressed"
          - light.toggle:
              id: shelly_dimmer_1
    on_press:
      - delay: 0.75s # we need this delay (and then to look for binary_sensor.is_on) to ensure it's not a multi-click
      - while:
          condition:
            binary_sensor.is_on: switch2
          then:
            - logger.log: "Switch2: pressed"
            - light.dim_relative:
                id: shelly_dimmer_1
                relative_brightness: -5%
                transition_length: 0.1s
            - delay: 0.1s

# Text sensors with general information
text_sensor:
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: ${upper_devicename} IP
    ssid:
      name: ${upper_devicename} SSID
    bssid:
      name: ${upper_devicename} BSSID
  # Expose Uptime
  - platform: template
    name: ${upper_devicename} Uptime
    id: uptime_HA
    icon: mdi:clock-start

light:
# Dimmer
  - platform: shelly_dimmer
    id: shelly_dimmer_1
    name: ${upper_devicename}
    leading_edge: false
#    warmup_brightness: 100
#    warmup_time: 20
    min_brightness: 0
    max_brightness: 1000
    gamma_correct: 1
    default_transition_length: 1s
    restore_mode: RESTORE_DEFAULT_OFF

status_led:
  pin:
    number: ${pin_led1}
    inverted: yes

time:
  - platform: sntp
    id: my_time

switch:
    # this provides fr a possibility to restart from the web console or Home automation should we ever need it
  - platform: restart
    name: "Restart"

But I am not too sure what to put into the yaml leading/trailing edge configuration. I want probably some calibration for the lights (like shelly), but I don't know how to do that...

With my dimmer1 my buttons doesn't work reliably well. I don't know how I can do that. But I got that behavior with Tasmota as well...

Seb

craggyh commented 3 years ago

@ Seb Try increasing your delayed_off: to 100ms. Once I increased mine the buttons work perfectly.

craggyh commented 3 years ago

Has anyone experienced an issue where the lights state is reported incorrectly? With my dimmer sometimes when the lights are turned off they still report as on in HASS but dimmed really low. This is a nuisance because when turning the light back on the switch has to be flicked twice, once to turn off fully then again to turn back on.

Bascht74 commented 3 years ago

@ Seb Try increasing your delayed_off: to 100ms. Once I increased mine the buttons work perfectly.

Thx. I will try...

malfroid commented 3 years ago

Is it possible to create a pull request for esphome with this code?

I think the code is ready, what is missing is:

* [ ]  a proper documentation

* [ ]  a test case

see PULL_REQUEST_TEMPLATE

BTW, if you want to quickly test kostko's branch without manually checking it out, just add this to your yaml:

external_components:
  - source:
      type: git
      url: https://github.com/kostko/esphome.git
      ref: kostko/feature/shelly-dimmer
    components: [ shelly_dimmer ]

So, who wants to go forward with it?

@kostko would you be interested to proceed with a pull request?

craggyh commented 3 years ago

@kostko When I try to compile on the latest version of ESPhome I get the following error:

In file included from src/esphome/components/shelly_dimmer/shelly_dimmer.cpp:1:0: src/esphome/components/shelly_dimmer/shelly_dimmer.h: In member function 'virtual esphome::light::LightTraits esphome::shelly::ShellyDimmer::get_traits()': src/esphome/components/shelly_dimmer/shelly_dimmer.h:20:12: error: 'class esphome::light::LightTraits' has no member named 'set_supports_brightness' traits.set_supports_brightness(true);

Is this something you can fix?

Bascht74 commented 3 years ago

Is this something you can fix?

I found another solution and used the code of another pull request. I updated the code above to use that code: https://github.com/esphome/feature-requests/issues/949#issuecomment-877807666

I changed to:

external_components:
  - source:
      type: git
      url: https://github.com/jbergler/esphome.src
      ref: shelly-dimmer
    components: [ shelly_dimmer ]
truglodite commented 2 years ago

I still have a few Shelly dimmers that I am looking forward to adding to esphome at some point… besides using mqtt. Any idea how close this is to becoming a pr/merged?

SweAdelpha commented 2 years ago

Is this something you can fix?

I found another solution and used the code of another pull request. I updated the code above to use that code: #949 (comment)

I changed to:

external_components:
  - source:
      type: git
      url: https://github.com/jbergler/esphome.src
      ref: shelly-dimmer
    components: [ shelly_dimmer ]

This one doesn't seem to work either anymore. Worked great a couple of weeks ago when I flashed another one of my Shelly dimmers. Is anyone aware of another fork that might work with the Shelly dimmer? I really don't want to use tasmota :)

rnauber commented 2 years ago

Hi everyone, As I recently acquired some more shelly dimmers for some more home automation. Therefore, I brushed up the code of @kostko and @jamesturton to compile with the current version of esphome. Furthermore, I added the ability to select the firmware of the stm32. You can test that with the snippet below. If I find the time, I intend to add a testcase and the documentation to create a proper pull request for shelly dimmer 2 support...

Best, Richard

external_components:
  - source:
      type: git
      url: https://github.com/rnauber/esphome.git
      ref: feature/shelly-dimmer
    refresh: 1min
    components: [ shelly_dimmer ]

light:
  - platform: shelly_dimmer
    name: ${devicename} Light
    id: thislight
    power:
      name: ${devicename} Power
    voltage:
      name: ${devicename} Voltage
    current:
      name: ${devicename} Current
    max_brightness: 500
    firmware: "51.6"
ActiveByte commented 2 years ago

Thanks for your work @rnauber !

DomiStyle commented 2 years ago

@rnauber Looks good, do you have a complete config for the Shelly Dimmer 2?

My Shelly Dimmer 2 just arrived and I would like to give it a go.

rnauber commented 2 years ago

@rnauber Looks good, do you have a complete config for the Shelly Dimmer 2?

My Shelly Dimmer 2 just arrived and I would like to give it a go.

No, I do not have a full working config yet, especially the temperature measurement is miscalibrated... However, my current config is the following:

substitutions:
  devicename: shellydimmer2
  max_temp: "90.0"

esphome:
  name: $devicename
  platform: ESP8266
  board: esp8285

external_components:
  - source:
      type: git
      url: https://github.com/rnauber/esphome.git
      ref: feature/shelly-dimmer
    refresh: 1min
    components: [ shelly_dimmer ]

#<<: !include wifi.yaml
ADD YOUR WIFI HERE

ota:
web_server:
api:

logger:
  baud_rate: 0

uart:
 tx_pin: 1
 rx_pin: 3
 baud_rate: 115200

light:
  # Dimmer.
  - platform: shelly_dimmer
    name: ${devicename} Light
    id: thislight
    power:
      name: ${devicename} Power
    voltage:
      name: ${devicename} Voltage
    current:
      name: ${devicename} Current
    max_brightness: 500
    firmware: "51.5"

  - platform: monochromatic
    name: "${devicename} Status LED"
    output: led
    id: led_light
    #internal: True

  - platform: binary
    name: "${devicename} RESET SHD"
    output: SHDReset

switch:
  - platform: restart
    name: "$devicename Restart"

sensor:
  - platform: wifi_signal
    name: "$devicename WiFi Signal"
    update_interval: 60s
#    expire_after: 0

  - platform: ntc
    sensor: temp_resistance_reading
    name: ${devicename} Temperature
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    icon: "mdi:thermometer"
    calibration:
      b_constant: 3350
      reference_resistance: 10kOhm
      reference_temperature: 25°C

  - platform: resistance
    id: temp_resistance_reading
    sensor: temp_analog_reading
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: adc
    id: temp_analog_reading
    pin: A0

  - platform: adc
    pin: VCC
    name: "$devicename VCC"

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO12
    name: "$devicename Switch 2"
    filters:
      - delayed_on_off: 100ms

  - platform: gpio
    pin:
      number: GPIO14
    name: "$devicename Switch 1"
    filters:
      - delayed_on_off: 100ms     

output:
  # Register the red LED as a dimmable output ....
  - platform: esp8266_pwm
    id: led
    pin:
      number: GPIO15
      inverted: True

  - platform: gpio
    pin: GPIO05
    id: SHDReset
DomiStyle commented 2 years ago

@rnauber Thanks, that should work for now.

DomiStyle commented 2 years ago

So I got around to installing my dimmer with the @rnauber branch now.

I connected 4 dimmable LED bulbs with a Fibaro Bypass 2 in parallel to the bulbs since they draw almost no power.

Power usage seems to be all over the place, fluctuating between 5 - 60W. Real power draw at max brightness should be at about 16W.

I wasn't quite able to get full brightness out of my bulbs, but that could also be a fault with the bulbs and not with the dimmer. The range I was able to get is 160 - 400. Anything above starts flickering, anything below doesn't light the bulb at all.

rnauber commented 2 years ago

Dear @DomiStyle , my snippet includes:

max_brightness: 500

which limits the output to 50%. Maybe try removing that line...

Best, Richard

DomiStyle commented 2 years ago

I started with min_brightness: 0 and max_brightness: 1000 to test the range and 160-400 is what I ended up with. Could be the bulbs though, they are pretty cheap.

Interestingly the bulbs also flicker at 400 brightness when there are 230V on the S1 terminal so I might have to lower it even more.

rnauber commented 2 years ago

I started with min_brightness: 0 and max_brightness: 1000 to test the range and 160-400 is what I ended up with. Could be the bulbs though, they are pretty cheap.

Interestingly the bulbs also flicker at 400 brightness when there are 230V on the S1 terminal so I might have to lower it even more.

Hm, I guess the interaction of dimmers and LEDs is hard to get right... As all the interfacing with mains is handled by the STM co-processor, have a look at the firmware and its issues there: https://github.com/jamesturton/shelly-dimmer-stm32/issues/6 There are some settings you can play with...

BTW, I am planning to make "warmup_brightness / low_brightness_threshold" parameter accessible via esphome too, but it seems to have diverged from the original meaning of that parameter. So a am not sure how to name it...

fyksen commented 2 years ago

Thanks for all the work. I have connected shelly 2 dimmer to one bulb, and I have trouble getting it to turn completely off. Using the config @rnauber posted earlier.

When I turn off the light entity in home assistant, it still glows. I have tried the 'RESET SHD' mode. I haven not done a lot with esphome yet, so please excuse my ignorance.

Edit: This is with a neutral wire. Shelly dimmer reports this: Current: 0.0 A power: 0.7 W VCC: 2.29V Voltage: 196,5.

grahampowell commented 2 years ago

for me i had to change the LED pin for it to work on my shelly dimmer 2 (16 worked for mine)

I used this page as reference https://templates.blakadder.com/shelly_Dimmer_2.html

output:

Register the red LED as a dimmable output ....