Tweaks to options flow (#25969)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-08-15 14:11:55 -07:00
1 parent 9b3aa9bbd1
commit 8a1ab8c0b5
4 files changed
+28 -21

No files matched your search

@@ -187,8 +187,8 @@ class ConfigManagerAvailableFlowView(HomeAssistantView):
class OptionManagerFlowIndexView(FlowManagerIndexView):
"""View to create option flows."""
url = "/api/config/config_entries/entry/option/flow"
name = "api:config:config_entries:entry:resource:option:flow"
url = "/api/config/config_entries/options/flow"
name = "api:config:config_entries:option:flow"
# pylint: disable=arguments-differ
async def post(self, request):
+17 -1
View File
@@ -658,6 +658,12 @@ class ConfigFlow(data_entry_flow.FlowHandler):
CONNECTION_CLASS = CONN_CLASS_UNKNOWN
@staticmethod
@callback
def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
raise data_entry_flow.UnknownHandler
@callback
def _async_current_entries(self):
"""Return current entries."""
@@ -691,7 +697,11 @@ class OptionsFlowManager:
entry = self.hass.config_entries.async_get_entry(entry_id)
if entry is None:
return
flow = HANDLERS[entry.domain].async_get_options_flow(entry.data, entry.options)
if entry.domain not in HANDLERS:
raise data_entry_flow.UnknownHandler
flow = HANDLERS[entry.domain].async_get_options_flow(entry)
return flow
async def _async_finish_flow(self, flow, result):
@@ -706,3 +716,9 @@ class OptionsFlowManager:
result["result"] = True
return result
class OptionsFlow(data_entry_flow.FlowHandler):
"""Base class for config option flows."""
pass