1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-14 14:48:18 +00:00

fixed loaded_integrations

plus linter changes
This commit is contained in:
gitolicious 2019-05-26 12:05:37 +00:00
parent f8c5528cc4
commit 926adb88c7
5 changed files with 11 additions and 10 deletions

View File

@ -200,7 +200,7 @@ CONF_LEVEL = 'level'
CONF_LG = 'lg'
CONF_LIBRARIES = 'libraries'
CONF_LIGHT = 'light'
CONF_LOADED_INTEGRATIONS = 'loaded_integration'
CONF_LOADED_INTEGRATIONS = 'loaded_integrations'
CONF_LOCAL = 'local'
CONF_LOGGER = 'logger'
CONF_LOGS = 'logs'

View File

@ -11,7 +11,7 @@ import re
from typing import Any, Dict, List # noqa
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.py_compat import IS_PY2, integer_types, text_type, string_types
from esphome.util import OrderedDict
@ -757,4 +757,4 @@ class EnumValue(object):
CORE = EsphomeCore()
ConfigType = Dict[str, Any]
CoreType = EsphomeCore
CoreType = EsphomeCore

View File

@ -431,10 +431,10 @@ class DashboardEntry(object):
return const.__version__
@property
def web_server_enabled(self):
def loaded_integrations(self):
if self.storage is None:
return False
return self.storage.web_server_enabled
return self.storage.loaded_integrations
class MainRequestHandler(BaseHandler):

View File

@ -67,7 +67,7 @@
<div class="card-content">
<span class="card-title">
{{ 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>
{% end %}
<i class="material-icons right dropdown-trigger" data-target="dropdown-{{ i }}">more_vert</i>

View File

@ -62,7 +62,7 @@ class StorageJSON(object):
# The absolute path to the firmware binary
self.firmware_bin_path = firmware_bin_path # type: str
# 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):
return {
@ -76,7 +76,8 @@ class StorageJSON(object):
'board': self.board,
'build_path': self.build_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):
@ -100,7 +101,7 @@ class StorageJSON(object):
board=esph.board,
build_path=esph.build_path,
firmware_bin_path=esph.firmware_bin,
loaded_integrations=list(sorted(esph.loaded_integrations)),
loaded_integrations=esph.loaded_integrations,
)
@staticmethod
@ -220,4 +221,4 @@ class EsphomeStorageJSON(object):
)
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()