Integration of new power sensor ADE7953 with shelly 2.5

Not sure, where to post this:

The new shelly 2.5 is available
https://github.com/arendst/Sonoff-Tasmota/wiki/Shelly-2.5

It can be used as a roller shutter.
It has the integrated power sensor (ADE7953) to determine whether the motor reached the end-position and stopped.

I’m already running ESPhome firmware on it, but I am missing the power sensor.
Any idea if/when this will be integrated in ESPhome?

Until someone comes fwd and integrate it. I think the main dev won’t add them. Not even shelly 2 had the power measure sensor.
For the moment try this

Oh I see. To bad :frowning:

But thank you for the pointer. I will give this a try.

I see this has a branch to test, I’m trying to configure one now using this do you have a config you can share for the 2.5?

Hi,
I’m currently testing that branch, here’s a config for the shelly 2.5. Be aware that the webserver is enabled and I haven’t yet set the proper reporting intervals and I have to filter out readings lower than 1 W because they look like noise even if there’s nothing connected.

Have fun!

esphome:
  name: shellylaundry
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "SSID"
  password: "password"

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
api:

ota:

i2c:
  sda: GPIO12
  scl: GPIO14

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
    name: "Washing Machine Switch"
    on_press:
      then:
        - switch.toggle: washing_machine_relay
  - platform: gpio
    pin:
      number: GPIO5
    name: "Dryer Switch"
    on_press:
      then:
        - switch.toggle: dryer_relay

sensor:
  - platform: ntc
    sensor: laundry_resistance_sensor
    id: laundry_temperature
    name: "Laundry Temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    icon: mdi:thermometer
    calibration:
      b_constant: 3350
      reference_temperature: 25°C
      reference_resistance: 10kOhm
  - platform: adc
    id: laundry_source_sensor
    pin: A0
    update_interval: 10s
  - platform: resistance
    id: laundry_resistance_sensor
    sensor: laundry_source_sensor
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: ade7953
    voltage:
      name: "Laundry Voltage"
    current_a: 
      name: "ADE7953 Current 1"
    current_b:
      name: "ADE7953 Current 2"
    active_power_a:
      name: "ADE7953 Power 1"
    active_power_b:
      name: "ADE7953 Power 2"
      filters:
      - multiply: -1.0


status_led:
  pin:
    number: GPIO0
    inverted: yes

switch:
  - platform: gpio
    id: washing_machine_relay
    name: "Washing Machine Relay"
    pin: GPIO15
    restore_mode: ALWAYS_ON
  - platform: gpio
    id: dryer_relay
    name: "Dryer Relay"
    pin: GPIO4
    restore_mode: ALWAYS_ON 

web_server:
  port: 80

This is a little off topic, but are you sure about your settings for the temperature-sensor? I get crazy high temperatures with this adc-resistance and b-constant.

Hi,

I think this is the correct configuration:

Could someone please try it?

Now I don’t have any shelly to try it…

substitutions:
  devicename: shelly1

esphome:
  name: ${devicename}
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "xx"
  password: "xxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Shelly Hotspot (xxxx)"
    password: "xxxx"

web_server:
  port: 80

captive_portal:

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
api:
  password: "xxxxxx"

ota:
  password: "xxxxxx"


i2c:
  sda: GPIO12
  scl: GPIO14

sensor:
  - platform: ade7953
    voltage:
      name: ${devicename} Voltage
    current_a:
      name: ${devicename} Current B
    current_b:
      name: ${devicename} Current A
    active_power_a:
      name: ${devicename} Active Power B
      filters:
        - multiply: -1
    active_power_b:
      name: ${devicename} Active Power A
      filters:
        - multiply: -1
    update_interval: 60s

  # NTC Temperature
  - 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: 25C
  - platform: resistance
    id: temp_resistance_reading
    sensor: temp_analog_reading
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: adc
    id: temp_analog_reading
    pin: A0
    update_interval: 10s
    
status_led:
  pin:
    number: GPIO0
    inverted: yes

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
    name: ${devicename} Switch1
    on_press:
      then:
        - switch.toggle: shelly_relay_1
  - platform: gpio
    pin:
      number: GPIO5
    name: ${devicename} Switch2
    on_press:
      then:
        - switch.toggle: shelly_relay_2

switch:
  - platform: gpio
    id: shelly_relay_1
    name: ${devicename} Relay1
    pin: GPIO15
    icon: "mdi:electric-switch"
    restore_mode: RESTORE_DEFAULT_OFF
  - platform: gpio
    id: shelly_relay_2
    name: ${devicename} Relay2
    pin: GPIO4
    icon: "mdi:electric-switch"
    restore_mode: RESTORE_DEFAULT_OFF

Thank you

@anarro Just started working with my Shelly 2.5 and found this thead. Saved me a lot of work figuring things out. I loaded your code and it seems to be working. Here is a sample of the log output…

[12:20:44][D][adc:056]: ‘temp_analog_reading’: Got voltage=0.43V
[12:20:44][D][sensor:092]: ‘temp_analog_reading’: Sending state 0.43457 V with 2 decimals of accuracy
[12:20:44][D][resistance:037]: ‘temp_resistance_reading’ - Resistance 4853.1Ω
[12:20:44][D][sensor:092]: ‘temp_resistance_reading’: Sending state 4853.11182 Ω with 1 decimals of accuracy
[12:20:44][D][ntc:026]: ‘Smart Plug Temperature’ - Temperature: 45.5°C
[12:20:44][D][sensor:092]: ‘Smart Plug Temperature’: Sending state 45.50340 °C with 1 decimals of accuracy
[12:20:49][D][api.connection:583]: Client ‘Home Assistant 0.102.3 (192.168.1.200)’ connected successfully!
[12:20:54][D][adc:056]: ‘temp_analog_reading’: Got voltage=0.44V
[12:20:54][D][sensor:092]: ‘temp_analog_reading’: Sending state 0.43555 V with 2 decimals of accuracy
[12:20:54][D][resistance:037]: ‘temp_resistance_reading’ - Resistance 4865.7Ω
[12:20:54][D][sensor:092]: ‘temp_resistance_reading’: Sending state 4865.67578 Ω with 1 decimals of accuracy
[12:20:54][D][ntc:026]: ‘Smart Plug Temperature’ - Temperature: 45.4°C
[12:20:54][D][sensor:092]: ‘Smart Plug Temperature’: Sending state 45.42505 °C with 1 decimals of accuracy
[12:21:00][D][sensor:092]: ‘Smart Plug Active Power B’: Sending state -0.01299 W with 1 decimals of accuracy
[12:21:00][D][sensor:092]: ‘Smart Plug Active Power A’: Sending state 0.07792 W with 1 decimals of accuracy
[12:21:00][D][sensor:092]: ‘Smart Plug Current B’: Sending state 0.01773 A with 2 decimals of accuracy
[12:21:00][D][sensor:092]: ‘Smart Plug Current A’: Sending state 0.01773 A with 2 decimals of accuracy
[12:21:00][D][sensor:092]: ‘Smart Plug Voltage’: Sending state 123.33615 V with 1 decimals of accuracy
[12:21:04][D][adc:056]: ‘temp_analog_reading’: Got voltage=0.44V
[12:21:04][D][sensor:092]: ‘temp_analog_reading’: Sending state 0.43652 V with 2 decimals of accuracy
[12:21:04][D][resistance:037]: ‘temp_resistance_reading’ - Resistance 4878.2Ω
[12:21:04][D][sensor:092]: ‘temp_resistance_reading’: Sending state 4878.24854 Ω with 1 decimals of accuracy
[12:21:04][D][ntc:026]: ‘Smart Plug Temperature’ - Temperature: 45.3°C
[12:21:04][D][sensor:092]: ‘Smart Plug Temperature’: Sending state 45.34689 °C with 1 decimals of accuracy

Hope this helps.

Hi @edboston,

Thanks for trying the code!, and I’m glad I could help you. I have a question, the values shown and the consumption of each channel are correct?

Didn’t see a reply to this until today. I had to fudge the values around to get them to match another sensor for voltage. I also played around with the values for power and current to get them to match the values of the device (LED bulb) specs.