Config update

This commit is contained in:
Martin Bauer
2019-06-11 19:28:39 +02:00
parent 4f3c9abd0d
commit fab83c86f4
9 changed files with 157 additions and 297 deletions

View File

@@ -19,14 +19,14 @@ def extent(result_dict, input_dict, platform):
result_dict[k] += v
def name_to_id(name):
return slugify.slugify(name, separator='_')
def name_to_id(name, device_type):
return "{}.{}".format(device_type, slugify.slugify(name, separator='_'))
def add_to_group(groups_dict, device_groups, device_name):
def add_to_group(groups_dict, device_groups, device_name, device_type):
for group in device_groups:
if group not in groups_dict:
raise ValueError(f"FHEM device {device_name} wants to be added to unknown group {group}")
if 'entities' not in groups_dict[group]:
groups_dict[group]['entities'] = []
groups_dict[group]['entities'].append(name_to_id(device_name))
groups_dict[group]['entities'].append(name_to_id(device_name, device_type))