Shelly reporting frequency

Hi, all.
I have multiple shelly pro 3EM devices all over the place.
I am looking for a solution to decrease the reporting interval from 15s to something like 2-3 seconds.
Does anyone have any tips how to do it?
Is there a way how to tell the device from HA to “do the update”? I know there is RPC call for it, but even when I trigger it, the HA does not seem to read the MQTT update for some reason.
I guess the HA Shelly integration does not use MQTT for data transfer…

Standard Shelly integration uses Shelly API to connect directly to devices. From what I can observe on my 3EM updates are seen by HA as soon as something changes, sometimes every second. Not sure where you got 15 secs from… perhaps you are using old HACS integration?

That might be true for 3EM, but for PRO 3EM the update is set to 15 seconds apparently.
Source: Changelog | Shelly Technical Documentation (look at Changed part). Confirmed by shelly support.
They recommended some sort of local device script. I can trigger EM.GetStatus to see the new data, but I have no idea how to “send” them to HA :frowning:

Hi after the update to the newest FW i and others hat the same problem, the update rate is very slow even in the web interface. Before it was every 1-3s wich worked perfect for my solar management and zero export script but this update crashed everything. I downgraded to version 0.14.1 and it worked again.
Link to the old version https://shelly-infra1-eu.shelly.cloud/stable-firmware/Pro3EM/fw-signed.zip
Others now use a script ad MQTT to push the data more often to HA

See also the German forum

Add a Script in the Pro 3EM that send EM data via MQTT or use Modbus.

// Schicke die die Leistungsdaten per MQTT alle X Sekunden weil die aktuelle FW das nur alle 15 sek macht.

let SHELLY_ID = undefined;
Shelly.call("Mqtt.GetConfig", "", function (res, err_code, err_msg, ud) {
  SHELLY_ID = res["topic_prefix"];
});

function timerHandler(user_data)
{
  let em = Shelly.getComponentStatus("em", 0);
         MQTT.publish(SHELLY_ID + "/status/em:0",JSON.stringify(em),0,false);
 }
Timer.set(3000, true, timerHandler, null);

This Script send EM data via MQTT all 3 seconds, but any Intervall is possible, Timer.set(3000, true, timerHandler, null); Change 3000 to the desired interval in ms. minimum is 1000ms.

1 Like

I apologize, for some reason I did not receive email about your response.
Thanks for the code - it works, of course, but it does not update the HA status.
However, I’ve created custom MQTT sensor, reading the JSON generated by your script and that works OK for me - now I have much faster update from power and much smoother update of my go-e EV charger.
THANKS!

Next FW come to fix this issue

Support Shelly Write:
Thank you for your patience!
Now live is version 1.0.5, where this problem is addressed.
You can make an update to solve your issue.“

After the new HA update (core_2023.12.4) my Shelly Pro 3EM integration did not work any more. The old FW is not supported any longer:
aioshelly.exceptions.FirmwareUnsupported

I didn’t wanted to loose my history and therefore not switch to MQTT if possible. I updated from 0.14.1 to 1.1.0.
First i thought its not working only each 8-15 s updates in web interface and also in HA. Then i noticed if i switch a consumer like 120 W on and off it updates faster each 1-2 s. So its exactly what i need for my PV control :slight_smile:

Full log:

Summary

Logger: homeassistant.config_entries
Source: config_entries.py:406
First occurred: 14:36:46 (2 occurrences)
Last logged: 14:38:18

Error setting up entry shellypro3em for shelly
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 406, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/shelly/init.py”, line 129, in async_setup_entry
return await _async_setup_rpc_entry(hass, entry)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/shelly/init.py”, line 279, in _async_setup_rpc_entry
await device.initialize()
File “/usr/local/lib/python3.11/site-packages/aioshelly/rpc_device/device.py”, line 148, in initialize
self._shelly = await get_info(
^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aioshelly/common.py”, line 103, in get_info
raise fw_error
aioshelly.exceptions.FirmwareUnsupported: {‘name’: None, ‘id’: ‘shellypro3em’, ‘mac’: ‘xxx’, ‘model’: ‘SPEM-xxx’, ‘gen’: 2, ‘fw_id’: ‘20230308-092018/0.14.1-g22a4cb7’, ‘ver’: ‘0.14.1’, ‘app’: ‘Pro3EM’, ‘auth_en’: False, ‘auth_domain’: None}

Thanks for the script. I would also like to decrease the interval of the “emdata:0”. This is only published once every minute.

“a_total_act_energy” is the absolute counter value since the device was initialized in Wh.

emdata has the absolute energy counters. em unfortunately just shows the current power.

Unfortunately changing your script from “em” to “emdata” did not work.