gtdiehl / iotawatt_ha

IoTaWatt for Home Assistant
Apache License 2.0
16 stars 16 forks source link

Refresh Rate #3

Open mmiller7 opened 3 years ago

mmiller7 commented 3 years ago

Is there a way to increase the refresh rate, say 10 or 15 seconds?

gtdiehl commented 3 years ago

@mmiller7 I believe the default polling period is 30seconds. Do you want a way to increase it to poll say every 45-60seconds?

mmiller7 commented 3 years ago

I was thinking more like 5-10 seconds (so 6x or 12x per minute) - I'd like to have HomeAssistant monitor some things that are much shorter duration or trigger more events more quickly after they start happening.

polyfaces commented 3 years ago

It is easy to do so. Just fork this respository and change the value in the "const.py" file. I have already done this.

https://github.com/polyfaces/iotawatt_ha/commit/4d65ef9e67a3ad79044d7a466c30d41958d55404

stepir commented 2 years ago

hi @polyfaces the current version of https://github.com/gtdiehl/iotawatt_ha/blob/main/custom_components/iotawatt/const.py does not include such constant anymore - I tried your suggested solution and added it myself but the integration seems to ignore it?

mmiller7 commented 2 years ago

It is easy to do so. Just fork this respository and change the value in the "const.py" file. I have already done this.

polyfaces@4d65ef9

Just tried updating and discovered this no longer seems to exist.

How do we adjust the refresh rate in the new version?

tasranson commented 2 years ago

I would love to be able to do this too. Ideally only for one or two specific measurements (entities in HA) coming off the iotawatt that are more time critical, but would be happy to suck up the pain if it had to apply to all measurements (entities in HA). I can where 30 seconds is set in the code in GitHub, but I dont really want to revert from using the core version of the integration to a custom one unless that is the only way to do this.

zunnnn commented 2 years ago

same problem, i would like to set custom refresh rate because 30 second is a lot of time when i have to turn off some items. i suffer disconnection from the grid because this integration is too slow to trigger events

rigorm commented 2 years ago

try this line :

https://github.com/gtdiehl/iotawatt_ha/blob/395e4e776a56f1630f84f57b9b1fbcdb016db98d/custom_components/iotawatt/coordinator.py#L32

stepir commented 2 years ago

Thank you!!

mmiller7 commented 2 years ago

Anyone getting this error in the log with a higher refresh rate?

2022-03-19 11:40:50 WARNING (MainThread) [iotawattpy.iotawatt] Nothing to query, update() called too soon, must wait {timespan}