sensor.krisinformation icon indicating copy to clipboard operation
sensor.krisinformation copied to clipboard

Add `expiry` configuration setting to exclude old messages

Open NateRobinsonS opened this issue 4 years ago • 2 comments

Added an expiry setting in the config file to allow older messages to be dropped from the sensor after a configureable amount of time. Messages from krisinformation's API that are older than this setting will be excluded from the sensor.

Note: I was unable to make this an optional setting in the configuration file. Omitting the "expiry" setting causes the config_check to fail. I suspect that the cv.time_period_dict type cannot be optional. As a result, the proposed upgrade is a breaking change!

Example configuration:

sensor:
  - platform: krisinformation
    latitude: !secret lat_coord
    longitude: !secret long_coord
    county: 'Stockholms län'
    radius: 100
    expiry:
      days: 2 

NateRobinsonS avatar Mar 30 '20 09:03 NateRobinsonS

I want to try this out before merging, due to the breaking change. I will do that as soon as I have the time.

isabellaalstrom avatar Apr 06 '20 07:04 isabellaalstrom

I strongly agree, and there's no rush. I only have one system to test on.

I won't take it personally if you choose not to use it. :)

-Nate

On Mon, Apr 6, 2020 at 9:54 AM Isabella Gross Alström < [email protected]> wrote:

I want to try this out before merging, due to the breaking change. I will do that as soon as I have the time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/isabellaalstrom/sensor.krisinformation/pull/23#issuecomment-609635156, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7XJUBSA2OBMH6APNJZXR3RLGDEZANCNFSM4LWOHHMA .

NateRobinsonS avatar Apr 06 '20 08:04 NateRobinsonS