Skip to content

Handle lastchange over application restarts #10

@LeSpocky

Description

@LeSpocky

Today the docker containers running the AmpelController and the SpaceAPI-Service were restarted. Since then the lastchange attribute in the delivered SpaceAPI json is set to the value 1234 which as a Unix Timestamp translates to the obviously wrong 1st of January 1970 at 1:20 am. This is the same value we get as retained value from the MQTT broker in our current setup. Not sure how it got there, but the SpaceAPI service picks it up and happily puts it into the json output (see attached file). I suspect the problem to be the AmpelController, which has no lastchange value to publish until the first actual change happens.

Consumers of our spaceapi record display that value, e.g. like this:

Several options to solve this were discussed already:

  1. persist the lastchange value over application restarts, maybe in a cache file?
  2. publish certain values like lastchange with a retained flag to MQTT
  3. (only publish those values as retained on app shutdown, otherwise normally)

Maybe some other solution is possible?

Attachment: spaceapi.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions