mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
Add version api endpoint (#4429)
This commit is contained in:
parent
78e18256f7
commit
0f1ec515c1
1 changed files with 9 additions and 0 deletions
|
@ -545,6 +545,14 @@ class DownloadBinaryRequestHandler(BaseHandler):
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
|
|
||||||
|
class EsphomeVersionHandler(BaseHandler):
|
||||||
|
@authenticated
|
||||||
|
def get(self):
|
||||||
|
self.set_header("Content-Type", "application/json")
|
||||||
|
self.write(json.dumps({"version": const.__version__}))
|
||||||
|
self.finish()
|
||||||
|
|
||||||
|
|
||||||
def _list_dashboard_entries():
|
def _list_dashboard_entries():
|
||||||
files = settings.list_yaml_files()
|
files = settings.list_yaml_files()
|
||||||
return [DashboardEntry(file) for file in files]
|
return [DashboardEntry(file) for file in files]
|
||||||
|
@ -1135,6 +1143,7 @@ def make_app(debug=get_bool_env(ENV_DEV)):
|
||||||
(f"{rel}rename", EsphomeRenameHandler),
|
(f"{rel}rename", EsphomeRenameHandler),
|
||||||
(f"{rel}prometheus-sd", PrometheusServiceDiscoveryHandler),
|
(f"{rel}prometheus-sd", PrometheusServiceDiscoveryHandler),
|
||||||
(f"{rel}boards/([a-z0-9]+)", BoardsRequestHandler),
|
(f"{rel}boards/([a-z0-9]+)", BoardsRequestHandler),
|
||||||
|
(f"{rel}version", EsphomeVersionHandler),
|
||||||
],
|
],
|
||||||
**app_settings,
|
**app_settings,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue