ebaauw / homebridge-p1

Homebridge plugin for DSMR end-consumer (P1) interface
Apache License 2.0
53 stars 11 forks source link

Data lost if sync after more than 30 days #79

Closed Bartelm closed 11 months ago

Bartelm commented 11 months ago

In the Eve app on my phone the history data is being downloaded from my Homebridge. But when the last sync has been more than 30 days ago it only syncs the last 30 days. Is this because Eve doesn’t ask for more data? Or is the data deleted after 30 days in Homebridge? Sometimes I just forget to open the app every month. Is there any way to sync older data if it is available? If the data is being purged in Homebridge, I’d really like to configure in the config file after what time it should do so. And maybe also a configurable location where to save all the data on the host machine.

ebaauw commented 11 months ago

I’d really like to configure in the config file after what time it should do so.

ServiceDelegate.History keeps a fixed number of history entries. By default this allows for four weeks of one entry per 10 min, but this can be specified on the constructor. None of my plugins currently support setting this, though.

The Eve history protocol was reverse engineered from Eve devices. The number of entries seems configurable (as long as it fits a 16-bit (unsigned?) integer), but I haven’t tested larger numbers.

And maybe also a configurable location where to save all the data on the host machine.

The data is saved in cachedAccessories.

The original implementation in fakegato-history uses a separate json file per accessory, and even supports storing these on Google drive. I wanted a leaner (and more flexible) implementation. My plugins expose devices to HomeKit, without additional functionality, like collecting history for other purposes. If you want that, I’d suggest to use ser2net to allow multiple programs to read the P1 data (see Wiki), and use a separate logger next to Homebridge P1.