Android Widget Entity State Refresh Rate

Is there any way to increase the widget entity.state refresh rate from every 30 minutes? I want to display my current fireplace temperature in near real-time, every 15-30 seconds, but I don’t want to have to continuously tap the widget to get he latest value. Is there a configuration way to change this refresh rate some how? They data is being supplied by MQTT, it would be ideal to just have it reflect the latest value when it’s updated by MQTT.

1 Like

We can’t increase it but it does update when you turn on the screen to make it update faster. The app has no way to keep it in sync in a battery friendly way.

Thanks for the reply! Interesting, the entire phones use is based on having fresh/realtime data. Why is it that we can get notifications from all the apps including HA when they are pushed to us, but not be able to have that widget updated at the same time. Would it be possible for these widgets to be push enabled? I don’t need it to check every 15 seconds, but rather update when the data changes.

What about MQTT, do you know of any App that consumes MQTT that has widgets. I can’t seem to find any with a widget, I did find some references to using Tasker with some other apps.

1 Like

to subscribe to updates like that would require a websocket connection which the app does not support yet…its open source so anyone can come and add support for websockets so we can start using that API. However imagine an entity that updates on accident 1000 times, think about how bad battery drain that is. That is why its not a good idea. With the widgets updating when you turn on your screen thats pretty fast too if you think about it. Normally you glance at your widgets from turning on the screen and glancing before leaving. In those cases it updates immediately.

Good points! Why not a timer option on the widget? That way the phone owner is responsible for battery usage. If I want to have the widget update every 15 seconds, then that is my choice to burn battery. The timer could also have a option when the screen is off no updates, or if phone is locked, change update freq. It just seems that the widget is a great thing that is very limited in use by the non-adjustable refresh times.

https://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo#updatePeriodMillis

Note: Updates requested with updatePeriodMillis will not be delivered more than once every 30 minutes.

It looks like there may be other ways around this:

If, however, you need to update more frequently and/or you do not need to update while the device is asleep, then you can instead perform updates based on an alarm that will not wake the device.

The problem with setting an alarm is that it uses the same API as the next alarm sensor does which then means you won’t get a real value when you use that sensor.

The app is open source so if you really want you can build something and see where it goes in the review process.

Unfortunately I’m not a mobile developer. I just know the functionality that I would love to get access to on the mobile apps. I’m glad that you have such knowledge of this, and appreciate your sharing of it. When my home alarm goes off, my phone lights up a couple seconds afterward. I don’t know how they are doing it, but the app knows when the event happens almost immediately. I just want the same functionality with widgets. When the HA data changes, I want to know. I would think that this could be useful for all sorts of things. How about a front door just opened chime. One of the kids is in the candy cabinet. The mailbox was just opened. etc… I want a different sound for each of these notifications, and I would like a widget that contains there current status. Think of how great that would be. And it would be even better if it could all be configured on the HA server and pushed to the phones.

1 Like

They do it by sending a notification to your device, much like the app offers you. You can do this today if you wanted to, you just have to build the notification.

Would you find it useful if the app provided a notification command to update widgets when you ask for them from HA?

Great yes but you completely forgot about the point where subscribing to this level of updates can have serious implications on battery life. Imagine a device goes haywire and triggers thousands of updates until your phone dies. That will not be a good experience for any user.

How out of date are you seeing the widgets? Is the screen on intent really not enough to provide a more up to date experience? Honestly they update when you turn on the screen so for a quick glance thats pretty fast when you consider it. How useful would a widget be that updates a 1000 times when your phone is sitting in your pocket? The moment you take it out and turn on the screen those widgets update. Thats much better on battery life than the subscription you want.

I have an app that updates its widgets every second. It is a timer app named Multi Timer. I use it daily and It doesn’t show up on the battery usage list. I’d love to have my HA widgets update every minute or so when the phone is in use. I’m not going to use 1000 widgets, or 1ms update interval.

Those widgets keep track of time, they do not make a external call to your HA server to grab a state every second. I think you would see a larger drain if it were a better comparison.

I made a recommendation about a notification command in my post above, would that work for you? Basically you would control the updates via automation.

Hi again :blush:

I noticed that for a while now my Home Assistant widgets on my Android phone (S21 ultra exonys) have been updating every second.

But latest HA core 2022.6.5 they don’t any longer. I searched for a way to update them every second again but I couldn’t find any options.

I hope the developers will bring it back. Now I have to tap at the widgets to get them to update.

Thanks

Edit: I updated directly from Core 2022.6.4 to Core 2022.6.6 and widgets update again

check your logs for error messages.

Also entity state widgets update when the state changes, not necessarily every second.