Skip to content

Commit

Permalink
fix: import new recorder in home assistant (#22)
Browse files Browse the repository at this point in the history
* fix import in home assistant 2024.08

* bump version
  • Loading branch information
duhow authored Aug 14, 2024
1 parent 0105b22 commit 6d89f6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/aigues_barcelona/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/duhow/hass-aigues-barcelona/issues",
"requirements": [],
"version": "0.4.1"
"version": "0.4.2"
}
12 changes: 9 additions & 3 deletions custom_components/aigues_barcelona/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
from datetime import timedelta

import homeassistant.components.recorder.util as recorder_util
from homeassistant.components.recorder.const import (
DATA_INSTANCE as RECORDER_DATA_INSTANCE,
)

try:
from homeassistant.components.recorder.const import (
DATA_INSTANCE as RECORDER_DATA_INSTANCE,
)
except ImportError: # NEW Home Assistant 2024.08
from homeassistant.helpers.recorder import (
DATA_INSTANCE as RECORDER_DATA_INSTANCE,
)
from homeassistant.components.recorder.statistics import async_import_statistics
from homeassistant.components.recorder.statistics import clear_statistics
from homeassistant.components.recorder.statistics import list_statistic_ids
Expand Down

0 comments on commit 6d89f6c

Please sign in to comment.