Skip to content

Websocket connection warning #718

@gieljnssns

Description

@gieljnssns

Hi,

I recently realized an important Home Assistant limitation that may affect
EMHASS users relying on the websocket connection for historical data fitting.

For context: during the development and testing of the websocket-based history
retrieval, my Home Assistant instance still had the relevant data in
statistics_short_term. This meant 5-minute resolution data was still available
via the websocket API, so the approach worked as expected at the time.
I recently changed purge_keep_days: 360 -> purge_keep_days: 10 in HA and ran into issues.

If Home Assistant’s purge_keep_days is smaller than EMHASS’
historic_days_to_retrieve, the websocket API no longer returns high-resolution
(5-minute) state history. Instead, it falls back to long-term statistics with
~1 value per hour.

Key points:

  • recorder purging removes high-resolution history
  • websocket returns long-term statistics once raw data is gone
  • long-term statistics are hourly aggregates
  • this makes websocket-based fitting unsuitable for longer historical horizons

InfluxDB does not have this limitation and remains a reliable data source for
model fitting (I'm so happy I had an influx backup).

The websocket connection still makes sense for:

  • MPC / real-time optimization
  • short-term history windows
  • potential future live sensor tracking

This is not a bug in EMHASS, but an HA architectural constraint that may be worth:

  • documenting clearly
  • warning about in the config
  • or validating against purge_keep_days

Posting this mainly to prevent others from unknowingly relying on websocket
history for fitting over long periods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions