File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
custom_components/lock_code_manager Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -91,12 +91,24 @@ async def async_setup(hass: HomeAssistant, config: Config) -> bool:
91
91
if data [CONF_URL ] == STRATEGY_PATH
92
92
)
93
93
except StopIteration :
94
- # Register strategy module
95
- data = await resources .async_create_item (
96
- {CONF_RESOURCE_TYPE_WS : "module" , CONF_URL : STRATEGY_PATH }
97
- )
98
- _LOGGER .debug ("Registered strategy module (resource ID %s)" , data [CONF_ID ])
99
- hass .data [DOMAIN ]["resources" ] = True
94
+ if isinstance (resources , ResourceYAMLCollection ):
95
+ _LOGGER .warning (
96
+ "Strategy module can't automatically be registered because this "
97
+ "Home Assistant instance is running in YAML mode for resources. "
98
+ "Please add a new entry in the list under the resources key in "
99
+ "the lovelace section of your config as follows:\n - url: %s"
100
+ "\n type: module" ,
101
+ STRATEGY_PATH ,
102
+ )
103
+ else :
104
+ # Register strategy module
105
+ data = await resources .async_create_item (
106
+ {CONF_RESOURCE_TYPE_WS : "module" , CONF_URL : STRATEGY_PATH }
107
+ )
108
+ _LOGGER .debug (
109
+ "Registered strategy module (resource ID %s)" , data [CONF_ID ]
110
+ )
111
+ hass .data [DOMAIN ]["resources" ] = True
100
112
else :
101
113
_LOGGER .debug (
102
114
"Strategy module already registered with resource ID %s" , res_id
You can’t perform that action at this time.
0 commit comments