Anyone using Shelly EM?

Apparently it has the ADE7953 inside, same as Shelly 2.5, which is supported.

I haven’t found anyone sharing their ESPhome config for it.

Is it the same gpio pins used for SPI with ade7953 ?, what about the relay pins?

1 Like

You don’t need to install ESPHome unless you specifically want to access it via the ESPHome api. It has a built in MQTT client. And other sensors can be implemented with RESTful sensors:

Yes, I am aware. I’m already using a bunch of ESPHome devices, and would prefer if I could use ESPHome with this one too.

1 Like

I’ I just got my shelly em, I hope to have the time to flash it in the days between christmas and new year’s eve.
I’m also using some 2.5s now you can find a sample config in the esphome pages, check them out!

hey @alessandro.gervaso, did you were able to flash it?

I got one shelly EM this week but I was not able to include it, maybe it is faulty or some other problem.
I would like try to replace the firmware maybe it might works

Hi, unfortunately I haven’t had much time so it’s basically still in the box. I’ve just tried to check if it was working (it didn’t connect to the network at first, then it made it).

I’m using a couple of Shelly EMs with esphome and Home Assistant. I use a 120A clamp for input A and a 50A clamp for input B. Calibration is different per channel and I’m putting this down to the clamp type because the original Shelly firmware makes you specify the clamp type per channel, so it makes sense that the calibration difference is attributed to this.

I calibrated an EM flashed with esphome against a stock EM with clamps connected to the same tails. To do this, I used a Tesla charger on a Tesla Model 3 ranging from a 5A to 32A charging rate. I also used various other lower power devices for values <1000W. I then cross-checked the values with a bunch of Shelly PMs on circuits downstream of the EM whose power usage values should add up to the total value reported by the EM and it seems pretty close (usually within 1…2%).

Here’s my config, though it looks like maybe a lambda applying a factor to the sensor value of ~1.143 for 120A clamps and ~1.157 for 50A clamps might also achieve the same thing.

substitutions:
  name: "shellyemworkshop"
  friendly_name: "Shelly EM Workshop"

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

wifi:
  ssid: !secret ssid
  password: !secret ssid_password
  fast_connect: true

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${friendly_name} FB"
    password: !secret fallback_password

captive_portal:

# Enable logging
logger:

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

ota:
  password: !secret api_password

web_server:
  port: 80

switch:
  - platform: restart
    name: "${friendly_name} Restart"
    
i2c:
  sda: GPIO12
  scl: GPIO14

sensor:
  - platform: wifi_signal
    name: "${friendly_name} WiFi Signal"
    update_interval: 60
  - platform: ade7953
    voltage:
      name: Workshop Voltage
    current_a:
      name: Workshop Current
    current_b:
      name: Tesla Charger Current
    active_power_a:
      id: workshop_power
      name: Workshop Power
      filters:
      #Reading -> actual
      - calibrate_linear:
        - 5.5 -> 6.25
        - 22.0 -> 25.0
        - 48.0 -> 54.0
        - 70.0 -> 80.0
        - 76.0 -> 88.0
        - 83.0 -> 95.0
        - 89.0 -> 103.0
        - 142.0 -> 162.0
        - 155.0 -> 177.0
        - 159.0 -> 181.0
        - 280.0 -> 320.0
        - 283.0 -> 323.0
        - 1083.0 -> 1240.0
        - 1297.0 -> 1480.0
        - 1512.0 -> 1728.0
        - 1683.3 -> 1924.0
        - 1930.0 -> 2210.0
        - 2130.0 -> 2438.0
        - 2312.0 -> 2645.0
        - 2550.6 -> 2927.0
        - 2755.8 -> 3145.0
        - 2987.4 -> 3415.7
        - 3181.6 -> 3636.8
        - 3381.0 -> 3865.0
        - 3392.2 -> 3884.4
        - 3646.0 -> 4173.0
        - 3829.0 -> 4391.6
        - 4034.8 -> 4617.6
        - 4236.1 -> 4827.8
        - 4253.0 -> 4865.0
        - 4476.0 -> 5121.0
        - 4663.0 -> 5340.0
        - 4845.0 -> 5580.5
        - 5023.0 -> 5738.3
        - 5227.0 -> 5932.0
        - 5432.0 -> 6216.0
        - 5635.0 -> 6419.0
        - 5842.0 -> 6649.5
        - 6030.0 -> 6912.7
        - 6249.7 -> 7150.6
        - 6437.2 -> 7365.8
        - 6642.0 -> 7608.7
      - lambda: if (x <= 0.0) return 0; else return x;
    active_power_b:
      id: tesla_charger_power
      name: Tesla Charger Power
      filters:
      #Reading -> actual
      - calibrate_linear:
        - 3.0 -> 3.5
        - 1064.9 -> 1231.9
        - 1240.1 -> 1434.8
        - 1478.8 -> 1710.2
        - 1683.8 -> 1946.7
        - 1856.7 -> 2147.1
        - 2095.4 -> 2423.9
        - 2294.7 -> 2654.1
        - 2456.4 -> 2840.7
        - 2709.1 -> 3133.5
        - 2916.8 -> 3373.4
        - 3080.6 -> 3563.7
        - 3329.7 -> 3850.7
        - 3558.0 -> 4115.3
        - 3716.3 -> 4298.1
        - 3933.7 -> 4550.6
        - 4137.5 -> 4785.4
        - 4348.4 -> 5029.8
        - 4526.1 -> 5235.4
        - 4716.3 -> 5454.8
        - 4960.6 -> 5738.5
        - 5164.0 -> 5974.2
        - 5366.3 -> 6208.3
        - 5547.8 -> 6419.0
        - 5782.0 -> 6688.4
        - 5948.0 -> 6881.1
        - 6142.1 -> 7107.0
        - 6340.9 -> 7337.2
        - 6545.2 -> 7573.1
      - lambda: if (x <= 0.0) return 0; else return x;
    update_interval: 5s

status_led:
  pin: GPIO0
1 Like

I am buit din’t flash it

After playing around a bit, I’ve decided to go with the lambda approach on my two Shelly EMs. I’m now using the following:

  - platform: ade7953
    voltage:
      name: Workshop Voltage
    current_a:
      name: Workshop Current
    current_b:
      name: Tesla Charger Current
    active_power_a:
      id: workshop_power
      name: Workshop Power
      filters:
      - lambda: if (x <= 0.0) return 0; else return x*1.143207411;
    active_power_b:
      id: tesla_charger_power
      name: Tesla Charger Power
      filters:
      - lambda: if (x <= 0.0) return 0; else return x*1.156612516;
    update_interval: 5s

This gives a pretty decent value when comparing the sum of Shelly 1PMs on all downstream circuits:

image

2 Likes

How did you manage to flash it?
With what tools?

Have pinned it correctly with a Velleman VMA440 (that has worked for me before, with other devices, no Shelly though) and a buck converter 5V -> 3.3V and can get info out of it when booting it up normally:

r
rBoot v1.2.1 - [email protected]
Flash Size:   32 Mbit
Flash Mode:   DIO
Flash Speed:  20 MHz
rBoot Option: Big flash

Booting rom 1 (0x108000).
V2
Mo
phy⸮⸮⸮⸮⸮
mode : softAP(a6:cf:12:b9:f2:26)
add if1
dhcp server start:(ip
bcn 0
del if1
usl
mode : null
mode : softAP(a6:cf:12:b9:f2:26)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
bcn 0
del if1
usl
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100


SHEM-B9F226 A4:CF:12:B9:F2:26

But when I ground GPIO0 to get it into boot mode, no tools seem to find it.
Have tried directly from HA/ESPHome addon.
Ardunio IDE
Misc esptool (pyhton as well as Windows compiled exes with UI).

But no luck.
“Cannot find headers”-ish is the closest to some error message that would be understandable.

I used one of these: https://www.amazon.co.uk/dp/B07BBPX8B8/ref=cm_sw_r_cp_api_fabc_qlu0Fb1JMM7ST?_encoding=UTF8&psc=1

Had no issues.

I forget the software that I used, but so far any old esp flashing tool that I’ve found via google has worked on my Shellies.

Hi guys,

I flash my Shelly EM with ESPHome, everything is working, but I noticed a weird thing.
‘Total Power’ should be equal to ‘Total Current’ x ‘Voltage’, right?

I didn’t add any calibration to the active power, yet.

You answered your own question. Add the calibration.

Actually I don’t.
But after some searching, I understood that there is something called Power Factor on AC Power.
So my Real Power only is equal to my Apparent Power (Voltage x Current) if my Power Factor is 100%


image

Thanks for whole treath. It help me to get my shelly EM flashed with ESPHome and working.
I want to add my 2 cents because differs a bit on how I achieved flashing the device.
I flashed Shelly EM only over OTA following this guide: Shelly 2.5: Flash ESPHome Over The Air! | Savjee.be
with a small exception. Once trying to flash esphome I run out of space in tasmota device. I had to flash the tasmota minimum version and then allowed me over OTA to flash using the compiled ESPHome binary.
Regarding yaml code, @shallax ones in this thread worked like a champ (I just changed some strings, to fit my use case but nothing else).

1 Like

Thanks for all the useful information in here. I just installed to shelly EMs and I’m also looking to run ESPHome on it. Though this bit is scaring me – Shelly 2.5 + ESPHome: potential fire hazard + fix | Savjee.be

Does anyone know if this floating pin applies on the shellyem varient of ade7953? If so are the pins the same? For example we can take

binary_sensor:
  - platform: gpio
    pin: GPIO16
    name: "ade7953 IRQ pin"
    internal: true

verbatim?

Yes, Shelly 2.5 and EM share the same power sensor. You should check the documentation as it is already explained and there’s an example:

Just a quick quesiton, could you buy a shelly 2,5 flash it with the epshome em config in this thread and connect the power clamp to it to get the same type of power sensor? The price difference between an EM and 2.5 is double the money, that is why I am asking.

Hi All, I am trying to flash my Shelly EM however It seems to become unresponsive after flashing. Tasmota flashes the firmware with no problems, however when i repower the device, nothing happens. it doesnt connect to my WiFi it does not create its own captive portal.

I have also tried to flash it with tasmota and the same issues occur? any suggestions?

Hi,

I was digging into the Energy feature in home assistant and wanted to add my Shelly EM with esphome working to start tracking it. I got it working thanks to code provided by @shallax above but I am unable to select it because does not appear in the drop-down list:
imagen

Anyone got it working? my guess is maybe I am missing some extra parameters in the esphome configuration of the shelly em that prevents to appear but not sure.

Thank you,