Launch stability fixes

This commit is contained in:
Thomas Lovén 2022-07-28 13:48:37 +00:00
parent b211b7f884
commit a641617671
9 changed files with 526 additions and 407 deletions

View File

@ -26,7 +26,9 @@ async def async_setup(hass, config):
async def async_setup_entry(hass, config_entry):
for domain in ["sensor", "binary_sensor", "light", "media_player", "camera"]:
await hass.config_entries.async_forward_entry_setup(config_entry, domain)
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, domain)
)
await async_setup_connection(hass)
await async_setup_view(hass)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,10 @@
import logging
from homeassistant import config_entries
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
@config_entries.HANDLERS.register(DOMAIN)
class BrowserModConfigFlow(config_entries.ConfigFlow):
@ -11,4 +14,5 @@ class BrowserModConfigFlow(config_entries.ConfigFlow):
async def async_step_user(self, user_input=None):
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
return self.async_create_entry(title="", data={})
_LOGGER.error("Running async_create_entry")
return self.async_create_entry(title="Browser Mod", data={})

View File

@ -5,7 +5,7 @@
"dependencies": ["panel_custom", "websocket_api", "http", "frontend", "lovelace"],
"codeowners": [],
"requirements": [],
"version": "2.0.0b1",
"version": "2.0.0b2",
"iot_class": "local_push",
"config_flow": true
}

View File

@ -33,7 +33,10 @@ class BrowserSensor(BrowserModEntity, SensorEntity):
@property
def native_value(self):
return self._data.get("browser", {}).get(self.parameter, None)
val = self._data.get("browser", {}).get(self.parameter, None)
if len(str(val)) > 255:
val = str(val)[:250] + "..."
return val
@property
def device_class(self):

View File

@ -125,7 +125,7 @@ export const ConnectionMixin = (SuperClass) => {
get global_settings() {
const settings = {};
const global = this._data.settings ?? {};
const global = this._data?.settings ?? {};
for (const [k, v] of Object.entries(global)) {
if (v !== null) settings[k] = v;
}
@ -133,7 +133,7 @@ export const ConnectionMixin = (SuperClass) => {
}
get user_settings() {
const settings = {};
const user = this._data.user_settings[this.hass.user.id] ?? {};
const user = this._data?.user_settings?.[this.hass?.user?.id] ?? {};
for (const [k, v] of Object.entries(user)) {
if (v !== null) settings[k] = v;
}
@ -141,7 +141,7 @@ export const ConnectionMixin = (SuperClass) => {
}
get browser_settings() {
const settings = {};
const browser = this.browsers[this.browserID]?.settings ?? {};
const browser = this.browsers?.[this.browserID]?.settings ?? {};
for (const [k, v] of Object.entries(browser)) {
if (v !== null) settings[k] = v;
}

881
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,25 @@
{
"name": "browser_mod",
"private": true,
"version": "2.0.0b1",
"version": "2.0.0b2",
"description": "",
"scripts": {
"build": "rollup -c",
"watch": "rollup -c --watch",
"update-card-tools": "npm uninstall card-tools && npm install thomasloven/lovelace-card-tools"
"watch": "rollup -c --watch"
},
"keywords": [],
"author": "Thomas Lovén",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.17.9",
"@babel/core": "^7.18.9",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"lit": "^2.2.2",
"rollup": "^2.70.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"lit": "^2.2.8",
"rollup": "^2.77.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.6.3"
"rollup-plugin-typescript2": "^0.32.1",
"typescript": "^4.7.4"
},
"dependencies": {
"card-tools": "github:thomasloven/lovelace-card-tools"
}
"dependencies": {}
}