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

@@ -46,10 +46,10 @@ def add_knx_devices(devices, groups):
]
scene_button_names = ['ObenLinks', 'ObenRechts', 'MitteLinks', 'MitteRechts', 'UntenLinks', 'UntenRechts']
scene_button_names = [(i, e) for i, e in enumerate(scene_button_names)]
switches += [DeviceInfo(f"SzeneEsszimmer{n}", "Esszimmer Szene {i}") for i, n in scene_button_names]
switches += [DeviceInfo(f"SzeneWohnzimmer{n}", "Wohnzimmer Szene {i}") for i, n in scene_button_names]
switches += [DeviceInfo(f"SzeneEingang{n}", "Eingang Szene {i}") for i, n in scene_button_names[2:]]
switches += [DeviceInfo(f"SzeneTerrassentuer{n}", "Wohnzimmer Terrassentür Szene {i}")
switches += [DeviceInfo(f"SzeneEsszimmer{n}", f"Esszimmer Szene {i}") for i, n in scene_button_names]
switches += [DeviceInfo(f"SzeneWohnzimmer{n}", f"Wohnzimmer Szene {i}") for i, n in scene_button_names]
switches += [DeviceInfo(f"SzeneEingang{n}", f"Eingang Szene {i}") for i, n in scene_button_names[2:]]
switches += [DeviceInfo(f"SzeneTerrassentuer{n}", f"Wohnzimmer Terrassentür Szene {i}")
for i, n in scene_button_names[2: 4]]
power_plugs = [
@@ -82,8 +82,9 @@ def add_knx_devices(devices, groups):
knx.extent(devices, knx.create_switches(switches, imported_csv))
knx.extent(devices, knx.create_power_plug(power_plugs, imported_csv))
for device in lights + shutters + switches + power_plugs:
add_to_group(groups, device.groups, device.display_name)
for device_type, devices in [('light', lights), ('cover', shutters), ('switch', switches)]:
for device in devices:
add_to_group(groups, device.groups, device.display_name, device_type)
def add_fhem_devices(devices, groups):
@@ -94,7 +95,7 @@ def add_fhem_devices(devices, groups):
for device in device_list:
device['platform'] = 'fhem'
if 'groups' in device:
add_to_group(groups, device['groups'], device['name'])
add_to_group(groups, device['groups'], device['name'], device_type)
del device['groups']
devices[device_type].append(device)
@@ -109,7 +110,7 @@ def main():
with open('output/configuration.yaml', 'w') as output:
output.write(open('manual_config.yaml', 'r').read())
yaml.dump(all_devices, output)
yaml.dump(group_dict, open('output/groups.yaml', 'a'))
yaml.dump(group_dict, open('output/groups.yaml', 'w'))
if __name__ == '__main__':