Configuring Shelly EM Energy Meter

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-.

Yup. I have since flipped the clamp and readings are positive now.

1 Like

Tasmota has a firmware upgrade option somewhere in it’s web interface (I haven’t used it for ages). Upload the official .bin file using that web interface and you should be back to factory default.

That doesn’t work :frowning:
Original firmware is a zip file with several .bin

The answer is a bit hidden at the top of this thread. The total energy reported by the Shelly is in Watt-minutes; change your value_template to:

value_template: '{{ value_json.meters.0.total | float / 60000 }}'
1 Like

For anyone using Shelly EM you can now reset the totals

"Commands are accepted on:
shellies/shellyem-<deviceid>/emeter/<i>/command accepts message reset_totals to reset total and total_returned energy counters to 0 "

So if you want daily usage you can create an automation in home assistant to reset them daily at midnight.

    - service: mqtt.publish
      data:
        topic: shellies/shellyem-<DEVICEID>/emeter/0/command
        payload: reset_totals
        qos: 1
3 Likes