From ef509b3fb6a176263a3d5604bec59163f733e783 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:23:36 +1300 Subject: [PATCH] Convert addon configs to yaml (#52) --- esphome-beta/config.json | 44 ---------------------------------------- esphome-beta/config.yaml | 37 +++++++++++++++++++++++++++++++++ esphome-dev/build.json | 7 ------- esphome-dev/build.yaml | 5 +++++ esphome-dev/config.json | 44 ---------------------------------------- esphome-dev/config.yaml | 37 +++++++++++++++++++++++++++++++++ esphome/config.json | 42 -------------------------------------- esphome/config.yaml | 35 ++++++++++++++++++++++++++++++++ script/generate.py | 11 ++++------ 9 files changed, 118 insertions(+), 144 deletions(-) delete mode 100644 esphome-beta/config.json create mode 100644 esphome-beta/config.yaml delete mode 100644 esphome-dev/build.json create mode 100644 esphome-dev/build.yaml delete mode 100644 esphome-dev/config.json create mode 100644 esphome-dev/config.yaml delete mode 100644 esphome/config.json create mode 100644 esphome/config.yaml diff --git a/esphome-beta/config.json b/esphome-beta/config.json deleted file mode 100644 index 408186b..0000000 --- a/esphome-beta/config.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "advanced": true, - "arch": [ - "amd64", - "armv7", - "aarch64" - ], - "auth_api": true, - "backup_exclude": [ - "*/*/" - ], - "description": "Beta version of ESPHome add-on", - "hassio_api": true, - "host_network": true, - "image": "ghcr.io/esphome/esphome-hassio-{arch}", - "ingress": true, - "ingress_port": 0, - "map": [ - "ssl:ro", - "config:rw" - ], - "name": "ESPHome (beta)", - "panel_icon": "mdi:chip", - "ports": { - "6052/tcp": null - }, - "ports_description": { - "6052/tcp": "Web interface (not required for Home Assistant ingress)" - }, - "schema": { - "certfile": "str?", - "keyfile": "str?", - "leave_front_door_open": "bool?", - "relative_url": "str?", - "ssl": "bool?", - "status_use_ping": "bool?", - "streamer_mode": "bool?" - }, - "slug": "esphome-beta", - "stage": "experimental", - "uart": true, - "url": "https://beta.esphome.io/", - "version": "2022.3.1" -} \ No newline at end of file diff --git a/esphome-beta/config.yaml b/esphome-beta/config.yaml new file mode 100644 index 0000000..ef7f6d7 --- /dev/null +++ b/esphome-beta/config.yaml @@ -0,0 +1,37 @@ +--- +advanced: true +arch: +- amd64 +- armv7 +- aarch64 +auth_api: true +backup_exclude: +- '*/*/' +description: Beta version of ESPHome add-on +hassio_api: true +host_network: true +image: ghcr.io/esphome/esphome-hassio-{arch} +ingress: true +ingress_port: 0 +map: +- ssl:ro +- config:rw +name: ESPHome (beta) +panel_icon: mdi:chip +ports: + 6052/tcp: null +ports_description: + 6052/tcp: Web interface (not required for Home Assistant ingress) +schema: + certfile: str? + keyfile: str? + leave_front_door_open: bool? + relative_url: str? + ssl: bool? + status_use_ping: bool? + streamer_mode: bool? +slug: esphome-beta +stage: experimental +uart: true +url: https://beta.esphome.io/ +version: 2022.3.1 diff --git a/esphome-dev/build.json b/esphome-dev/build.json deleted file mode 100644 index 461237f..0000000 --- a/esphome-dev/build.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "build_from": { - "aarch64": "ghcr.io/esphome/esphome-hassio-aarch64:dev", - "amd64": "ghcr.io/esphome/esphome-hassio-amd64:dev", - "armv7": "ghcr.io/esphome/esphome-hassio-armv7:dev" - } -} \ No newline at end of file diff --git a/esphome-dev/build.yaml b/esphome-dev/build.yaml new file mode 100644 index 0000000..349204e --- /dev/null +++ b/esphome-dev/build.yaml @@ -0,0 +1,5 @@ +--- +build_from: + aarch64: ghcr.io/esphome/esphome-hassio-aarch64:dev + amd64: ghcr.io/esphome/esphome-hassio-amd64:dev + armv7: ghcr.io/esphome/esphome-hassio-armv7:dev diff --git a/esphome-dev/config.json b/esphome-dev/config.json deleted file mode 100644 index 80057a0..0000000 --- a/esphome-dev/config.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "advanced": true, - "arch": [ - "amd64", - "armv7", - "aarch64" - ], - "auth_api": true, - "backup_exclude": [ - "*/*/" - ], - "description": "Development version of ESPHome add-on", - "hassio_api": true, - "host_network": true, - "ingress": true, - "ingress_port": 0, - "map": [ - "ssl:ro", - "config:rw" - ], - "name": "ESPHome (dev)", - "panel_icon": "mdi:chip", - "ports": { - "6052/tcp": null - }, - "ports_description": { - "6052/tcp": "Web interface (not required for Home Assistant ingress)" - }, - "schema": { - "certfile": "str?", - "esphome_fork": "str?", - "keyfile": "str?", - "leave_front_door_open": "bool?", - "relative_url": "str?", - "ssl": "bool?", - "status_use_ping": "bool?", - "streamer_mode": "bool?" - }, - "slug": "esphome-dev", - "stage": "experimental", - "uart": true, - "url": "https://next.esphome.io/", - "version": "dev" -} \ No newline at end of file diff --git a/esphome-dev/config.yaml b/esphome-dev/config.yaml new file mode 100644 index 0000000..082db45 --- /dev/null +++ b/esphome-dev/config.yaml @@ -0,0 +1,37 @@ +--- +advanced: true +arch: +- amd64 +- armv7 +- aarch64 +auth_api: true +backup_exclude: +- '*/*/' +description: Development version of ESPHome add-on +hassio_api: true +host_network: true +ingress: true +ingress_port: 0 +map: +- ssl:ro +- config:rw +name: ESPHome (dev) +panel_icon: mdi:chip +ports: + 6052/tcp: null +ports_description: + 6052/tcp: Web interface (not required for Home Assistant ingress) +schema: + certfile: str? + esphome_fork: str? + keyfile: str? + leave_front_door_open: bool? + relative_url: str? + ssl: bool? + status_use_ping: bool? + streamer_mode: bool? +slug: esphome-dev +stage: experimental +uart: true +url: https://next.esphome.io/ +version: dev diff --git a/esphome/config.json b/esphome/config.json deleted file mode 100644 index 03f65fd..0000000 --- a/esphome/config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "arch": [ - "amd64", - "armv7", - "aarch64" - ], - "auth_api": true, - "backup_exclude": [ - "*/*/" - ], - "description": "ESPHome add-on for intelligently managing all your ESP8266/ESP32 devices", - "hassio_api": true, - "host_network": true, - "image": "ghcr.io/esphome/esphome-hassio-{arch}", - "ingress": true, - "ingress_port": 0, - "map": [ - "ssl:ro", - "config:rw" - ], - "name": "ESPHome", - "panel_icon": "mdi:chip", - "ports": { - "6052/tcp": null - }, - "ports_description": { - "6052/tcp": "Web interface (not required for Home Assistant ingress)" - }, - "schema": { - "certfile": "str?", - "keyfile": "str?", - "leave_front_door_open": "bool?", - "relative_url": "str?", - "ssl": "bool?", - "status_use_ping": "bool?", - "streamer_mode": "bool?" - }, - "slug": "esphome", - "uart": true, - "url": "https://esphome.io/", - "version": "2022.3.1" -} \ No newline at end of file diff --git a/esphome/config.yaml b/esphome/config.yaml new file mode 100644 index 0000000..3b34d13 --- /dev/null +++ b/esphome/config.yaml @@ -0,0 +1,35 @@ +--- +arch: +- amd64 +- armv7 +- aarch64 +auth_api: true +backup_exclude: +- '*/*/' +description: ESPHome add-on for intelligently managing all your ESP8266/ESP32 devices +hassio_api: true +host_network: true +image: ghcr.io/esphome/esphome-hassio-{arch} +ingress: true +ingress_port: 0 +map: +- ssl:ro +- config:rw +name: ESPHome +panel_icon: mdi:chip +ports: + 6052/tcp: null +ports_description: + 6052/tcp: Web interface (not required for Home Assistant ingress) +schema: + certfile: str? + keyfile: str? + leave_front_door_open: bool? + relative_url: str? + ssl: bool? + status_use_ping: bool? + streamer_mode: bool? +slug: esphome +uart: true +url: https://esphome.io/ +version: 2022.3.1 diff --git a/script/generate.py b/script/generate.py index 90b6b38..bc232b1 100755 --- a/script/generate.py +++ b/script/generate.py @@ -4,7 +4,6 @@ import argparse import yaml from pathlib import Path from enum import Enum -import json from shutil import copyfile import sys @@ -34,9 +33,9 @@ def main(args): conf = config[f"esphome-{channel.value}"] base_image = conf.pop("base_image", None) dir_ = root / conf.pop("directory") - path = dir_ / "config.json" + path = dir_ / "config.yaml" with open(path, "w") as f: - json.dump(conf, f, indent=2, sort_keys=True) + yaml.dump(conf, f, indent=2, sort_keys=True, explicit_start=True) for file_, conf_ in copyf.items(): if Path.exists(templ / channel.value / file_): @@ -49,16 +48,14 @@ def main(args): f.write("Any edits should be made to the files in the 'template' directory") if channel == Channel.dev: - path = dir_ / "build.json" + path = dir_ / "build.yaml" build_conf = { "build_from": { arch: base_image.format(arch=arch) for arch in conf["arch"] } } with open(path, "w") as f: - json.dump(build_conf, f, indent=2, sort_keys=True) - - print(f"Wrote {path}") + yaml.dump(build_conf, f, indent=2, sort_keys=True, explicit_start=True) if __name__ == "__main__":