You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've enabled debugging and have been reading the logs for this integration and noticed that it obtains readings at 0 & 5 mins along with 30 & 35 mins past the hour. My HA is a lightly loaded system not really doing much as I learn about the system.
A few days later I noticed this was not happening, just one reading at each of 3 & 33 mins past the hour.
I've managed to reproduce the duplication in the logs by restarting my HA at exactly zero seconds on the hour e.g. 11:00:00
I would expect the integration to trigger once in the period 0-5 mins past the hour and once in the period 30-35 mins past the hour.
This with version 1.0.3
I think that I've found the problem in the sensor.py
async def should_update() -> bool: """Check if time is between 0-5 or 30-35 minutes past the hour.""" minutes = datetime.now().minute if (0 <= minutes <= 5) or (30 <= minutes <= 35): return True return False
If this code is called every 5 minutes starting at zero minutes past the hour it will return true four times an hour (0,5,30,35), rather than the required two.
This is because minutes is an integer and the criteria in the if statement each catch a six minute period.
Changing the code to...
async def should_update() -> bool: """Check if time is between 1-5 or 31-35 minutes past the hour.""" minutes = datetime.now().minute if (1 <= minutes <= 5) or (31 <= minutes <= 35): return True return False
Would stop the extra runs, I think.
AR
The text was updated successfully, but these errors were encountered:
I've enabled debugging and have been reading the logs for this integration and noticed that it obtains readings at 0 & 5 mins along with 30 & 35 mins past the hour. My HA is a lightly loaded system not really doing much as I learn about the system.
A few days later I noticed this was not happening, just one reading at each of 3 & 33 mins past the hour.
I've managed to reproduce the duplication in the logs by restarting my HA at exactly zero seconds on the hour e.g. 11:00:00
I would expect the integration to trigger once in the period 0-5 mins past the hour and once in the period 30-35 mins past the hour.
This with version 1.0.3
I think that I've found the problem in the sensor.py
async def should_update() -> bool:
"""Check if time is between 0-5 or 30-35 minutes past the hour."""
minutes = datetime.now().minute
if (0 <= minutes <= 5) or (30 <= minutes <= 35):
return True
return False
If this code is called every 5 minutes starting at zero minutes past the hour it will return true four times an hour (0,5,30,35), rather than the required two.
This is because
minutes
is an integer and the criteria in theif
statement each catch a six minute period.Changing the code to...
async def should_update() -> bool:
"""Check if time is between 1-5 or 31-35 minutes past the hour."""
minutes = datetime.now().minute
if (1 <= minutes <= 5) or (31 <= minutes <= 35):
return True
return False
Would stop the extra runs, I think.
AR
The text was updated successfully, but these errors were encountered: