Shelly Official Integration Update Interval

Hello,
I’m currently using Shelly official integration for HA. I have installed a Shelly EM to measure consumption at my home. However I see on the shelly app the update interval is a bit quicker while on HA I’m getting new readings every 30 seconds.

I’ve taken a look at the integration help page but it seems no way to change that update interval, say to 2 or 5 seconds instead of 30. Also on the Shelly web interface for the device there’s no interval configuration either.

Any ideas if something can be done using the official Shelly integration?

3 Likes

I’m only just getting started with these. I’ve not found if the frequency can be increased on the official integration.

MQTT seems to report instantly on state changes.
You can also manipulate the frequency that the Shelly reports it’s status to the MQTT broker too. A little more config to setup some sensor devices to hold the status, but looks like it will work fine.I’ve not set it up yet though but there looks to be plenty of examples to follow here on the forum.

I can report back on my progress if you are interested.

1 Like

Would be interested to see, what the best and most stable would be to retrieve the power usage.

I got the shelly integration with a faster update interval working as a custom integration!

  • Download the shelly integration from GitHub (whole folder) https://github.com/home-assistant/core/tree/dev/homeassistant/components/shelly
  • Place it in the
    \config\custom_components\shelly
    folder of your HA installation.
  • Modifiy the const.py file, in my case (Shelly 3EM) changing line 68
    UPDATE_PERIOD_MULTIPLIER: Final = 2.2
    to
    UPDATE_PERIOD_MULTIPLIER: Final = 0.22
    did the trick.
  • Modify the manifest.json file by adding a “version”, otherwise the custom integration won’t be loaded
  • Don’t forget the “,” after
    "loggers": ["aioshelly"], :wink:
{
  "domain": "shelly",
  "name": "Shelly",
  "config_flow": true,
  "documentation": "https://www.home-assistant.io/integrations/shelly",
  "requirements": ["aioshelly==1.0.9"],
  "zeroconf": [
    {
      "type": "_http._tcp.local.",
      "name": "shelly*"
    }
  ],
  "codeowners": ["@balloob", "@bieniu", "@thecode", "@chemelli74"],
  "iot_class": "local_push",
  "loggers": ["aioshelly"],
  "version": "0.1.1.1"  <-------------------------------
}

UPDATE:
I got rarely timeouts from the polling, so I also changed line 52 to a 10th of the value
POLLING_TIMEOUT_SEC: Final = 1.8
I will report if it didn’t work.

Hello, I have also a Shelly EM with the official integration and seems to update between 5s-15s:

1 Like

Interesting, mine was updating with a constant sequence of about 30 seconds. Which Integration version do you use?

Sorry for my late answer.

I amb using the official shelly integration from HA, since it worked perfect from first day I didn’t bother to try other alternatives.

The only change I did in the shellys is adding HA_SERVER_IP:5683 in the CoIoT config, there was mcast by default. Not sure if this helps with the update interval.

1 Like

Likewise, I am using the Official Shelly integration with my Shelly EM, configured for unicast ColoT and am seeing 10 second updates:

Thanks for your reply!
10 seconds updating would be fine for me. I am using the same settings but with port 8123 (I don’t know why, it’s some time I integrated the shellys).
I tried port 5683 and that works for me (updates in intervals between 1 and 15 seconds)! Thank you very much @tonicb !
grafik

You are welcome! I am happy to help.

Maybe another approach to this:
Fixed it with configuring mqtt to my homeassistant instance, even tho I’m not using the data from mqtt but the standard integration as mentioned. Seems to work perfectly this way

I have reached here due to an issue Need to be able to change shelly polling frequency · Issue #96010 · home-assistant/core · GitHub.

Shelly integration is does not pull devices. Instead the device is pushing updates upon changes.
Polling is only used when push updates are not working as a backup, please do not modify the polling interval, you are overloading HA and the device. Please make sure you have setup unicast correctly and if updates are still slow create an issue.

I found this thread after searching for a way to change the sample rate of a Shelly Plus Plug S v2 device.

I have been using one of these just to detect a sudden increase in the power supply by using a Trend binary sensor. This used to work just fine until I updated its firmware to it latest version, which now seems to have changed the sample rate to 6 seconds (I could swear it used to be as short as 2 seconds or so).
So, by analysing the evolution of the gradient attribute of that sensor, I can tell that it gets no where to what I used to have. The sensor was set to a min gradient of 35 (meaning a 70W increase in two seconds), but now it gets as much as 9 or 10 (I guess due to the new interval between samples).

So, did anyone notice the same thing with your Shelly Plus Plug S? Had I known better, I wouldn’t have upgraded it and now I can’t find a way to downgrade it back to where it was.