1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 20:02:22 +01:00

Device description in dashboard (#707)

* Description

* Review fixes

* Test

* Label

* Description renamed to comment
This commit is contained in:
Nikolay Vasilchuk
2019-10-14 12:27:07 +03:00
committed by Otto Winter
parent 0eadda77b0
commit be91cfb261
8 changed files with 40 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ def trash_storage_path(base_path): # type: (str) -> str
# pylint: disable=too-many-instance-attributes
class StorageJSON(object):
def __init__(self, storage_version, name, esphome_version,
def __init__(self, storage_version, name, comment, esphome_version,
src_version, arduino_version, address, esp_platform, board, build_path,
firmware_bin_path, loaded_integrations):
# Version of the storage JSON schema
@@ -43,6 +43,8 @@ class StorageJSON(object):
self.storage_version = storage_version # type: int
# The name of the node
self.name = name # type: str
# The comment of the node
self.comment = comment # type: str
# The esphome version this was compiled with
self.esphome_version = esphome_version # type: str
# The version of the file in src/main.cpp - Used to migrate the file
@@ -69,6 +71,7 @@ class StorageJSON(object):
return {
'storage_version': self.storage_version,
'name': self.name,
'comment': self.comment,
'esphome_version': self.esphome_version,
'src_version': self.src_version,
'arduino_version': self.arduino_version,
@@ -93,6 +96,7 @@ class StorageJSON(object):
return StorageJSON(
storage_version=1,
name=esph.name,
comment=esph.comment,
esphome_version=const.__version__,
src_version=1,
arduino_version=esph.arduino_version,
@@ -110,6 +114,7 @@ class StorageJSON(object):
return StorageJSON(
storage_version=1,
name=name,
comment=None,
esphome_version=const.__version__,
src_version=1,
arduino_version=None,
@@ -128,6 +133,7 @@ class StorageJSON(object):
storage = json.loads(text, encoding='utf-8')
storage_version = storage['storage_version']
name = storage.get('name')
comment = storage.get('comment')
esphome_version = storage.get('esphome_version', storage.get('esphomeyaml_version'))
src_version = storage.get('src_version')
arduino_version = storage.get('arduino_version')
@@ -137,7 +143,7 @@ class StorageJSON(object):
build_path = storage.get('build_path')
firmware_bin_path = storage.get('firmware_bin_path')
loaded_integrations = storage.get('loaded_integrations', [])
return StorageJSON(storage_version, name, esphome_version,
return StorageJSON(storage_version, name, comment, esphome_version,
src_version, arduino_version, address, esp_platform, board, build_path,
firmware_bin_path, loaded_integrations)