cli: correctly set up register settings for config
This commit is contained in:
parent
cba5368dad
commit
693db1d541
|
@ -1222,8 +1222,8 @@ def check_feature_settings(device, already_known):
|
||||||
|
|
||||||
|
|
||||||
def check_feature_setting(device, setting_name):
|
def check_feature_setting(device, setting_name):
|
||||||
for setting in SETTINGS:
|
for sclass in SETTINGS:
|
||||||
if setting.name == setting_name:
|
if sclass.feature and sclass.name == setting_name and device.features:
|
||||||
feature = check_feature(device, setting)
|
setting = check_feature(device, sclass)
|
||||||
if feature:
|
if setting:
|
||||||
return feature
|
return setting
|
||||||
|
|
|
@ -172,9 +172,15 @@ def run(receivers, args, find_receiver, find_device):
|
||||||
|
|
||||||
setting_name = args.setting.lower()
|
setting_name = args.setting.lower()
|
||||||
setting = _settings_templates.check_feature_setting(dev, setting_name)
|
setting = _settings_templates.check_feature_setting(dev, setting_name)
|
||||||
|
if not setting and dev.descriptor and dev.descriptor.settings:
|
||||||
|
for sclass in dev.descriptor.settings:
|
||||||
|
if sclass.register and sclass.name == setting_name:
|
||||||
|
try:
|
||||||
|
setting = sclass.build(dev)
|
||||||
|
except Exception:
|
||||||
|
setting = None
|
||||||
if setting is None:
|
if setting is None:
|
||||||
raise Exception("no setting '%s' for %s" % (args.setting, dev.name))
|
raise Exception("no setting '%s' for %s" % (args.setting, dev.name))
|
||||||
_configuration.attach_to(dev)
|
|
||||||
|
|
||||||
if args.value_key is None:
|
if args.value_key is None:
|
||||||
setting.apply()
|
setting.apply()
|
||||||
|
|
Loading…
Reference in New Issue