Ingress panel support (#1047)

* Ingress Panel support

* Fix lists

* Allow to set the value

* fix panels

* Update ha realtime

* Fix url

* Fix update
This commit is contained in:
Pascal Vizeli
2019-04-23 11:18:04 +02:00
committed by GitHub
parent e10fe16f21
commit decf254e5f
8 changed files with 121 additions and 7 deletions

View File

@@ -47,6 +47,10 @@ from ..const import (
ATTR_INGRESS_ENTRY,
ATTR_INGRESS_PORT,
ATTR_INGRESS_TOKEN,
ATTR_INGRESS_PANEL,
ATTR_INGRESS_PANEL_ADMIN,
ATTR_INGRESS_PANEL_ICON,
ATTR_INGRESS_PANEL_TITLE,
ATTR_KERNEL_MODULES,
ATTR_LEGACY,
ATTR_LOCATON,
@@ -449,6 +453,21 @@ class Addon(CoreSysAttributes):
return self.sys_ingress.get_dynamic_port(self.slug)
return port
@property
def ingress_icon(self) -> str:
"""Return panel icon for Ingress frame."""
return self._mesh[ATTR_INGRESS_PANEL_ICON]
@property
def ingress_title(self) -> str:
"""Return panel icon for Ingress frame."""
return self._mesh.get(ATTR_INGRESS_PANEL_TITLE, self.name)
@property
def ingress_admin(self) -> str:
"""Return panel icon for Ingress frame."""
return self._mesh[ATTR_INGRESS_PANEL_ADMIN]
@property
def host_network(self):
"""Return True if add-on run on host network."""
@@ -538,6 +557,18 @@ class Addon(CoreSysAttributes):
"""Return True if the add-on access support ingress."""
return self._mesh[ATTR_INGRESS]
@property
def ingress_panel(self) -> Optional[bool]:
"""Return True if the add-on access support ingress."""
if self.is_installed:
return self._data.user[self._id][ATTR_INGRESS_PANEL]
return None
@ingress_panel.setter
def ingress_panel(self, value: bool):
"""Return True if the add-on access support ingress."""
self._data.user[self._id][ATTR_INGRESS_PANEL] = value
@property
def with_gpio(self):
"""Return True if the add-on access to GPIO interface."""