Skip to content

Sensor checking too often - (checkminutesdiff) #17

@FredHags

Description

@FredHags

Hi,

Setting seconds between checks doesn't work.

The function checkminutesdiff seems to have values (d1, d2) in the wrong order.
So the result is always above threshold.

I have changed the code to:

`
def getminutesdiff(self, d1, d2):

    d1 = datetime.strptime(d1, "%Y-%m-%d %H:%M:%S")
    d2 = datetime.strptime(d2, "%Y-%m-%d %H:%M:%S")
    diff = (d1 - d2).total_seconds()
    logger.debug(f"[get_minutes_diff] diff {diff}, d1 {d1}, d2 {d2}")
    return diff

`

which seems to be working.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions