Added your suggestions.
Looking at your code suggestion below I am not sure exactly how other people might want to put in lists. (But I am missing a more general overview of the code) ``` if not isinstance(scene_config,list): scene_config=[scene_config] ``` But it is there ! And changed "config" to "states" !
This commit is contained in:
parent
a8edcfd315
commit
0f6ec9b7ac
2 changed files with 7 additions and 3 deletions
|
@ -25,9 +25,13 @@ SceneConfig = namedtuple('SceneConfig', ['name', 'states'])
|
|||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up home assistant scene entries. """
|
||||
scene_config = config.get("config")
|
||||
scene_config = config.get("states")
|
||||
|
||||
add_devices([HomeAssistantScene(hass, _process_config(scene_config))])
|
||||
if not isinstance(scene_config, list):
|
||||
scene_config = [scene_config]
|
||||
|
||||
add_devices(HomeAssistantScene(hass, _process_config(scene))
|
||||
for scene in scene_config)
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue