mirror of
https://github.com/junkfix/config-editor.git
synced 2025-09-07 18:11:30 +02:00
Merge pull request #23 from junkfix/junkfix-patch-1
UI setup and version hiding
This commit is contained in:
commit
9e30ae34c1
|
@ -10,9 +10,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass, config):
|
||||||
websocket_api.async_register_command(hass, websocket_create)
|
websocket_api.async_register_command(hass, websocket_create)
|
||||||
hass.states.async_set(DOMAIN+".version", 4)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
async def async_setup_entry(hass, entry):
|
||||||
|
websocket_api.async_register_command(hass, websocket_create)
|
||||||
|
return True
|
||||||
|
|
||||||
@websocket_api.require_admin
|
@websocket_api.require_admin
|
||||||
@websocket_api.async_response
|
@websocket_api.async_response
|
||||||
|
@ -29,6 +31,7 @@ async def async_setup(hass, config):
|
||||||
async def websocket_create(hass, connection, msg):
|
async def websocket_create(hass, connection, msg):
|
||||||
action = msg["action"]
|
action = msg["action"]
|
||||||
ext = msg["ext"]
|
ext = msg["ext"]
|
||||||
|
cver = 5
|
||||||
if ext not in ["yaml","py","json","conf","js","txt","log","css","jinja","all"]:
|
if ext not in ["yaml","py","json","conf","js","txt","log","css","jinja","all"]:
|
||||||
ext = "yaml"
|
ext = "yaml"
|
||||||
|
|
||||||
|
@ -76,7 +79,7 @@ async def websocket_create(hass, connection, msg):
|
||||||
finally:
|
finally:
|
||||||
connection.send_result(
|
connection.send_result(
|
||||||
msg["id"],
|
msg["id"],
|
||||||
{'msg': res+': '+fullpath, 'file': yamlname, 'data': content, 'ext': ext}
|
{'msg': res+': '+fullpath, 'file': yamlname, 'data': content, 'ext': ext, 'cver': cver}
|
||||||
)
|
)
|
||||||
|
|
||||||
elif (action == 'save'):
|
elif (action == 'save'):
|
||||||
|
@ -131,5 +134,5 @@ async def websocket_create(hass, connection, msg):
|
||||||
listyaml = ['list_error.'+ext]
|
listyaml = ['list_error.'+ext]
|
||||||
connection.send_result(
|
connection.send_result(
|
||||||
msg["id"],
|
msg["id"],
|
||||||
{'msg': str(len(listyaml))+' File(s)', 'file': listyaml, 'ext': ext}
|
{'msg': str(len(listyaml))+' File(s)', 'file': listyaml, 'ext': ext, 'cver': cver}
|
||||||
)
|
)
|
||||||
|
|
5
custom_components/config_editor/config_flow.py
Normal file
5
custom_components/config_editor/config_flow.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from homeassistant.helpers import config_entry_flow
|
||||||
|
|
||||||
|
config_entry_flow.register_discovery_flow(
|
||||||
|
"config_editor", "Config Editor", lambda hass: True
|
||||||
|
)
|
|
@ -2,8 +2,9 @@
|
||||||
"domain": "config_editor",
|
"domain": "config_editor",
|
||||||
"name": "Config Editor",
|
"name": "Config Editor",
|
||||||
"codeowners": ["@junkfix"],
|
"codeowners": ["@junkfix"],
|
||||||
|
"config_flow": true,
|
||||||
"documentation": "https://github.com/junkfix/config-editor-card",
|
"documentation": "https://github.com/junkfix/config-editor-card",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"issue_tracker": "https://github.com/junkfix/config-editor/issues",
|
"issue_tracker": "https://github.com/junkfix/config-editor/issues",
|
||||||
"version": "4.4.2"
|
"version": "5.0.0"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue