Configuring Shelly EM Energy Meter

Thanks so much.

One question.

How can reboot value “total” API REST Shelly EM???
thanks

There is no option for resetting the Shelly total energy counter. Unless you want to factory reset it and lose all your settings. You can monitor this sensor with a the utility meter and that can be reset at any interval (cycle) you want:

Yes, exactly, I am using a utility_meter with a time hourly cycle next to the so called API rest of shelly to value “total” accumulated.

Your answer helped me.

But of course, I wondered, if it would be possible to reset that accumulated value.
Since when does that accumulated value work?
since I bought shelly em?

Until what value will it reach?
I may have a limit, and in the future the counter will stop working: -S

Thanks

1 Like

From when you first power it up to whenever the value rolls over. It’s an esp8266 processor and the total has decimal places so I’m guessing it is a 32 bit floating point variable which makes the maximum value possible:

2,147,483,647 kWh.

Or half that if it is signed (can have negative values).

Assuming you use 20kWh a day that’s 294 years before it rolls over to 0.

1 Like

Hi guys, i’ve a shelly 2.5. I want create a sensor for instant energy meter. I’ve enable mqtt and work correctly. which of the two examples works correctly with utility meter?

First:

    - platform: mqtt
      name: "Consumo Lampada Salone"
      state_topic: "shellies/shellyswitch25-8CAAFFFFFF/relay/0/energy"
      value_template: "{{ value|float / 60000 }}" # Fix for Watt-minutes
      qos: 1
      unit_of_measurement: "kWh"
      icon: mdi:chart-bar

Second:

    - platform: rest
      name: "Consumo 2 Lampada Salone"
      resource: http://192.168.1.8/status
      value_template: '{{ value_json.meters.0.total | float /1000 }}'
      scan_interval: 300 # no point updating faster than this. The Shelly only updates this every 5 minutes
      unit_of_measurement: kWh

Sorry, I’m new to home assistant and I am trying to configure my shelly EM, why is everyone reading total from rest and not from mqtt?
I can see that shellies/home-energy-meter/emeter/0/total is available and I plan on using that. I there something that I should know about that value?

probably they are using rest because they want to use shelly cloud and you cannot use mqtt if cloud is enabled.
Otherwise, you ca use the HACS integration ShellyForHass to have ShellyEM sensors and mantain cloud enabled, this plugin uses COAP as communication.

It may not have been available on the last firmware when I wrote my post. I say ‘may’ because it’s impossible to find the release notes. Facebook as support? Good grief :roll_eyes:

The API reference doesn’t mention it so it probably is a new addition:

Shelly EM: MQTT

When configured for MQTT Shelly EM reports data on:

  • shellies/shellyem-<deviceid>/emeter/<i>/energy an incrementing energy counter in Watt-minute
  • shellies/shellyem-<deviceid>/emeter/<i>/returned_energy energy returned to the grid in Watt-minute
  • shellies/shellyem-<deviceid>/emeter/<i>/power instantaneous active power in Watts
  • shellies/shellyem-<deviceid>/emeter/<i>/reactive_power instantaneous reactive power in Watts
  • shellies/shellyem-<deviceid>/emeter/<i>/voltage grid voltage in Volts
  • shellies/shellyem-<deviceid>/relay/0 the state of the internal relay

Commands are accepted on:

  • shellies/shellyem-<deviceid>/relay/0/command accepts on , off or toggle

Hi,

indeed shellyem sends an MQTT with “total” updates:

Do you think your rest query could be replaced 1 by 1 with this?

Yes it could.

Hi all,
I planned to use Shelly 3EM on my installation, but there is something I need to clarify.
HA integration uses mqtt and Shelly cloud servers isn’t it?

Is it possible to get an HA integration without using external server? only local wifi?

I saw there that it seems possible to flash ESpHome firmware, but is there another way?

If you use mqtt, shelly cloud is disabled.

Ok, it’s a good news!

Thanks Francisp

So after 10 months my Shelly EM has started to misbehave.

Despite having an RSSI of -43dBm it is dropping off the network for 20 to 30seconds every 3 to 5 minutes.

I’m still on FW 1.5.something and am unable to to get it to update to 1.8.1. Must have tried a dozen times today.

Resetting my access point and the Shelly has made no difference.

Anyone experienced anything similar?

I had a PM asking if I had fixed this (please don’t PM - use the forum, others may need the answer too).

The answer is yes but it was a bit of a PITA.

Contact with Shelly support recommended updating the firmware from v1.5 to 1.8.1. After literally scores of attempts to do this using the EM’s web interface without success I stumbled on a solution in the German support forums.

I downloaded the latest firmware - really not easy to find but you can alter the version number and device code in this URL to get any version:

http://archive.shelly-support.eu/v1.8.1/SHEM_build.zip
                                   ^     ^
                             FW ver.     Device code (SHEM)

Note: I have since leaned firmware is available here if you create an account: https://www.shelly-support.eu/index.php?shelly-firmware-archive/

Then I downloaded HFS - a local HTTP file server that runs without needing to be installed - and ran it on my PC. After adding the firmware file to HFS (Menu / Add files) and allowing it through windows firewall it was available on my local network and I used the following URL in a web browser to update the Shelly EM:

http://10.1.1.24/ota?url=http://10.1.1.2/SHEM_build.zip
            ^                      ^
 IP address of Shelly EM           IP address of HFS

This initiated a local OTA (over the air) update of my Shelly EM . After it restarted I then browsed to the Shelly EM’s web page - I thought the update was unsuccesful (still on 1.5.x) but a browser cache refresh showed it was actually successful.

The good news is that since updating to the latest firmware my Shelly EM has had no wifi connection issues.

I use MQTT and a restful sensor to communicate with my Shelly EM, be aware that v1.8 has an issue if you are using ShellyForHass that requires you to use the latest beta: https://github.com/StyraHem/ShellyForHASS/issues/392

It simply was the new firmware on Shelly was not supported by the Hassio addon. After rolling back it worked great! thanks!

hello
i’m trying to set up utility_meter for my outside lights running on shelly 1PM and getting some strange readings.
the sensor for the lights looks like this:

platform: rest
name: "Outside Light Energy"
resource: http://192.168.0.63/status
# username: !secret shelly_usr
# password: !secret shelly_pwd
authentication: basic
value_template: '{{ value_json.meters.0.total | float / 1000 }}'
scan_interval: 300
unit_of_measurement: kWh

utiliy meter sensor is as follows:

  daily_energy:
    source: sensor.outside_light_energy
    cycle: daily

and after running the lights for 10 minutes @ 52 watts I’m getting a readout of 0.525 kWh.

could some please point me in the right direction?

thank you in advance

I have installed the shelly em a few days ago and am confuse about the readings I am seeing via mqtt. Why is it showing negative values and total is 0.0. The manual says that a negative value means you have solar panel install which I do not.
shellyem-readings

I have my Shelly EM with Tasmota, but I would like to return it to stock firmware.
Can some one point me how to do that, can’t find any info about this…

Check the direction of the phase one current clamp, you probably need to mount it the opposite way.
The direction is vital in getting a positive or negative value.

Either that or shift the p1+ with p1-.