mirror of
https://github.com/thekiwismarthome/shopping-list-manager.git
synced 2026-06-30 21:46:30 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d50bd39210 |
@@ -43,11 +43,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# Initialize image handler
|
# Initialize image handler
|
||||||
image_handler = ImageHandler(hass, config_path)
|
image_handler = ImageHandler(hass, config_path)
|
||||||
|
|
||||||
|
# Read installed version from manifest
|
||||||
|
import json as _json
|
||||||
|
with open(os.path.join(component_path, "manifest.json")) as _f:
|
||||||
|
_manifest = _json.load(_f)
|
||||||
|
|
||||||
# Store instances in hass.data
|
# Store instances in hass.data
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][DATA_STORAGE] = storage
|
hass.data[DOMAIN][DATA_STORAGE] = storage
|
||||||
hass.data[DOMAIN]["image_handler"] = image_handler
|
hass.data[DOMAIN]["image_handler"] = image_handler
|
||||||
hass.data[DOMAIN]["country"] = country
|
hass.data[DOMAIN]["country"] = country
|
||||||
|
hass.data[DOMAIN]["version"] = _manifest.get("version", "unknown")
|
||||||
|
|
||||||
# Register update listener for options changes
|
# Register update listener for options changes
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
entry.async_on_unload(entry.add_update_listener(update_listener))
|
||||||
|
|||||||
@@ -1182,10 +1182,12 @@ def websocket_get_integration_settings(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Return current country and available country options."""
|
"""Return current country and available country options."""
|
||||||
country = hass.data[DOMAIN].get("country", "NZ")
|
country = hass.data[DOMAIN].get("country", "NZ")
|
||||||
|
version = hass.data[DOMAIN].get("version", "unknown")
|
||||||
connection.send_result(
|
connection.send_result(
|
||||||
msg["id"],
|
msg["id"],
|
||||||
{
|
{
|
||||||
"country": country,
|
"country": country,
|
||||||
|
"version": version,
|
||||||
"available_countries": {
|
"available_countries": {
|
||||||
"NZ": "New Zealand",
|
"NZ": "New Zealand",
|
||||||
"AU": "Australia",
|
"AU": "Australia",
|
||||||
|
|||||||
Reference in New Issue
Block a user