-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix float coerce in input settings * Fix recreate statistics service * New websockets API * Fix error when entering floats in prices config_flow * Improve statistics recreation to avoid loss of old data * Implement new websockets api to directly fetch statistics from HA "long term statistics" * Fix some styling issues * Include surplus energy to statistics * Add lovelace to manifest * Add edata-card * Update docs * Fix entry removal/unload * Remove old deprecated code and implement device/entity logic * Restore some outdated code and explode attributes to different sensors * Code simplification * Adding new config flow options * Fix translations * Update edata backend * Restoring debug functionality in options config_flow * Adding migration function for new storage strategy * Add billing simulation at options config_flow * Rewrite history on billing options changes * Fix #214 #210 #215 #198 #199 #223 #231 #233 #235 #207 #204
- Loading branch information
Showing
28 changed files
with
3,095 additions
and
1,276 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,61 @@ | ||
"""e-data integration""" | ||
"""Home Assistant e-data integration.""" | ||
|
||
from __future__ import annotations | ||
|
||
import logging | ||
from pathlib import Path | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.typing import ConfigType | ||
|
||
from . import utils | ||
from .const import DOMAIN | ||
|
||
PLATFORMS: list[str] = ["sensor"] | ||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
async def async_setup(hass: HomeAssistant, config: ConfigType): | ||
"""Set up edata-card resources.""" | ||
|
||
path = Path(__file__).parent / "www" | ||
name = "edata-card.js" | ||
utils.register_static_path(hass.http.app, "/edata/" + name, path / name) | ||
version = getattr(hass.data["integrations"][DOMAIN], "version", 0) | ||
await utils.init_resource(hass, "/edata/edata-card.js", str(version)) | ||
return True | ||
|
||
|
||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Set up edata from a config entry.""" | ||
|
||
# Registers update listener to update config entry when options are updated. | ||
unsub_options_update_listener = entry.add_update_listener(options_update_listener) | ||
entry.async_on_unload(unsub_options_update_listener) | ||
|
||
hass.async_create_task( | ||
hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | ||
) | ||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | ||
|
||
return True | ||
|
||
|
||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Unload a config entry.""" | ||
|
||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | ||
if unload_ok: | ||
hass.data[DOMAIN][entry.data.get("scups").upper()] = {} | ||
hass.data.get(DOMAIN, {}).pop(entry.data.get("scups"), None) | ||
|
||
return unload_ok | ||
|
||
|
||
async def async_remove_entry(hass, entry) -> None: | ||
async def async_remove_entry(hass: HomeAssistant, entry) -> None: | ||
"""Handle removal of an entry.""" | ||
|
||
hass.data.get(DOMAIN, {}).pop(entry.data.get("scups"), None) | ||
|
||
|
||
async def options_update_listener(hass: HomeAssistant, config_entry: ConfigEntry): | ||
"""Handle options update.""" | ||
|
||
await hass.config_entries.async_reload(config_entry.entry_id) |
Oops, something went wrong.