Change update_interval from HomeAssistant

I want to change update_interval of esphome sensor pzemac. from home assistant. I have a lot of time to search on google but it not work.
Any one know how to change update_interval of pzemac at runtime. please show me, thanks alot.

1 Like

You can’t. You can use the homeassistant.update_entity service in an automation to update an entities state. So you could have your pzemac with a really long update interval and use an automation to poll when you want.

This could be a really neat feature. For example for smart plugs with power monitoring: you probably don’t care about the power consumption when the target device is off (so you could set update_interval to something long), but when the device is on you may want more frequent updates (so you could set update_interval to something very short).

For this use case you’d want to set the update_interval in some automation logic on the device itself probably. But if that plumbing existed then you could also change it from a service exposed from the device to HA.

Edit: I was able to kinda make what I wanted with a delta filter. See here.