Do we have a New SONOFF (Dimmer)

Mine flashed fine, problem is that Tasmota firmware has a ghost switching issue that makes the unit too unreliable for most of us. Maybe hang off if you can?

I concluded it wasn’t the RF circuitry after all, although the undersized antenna probably doesn’t help reliability. The most reliable solution to ghost switching is to pair an RF remote, then de-pair it and then re-pair it again. Sounds nuts, I know, but it sorta works. Mostly it works on the second re-pair, but a few folks have taken another attempt, and I seem to have the record with one taking 17 attempts IIRC. One guy didn’t have an RF remote as he wasn’t planning to use one, but borrowed one and successfully eliminated ghost switching. The only conclusion I’ve reached is that there is some poor initialisation in the next micro-controller in the chain - which I assume must be decoding the signals from the remote, interpreting the message, and holding the RF remote ID in flash. Unfortunately I don’t have the tools to debug whats going on or reverse engineer whats coded into that one - it has the capability to operate in so many different modes, it defeated me! I guess Tasmota only loads onto the ESP8285 (U5), and no-one has got inside either U1 or U3(?)

The only final piece of advice I can offer, is that powering down the device can, sometimes but not always, lead to the RF pairing being lost, so you have to go through the pair, de-pair, repair fiasco again. Once its working, it seems pretty reliable. Fresh out of the box, its a PITA

1 Like

ola ressussitando o grupo
estou tentando flasche aqui com o D1 dimmer com tasmosta nao estou conseguindo, alguem tem algum tutorial de como faz, tentei de tudo com o usb conversor e nao vai…

1 Like

Just for the record, if you have one of these units and are suffering the ghost switching issue, and you also have no plans to buy or use the RF remote, you can do what I did, and carefully cut (or desolder) the chip that does the RF/serial translation from the board. Mines been working flawlessly for 5 weeks now. :smiley:

2 Likes

Consegui fazer o D1 sonoff Dimmer com Tasmota na fw 3.5 com a fw do tasmota 8.40…
obrigado a todos

e onde fica voce consegue mostrar pra gente onde fica, em foto por favor?

I also experienced the ghost switching of SONOFF D1 dimmers. Pairing-unpairing of the SONOFF RM433 did not work for one of the dimmers that was located in a not so convenient place to open-up again. Therefore, I implemented a software workaround in HA to set the dimmer to the latest correct dimmer level in case of ghost switching that seems to work pretty well:

Config.yaml:
In the config.yaml file I defined a dimmer that does not listen to the mqtt state topics of the D1; but the dimmer can be used to switch the dimmer on/off and set the dimlevel

light:

  • platform: mqtt
    name: “Dimmer keukentafel - alleen cmnd”
    # state_topic: ‘tele/tasmota_CF20A5/STATE’
    command_topic: ‘cmnd/tasmota_CF20A5/POWER’
    value_template: ‘{{value_json.POWER}}’
    brightness_command_topic: ‘cmnd/tasmota_CF20A5/Dimmer’
    # brightness_state_topic: ‘tele/tasmota_CF20A5/STATE’
    brightness_scale: 100
    on_command_type: ‘brightness’
    brightness_value_template: ‘{{value_json.Dimmer}}’
    payload_on: ‘ON’
    payload_off: ‘OFF’
    qos: 0

I added two sensors: one that tracks the dimmer level according to the Home Assistant dimmer we just defined; and one that listens to the state topic of the D1 device:

sensor:
#sensor to listen to D1 dimmer and track dimmer level (according to D1 dimmer itself)

  • platform: mqtt
    name: ‘Dimwaarde volgens D1 dimmer’
    state_topic: ‘tele/tasmota_CF20A5/STATE’
    value_template: ‘{{value_json.Dimmer}}’
    unit_of_measurement: ‘%’
    qos: 0

#sensor to listen to HA dim level

  • platform: template
    sensors:
    ha_dimlevel:
    friendly_name: ‘Dimwaarde volgens HA’
    value_template: “{{(state_attr(‘light.dimmer_keukentafel_alleen_cmnd’,‘brightness’)/2.55)|round(0)}}”
    unit_of_measurement: ‘%’

I also defined a binary sensor that compares both sensor values

binary_sensor:

  • platform: template
    sensors:
    d1_diff:
    friendly_name: ‘D1 difference’
    value_template: “{{states(‘sensor.dimwaarde_volgens_d1_dimmer’)| float == states(‘sensor.ha_dimlevel’)| float}}”

Automations.yaml

I defined an automation that is triggered if the D1 dimlevel changes outside of HA. For example, by changing the dimlevel in the Tasmota user interface (console); or due to a ghost switching event.

  • id: ‘1607420694074’
    alias: Bijstellen D1 dimstatus na ghost switching
    description: ‘’
    trigger:
    • platform: state
      entity_id: binary_sensor.d1_diff
      to: ‘off’
      condition: []
      action:
    • service: mqtt.publish
      data:
      topic: cmnd/tasmota_CF20A5/Dimmer
      payload_template: ‘{{(state_attr(“light.dimmer_keukentafel_alleen_cmnd”,“brightness”)/2.55)|round(0)}}’
      mode: single

If I simulate a ghost switching event (by changing the dimlevel in the Tasmota UI to 11, while in HA it’s still 10), HA set’s the desired dimlevel (10) instantly:

16:39:04 CMD: dimmer 11
16:39:04 MQT: tele/tasmota_CF20A5/STATE = {“Time”:“2020-12-08T16:39:04”,“Uptime”:“3T01:37:25”,“UptimeSec”:265045,“Heap”:26,“SleepMode”:“Dynamic”,“Sleep”:10,“LoadAvg”:99,“MqttCount”:1,“POWER”:“ON”,“Dimmer”:11,“Fade”:“OFF”,“Speed”:1,“LedTable”:“ON”,“Wifi”:{“AP”:1,“SSId”:“Ziggo8005069”,“BSSId”:“48:D3:43:FC:0E:09”,“Channel”:11,“RSSI”:78,“Signal”:-61,“LinkCount”:1,“Downtime”:“0T00:00:05”}}
16:39:04 MQT: stat/tasmota_CF20A5/RESULT = {“POWER”:“ON”,“Dimmer”:11}
16:39:04 MQT: tele/tasmota_CF20A5/STATE = {“Time”:“2020-12-08T16:39:04”,“Uptime”:“3T01:37:25”,“UptimeSec”:265045,“Heap”:26,“SleepMode”:“Dynamic”,“Sleep”:10,“LoadAvg”:99,“MqttCount”:1,“POWER”:“ON”,“Dimmer”:10,“Fade”:“OFF”,“Speed”:1,“LedTable”:“ON”,“Wifi”:{“AP”:1,“SSId”:“Ziggo8005069”,“BSSId”:“48:D3:43:FC:0E:09”,“Channel”:11,“RSSI”:78,“Signal”:-61,“LinkCount”:1,“Downtime”:“0T00:00:05”}}
16:39:04 MQT: stat/tasmota_CF20A5/RESULT = {“POWER”:“ON”,“Dimmer”:10}

I just realized this helps to correct ghost switch events that change the dimlevel; but does not correct for undesired on/off events.

update: for those interested, I made some modifications such that also unwanted on/off ghost switching events are corrected by HA:

configuration.yaml
#sensor to listen to D1 dimmer and track dimmer level (according to D1 dimmer itself)

  • platform: mqtt
    name: ‘Dimwaarde volgens D1 dimmer’
    state_topic: ‘tele/tasmota_CF20A5/STATE’
    value_template: ‘{{value_json.Dimmer}}’
    unit_of_measurement: ‘%’
    qos: 0

  • platform: mqtt
    name: ‘AanUit volgens D1 dimmer’
    state_topic: ‘tele/tasmota_CF20A5/STATE’
    value_template: ‘{{value_json.POWER}}’
    qos: 0

#sensor to listen to HA dim level

  • platform: template
    sensors:
    ha_dimlevel:
    friendly_name: ‘Dimwaarde volgens HA’
    value_template: “{{(state_attr(‘light.dimmer_keukentafel_alleen_cmnd’,‘brightness’)/2.55)|round(0)}}”
    unit_of_measurement: ‘%’
    ha_aanuit:
    friendly_name: ‘AanUit volgens HA’
    value_template: “{{states(‘light.dimmer_keukentafel_alleen_cmnd’)}}”

binary_sensor:

  • platform: template
    sensors:
    d1_diff:
    friendly_name: ‘D1 difference’
    value_template: “{{states(‘sensor.dimwaarde_volgens_d1_dimmer’)| float == states(‘sensor.ha_dimlevel’)| float}}”
    d1_power_ha:
    friendly_name: ‘D1 power state - volgens ha’
    value_template: “{{is_state(‘sensor.ha_aanuit’,‘on’)}}”
    d1_power_d1:
    friendly_name: ‘D1 power state - volgens D1’
    value_template: “{{states(‘sensor.aanuit_volgens_d1_dimmer’) == ‘ON’}}”

automations.yaml

  • id: ‘1607504275725’
    alias: Bijstellen D1 powerstatus na ghost switching
    description: ‘’
    trigger:

    • platform: state
      entity_id: binary_sensor.d1_power_d1
      condition: []
      action:
    • choose:
      • conditions:
        • condition: state
          entity_id: binary_sensor.d1_power_d1
          state: ‘on’
        • condition: state
          entity_id: binary_sensor.d1_power_ha
          state: ‘off’
          sequence:
        • service: light.turn_off
          data: {}
          entity_id: light.dimmer_keukentafel_alleen_cmnd
      • conditions:
        • condition: state
          entity_id: binary_sensor.d1_power_d1
          state: ‘off’
        • condition: state
          entity_id: binary_sensor.d1_power_ha
          state: ‘on’
          sequence:
        • service: light.turn_on
          data: {}
          entity_id: light.dimmer_keukentafel_alleen_cmnd
          default: []
          mode: single
  • id: ‘1607420694074’
    alias: Bijstellen D1 dimstatus na ghost switching
    description: ‘’
    trigger:

    • platform: state
      entity_id: binary_sensor.d1_diff
      to: ‘off’
      condition: []
      action:
    • service: mqtt.publish
      data:
      topic: cmnd/tasmota_CF20A5/Dimmer
      payload_template: ‘{{(state_attr(“light.dimmer_keukentafel_alleen_cmnd”,“brightness”)/2.55)|round(0)}}’
      mode: single

I’m pretty new to HA, so I know that this implementation might not be the most efficient/elegant one

Hi all,
I went trough this topic and cannot find straight answer.
Does Tasmota and D1 dimmer support HW button on GPIO00? I’m wondering if it is possible to control D1 with MQTT/RF/Whatever + HW button.
BR

The GPIO 0 is also connected to the left S1 pin. The other side of the S1 pad is connected to GND.
So, if we add a pushbutton to S1, I expect to have the same behavior as the other Sonoff devices.

The pushbutton is connected. With original FW, short presses switch On/Off, a long press dims up and down continuously. The button can be used to flash the device. In Tasmota, there is no function.