ESPHome power sensor bricking my Sonoff POW R2 devices

I have just ‘bricked’ my second Sonoff POW R2 whilst attempting to add the power/voltage/current sensors.

The ESPHome docs say that the R2 version uses the CSE7766 Power sensor and I set my config accordingly.

After the first one bricked (It would connect to WiFi but not accessible, not recognised by ESPHome or home assistant, no web server access) I started again, incrementally adding to the config as each flashing worked, unit lastly adding the sensor config, after which the device was not accessible.

The UART config did not cause the problem, just the addition of the CSE7766 sensor.

Re-flashing with a minimal config does nothing to fix it and it remains inaccessible.

My yaml is:

esphome:
  name: main_pump_power
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: !secret dryderdale_wifi_SSID
  password: !secret dryderdale_wifi_password

  ap:
    ssid: "Main Pump Power Fallback Hotspot"
    password: !secret OTA_password

web_server:
  port: 80

captive_portal:

logger:
  level: debug

api:

ota:

uart:
  rx_pin: RX
  baud_rate: 4800

switch:

  - platform: restart
    name: "Restart main pump power"

  - platform: gpio
    pin: GPIO12
    name: "Main pump power relay"
    id: main_pump_power_relay
    inverted: true

  - platform: gpio
    pin: GPIO13
    name: "Main pump power blue LED"
    id: main_pump_power_blue_led
    inverted: true

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO0
    name: "Main pump power button" #Button on Sonoff POW
    id: main_pump_power_button

sensor:
  - platform: cse7766
    current:
      name: "Main pump current"
    voltage:
      name: "Main pump voltage"
    power:
      name: "Main pump power"

I can live with the devices being bricked but I really need this to work. I need 6 of these for my project.

I am somewhat concerned by the ESPHome docs saying ‘SHOULD’ work with POW R2!

Any ideas what the problem is?

They’re not “bricked” they can be recovered with a wired serial interface.

I have a working config. Hang on have to go to my other pc.

EDIT:

esphome:
  name: sonoff_dining_heater_north
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: 'WAPDI'
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 10.1.1.188
    gateway: 10.1.1.1
    subnet: 255.255.255.0

api:
  password: !secret api_password

logger:
  baud_rate: 0

uart:
  rx_pin: RX
  baud_rate: 4800

ota:
  password: !secret esp_pwd

interval:
  - interval: 10s
    then:
      if:
        condition:
          wifi.connected:
        then:
          - switch.turn_on: blue_led
        else:
          - switch.turn_off: blue_led

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: true
    name: "Dining Heater North Power Button"
    on_press:
      - switch.toggle: relay

  - platform: status
    name: "Dining Heater North Status"

switch:
  - platform: gpio
    id: blue_led
    pin:
      number: GPIO13
      inverted: true

  - platform: gpio
    name: "Dining Heater North"
    pin: GPIO12
    id: relay
    icon: mdi:radiator
    restore_mode: RESTORE_DEFAULT_OFF

  - platform: restart
    name: "Dining Heater North Restart"

sensor:
  - platform: wifi_signal
    name: "Dining Heater North WiFi Signal"
    update_interval: 15s
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 1
    icon: mdi:wifi

  - platform: cse7766
    update_interval: 15s
    current:
      name: "Dining Heater North Current"
      icon: mdi:current-ac
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    voltage:
      name: "Dining Heater North Voltage"
      icon: mdi:flash
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1
    power:
      name: "Dining Heater North Power"
      icon: mdi:gauge
      id: dining_heater_north_wattage
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10
            send_first_at: 1

  - platform: total_daily_energy
    name: "Dining Heater North Daily Energy"
    power_id: dining_heater_north_wattage
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    icon: mdi:chart-bar

time:
  - platform: homeassistant
    id: homeassistant_time

Pretty sure your problem is the logger. It can’t be used with the cse platform.

4 Likes

Thank you, tom_i.

I managed to ‘unbrick’ by going back to tasmota and then forward again to ESPHome.

I’ll give your config a try shortly.

I removed current and voltage from mine and got it work, I get this error in the logs though. Not sure if that’s related to logger. I’ll remove it and try.

[18:20:47][W][cse7766:058]: Invalid checksum from CSE7766: 0x00 != 0xA6
[18:20:47][W][cse7766:058]: Invalid checksum from CSE7766: 0x02 != 0xA6
[18:20:47][W][cse7766:058]: Invalid checksum from CSE7766: 0x16 != 0x5A
[18:20:54][D][cse7766:147]: Got voltage=245.7V current=0.1A power=0.6W
[18:20:54][D][sensor:092]: 'Main pump power': Sending state 0.60385 W with 1 decimals of accuracy

Thanks again for taking the time.

Thanks for sharing your POW R2 setup. I was a bit lost and your total_daily_energy example was very helpful.

I wonder if they’ll implement the “pulses” reading at some point (see this and page 21). With the current setup we have to ““manually”” integrate the power, when the chip itself is already doing it with better resolution.

I have created an issue for the “pulses” feature: https://github.com/esphome/feature-requests/issues/1122

hi ash,

may i know why you using esphome rather using tasmota for sonoff pow r2?
i have 3 sonoff pow r2 flashed by tasmota, and then i buy a new one, and wanna try using esphome.
but seems it’s much pretty easier using tasmota, isn’t it?
then i would like to know (if you don’t mind) why you choose esphome.
Thanks

Sure.

I find that it’s far easier and more flexible to integrate ESPHome devices into home assistant. Tasmota is great for stand-alone devices and I admit to not having kept up with it, but for me, ESPHome is the way to go.

1 Like

Thanks for your answer, and sorry for late replay :smiley:

I am planning to go from Tasmota to ESPHome, but, in Tasmota, It needs calibration, doesn’t it need to be calibrated in ESPHome?

No idea sorry. That is a two year old post. I no longer use POW R2s. You could check the ESPHome documentation for the cse7766 platform.

I now use devices with the hlw8012 platform (that does have a calibration option).