mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +00:00
fixed loaded_integrations
plus linter changes
This commit is contained in:
parent
f8c5528cc4
commit
926adb88c7
@ -200,7 +200,7 @@ CONF_LEVEL = 'level'
|
|||||||
CONF_LG = 'lg'
|
CONF_LG = 'lg'
|
||||||
CONF_LIBRARIES = 'libraries'
|
CONF_LIBRARIES = 'libraries'
|
||||||
CONF_LIGHT = 'light'
|
CONF_LIGHT = 'light'
|
||||||
CONF_LOADED_INTEGRATIONS = 'loaded_integration'
|
CONF_LOADED_INTEGRATIONS = 'loaded_integrations'
|
||||||
CONF_LOCAL = 'local'
|
CONF_LOCAL = 'local'
|
||||||
CONF_LOGGER = 'logger'
|
CONF_LOGGER = 'logger'
|
||||||
CONF_LOGS = 'logs'
|
CONF_LOGS = 'logs'
|
||||||
|
@ -11,7 +11,7 @@ import re
|
|||||||
from typing import Any, Dict, List # noqa
|
from typing import Any, Dict, List # noqa
|
||||||
|
|
||||||
from esphome.const import CONF_ARDUINO_VERSION, CONF_ESPHOME, CONF_USE_ADDRESS, CONF_WIFI, \
|
from esphome.const import CONF_ARDUINO_VERSION, CONF_ESPHOME, CONF_USE_ADDRESS, CONF_WIFI, \
|
||||||
SOURCE_FILE_EXTENSIONS, CONF_LOADED_INTEGRATIONS
|
SOURCE_FILE_EXTENSIONS
|
||||||
from esphome.helpers import ensure_unique_string, is_hassio
|
from esphome.helpers import ensure_unique_string, is_hassio
|
||||||
from esphome.py_compat import IS_PY2, integer_types, text_type, string_types
|
from esphome.py_compat import IS_PY2, integer_types, text_type, string_types
|
||||||
from esphome.util import OrderedDict
|
from esphome.util import OrderedDict
|
||||||
@ -757,4 +757,4 @@ class EnumValue(object):
|
|||||||
CORE = EsphomeCore()
|
CORE = EsphomeCore()
|
||||||
|
|
||||||
ConfigType = Dict[str, Any]
|
ConfigType = Dict[str, Any]
|
||||||
CoreType = EsphomeCore
|
CoreType = EsphomeCore
|
||||||
|
@ -431,10 +431,10 @@ class DashboardEntry(object):
|
|||||||
return const.__version__
|
return const.__version__
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def web_server_enabled(self):
|
def loaded_integrations(self):
|
||||||
if self.storage is None:
|
if self.storage is None:
|
||||||
return False
|
return False
|
||||||
return self.storage.web_server_enabled
|
return self.storage.loaded_integrations
|
||||||
|
|
||||||
|
|
||||||
class MainRequestHandler(BaseHandler):
|
class MainRequestHandler(BaseHandler):
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<span class="card-title">
|
<span class="card-title">
|
||||||
{{ escape(entry.name) }}
|
{{ escape(entry.name) }}
|
||||||
{% if entry.web_server_enabled %}
|
{% if entry.loaded_integrations and 'web_server' in entry.loaded_integrations %}
|
||||||
<a href="http://{{ escape(entry.address) }}" target="_blank"><i class="material-icons icon-grey">launch</i></a>
|
<a href="http://{{ escape(entry.address) }}" target="_blank"><i class="material-icons icon-grey">launch</i></a>
|
||||||
{% end %}
|
{% end %}
|
||||||
<i class="material-icons right dropdown-trigger" data-target="dropdown-{{ i }}">more_vert</i>
|
<i class="material-icons right dropdown-trigger" data-target="dropdown-{{ i }}">more_vert</i>
|
||||||
|
@ -62,7 +62,7 @@ class StorageJSON(object):
|
|||||||
# The absolute path to the firmware binary
|
# The absolute path to the firmware binary
|
||||||
self.firmware_bin_path = firmware_bin_path # type: str
|
self.firmware_bin_path = firmware_bin_path # type: str
|
||||||
# A list of strings of names of loaded integrations
|
# A list of strings of names of loaded integrations
|
||||||
self.loaded_integrations = loaded_integrations # type: list[str]
|
self.loaded_integrations = loaded_integrations # type: set[str]
|
||||||
|
|
||||||
def as_dict(self):
|
def as_dict(self):
|
||||||
return {
|
return {
|
||||||
@ -76,7 +76,8 @@ class StorageJSON(object):
|
|||||||
'board': self.board,
|
'board': self.board,
|
||||||
'build_path': self.build_path,
|
'build_path': self.build_path,
|
||||||
'firmware_bin_path': self.firmware_bin_path,
|
'firmware_bin_path': self.firmware_bin_path,
|
||||||
'loaded_integrations ': self.loaded_integrations,
|
'loaded_integrations':
|
||||||
|
sorted(self.loaded_integrations) if self.loaded_integrations is not None else [],
|
||||||
}
|
}
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
@ -100,7 +101,7 @@ class StorageJSON(object):
|
|||||||
board=esph.board,
|
board=esph.board,
|
||||||
build_path=esph.build_path,
|
build_path=esph.build_path,
|
||||||
firmware_bin_path=esph.firmware_bin,
|
firmware_bin_path=esph.firmware_bin,
|
||||||
loaded_integrations=list(sorted(esph.loaded_integrations)),
|
loaded_integrations=esph.loaded_integrations,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -220,4 +221,4 @@ class EsphomeStorageJSON(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def __eq__(self, o): # type: (Any) -> bool
|
def __eq__(self, o): # type: (Any) -> bool
|
||||||
return isinstance(o, EsphomeStorageJSON) and self.as_dict() == o.as_dict()
|
return isinstance(o, EsphomeStorageJSON) and self.as_dict() == o.as_dict()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user