Skip to content

Commit

Permalink
improved comment, split function
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyleta committed Mar 24, 2024
1 parent b4be14d commit 92a0cfb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ebusd-configuration-en/3c.Excellent300.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## sources:
## - Original idea and some dividers: https://github.com/dstrigl/ebusd-config-brink-renovent-excellent-300
## - Brink Service Tool (decompiled via Jetbrains DotPeak): https://www.brinkclimatesystems.nl/tools/software-brink-service-tool-en
## - Renovent 180 Datasheet: https://www.rosain.cz/dokumenty/Technicky-list-Renovent-Excellent-180.pdf
## - Renovent 150 Datasheet: https://manuals.plus/brink/renovent-sky-150-plus-mechanical-ventilation-with-heat-recovery-manual
## - Modbus Module Datasheet: https://www.brinkclimatesystems.nl/documenten/modbus-uwa2-b-uwa2-e-installation-regulations-614882.pdf

## COMMON HRU COMMANDS ## (WTWCommands.cs)
Expand Down
2 changes: 1 addition & 1 deletion ebusd-configuration-en/3c.Sky300.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## sources:
## - Original idea and some dividers: https://github.com/dstrigl/ebusd-config-brink-renovent-excellent-300
## - Brink Service Tool (decompiled via Jetbrains DotPeak): https://www.brinkclimatesystems.nl/tools/software-brink-service-tool-en
## - Renovent 180 Datasheet: https://www.rosain.cz/dokumenty/Technicky-list-Renovent-Excellent-180.pdf
## - Renovent 150 Datasheet: https://manuals.plus/brink/renovent-sky-150-plus-mechanical-ventilation-with-heat-recovery-manual
## - Modbus Module Datasheet: https://www.brinkclimatesystems.nl/documenten/modbus-uwa2-b-uwa2-e-installation-regulations-614882.pdf

## COMMON HRU COMMANDS ## (WTWCommands.cs)
Expand Down
2 changes: 1 addition & 1 deletion ebusd-configuration-en/7c.Excellent400.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## sources:
## - Original idea and some dividers: https://github.com/dstrigl/ebusd-config-brink-renovent-excellent-300
## - Brink Service Tool (decompiled via Jetbrains DotPeak): https://www.brinkclimatesystems.nl/tools/software-brink-service-tool-en
## - Renovent 180 Datasheet: https://www.rosain.cz/dokumenty/Technicky-list-Renovent-Excellent-180.pdf
## - Renovent 150 Datasheet: https://manuals.plus/brink/renovent-sky-150-plus-mechanical-ventilation-with-heat-recovery-manual
## - Modbus Module Datasheet: https://www.brinkclimatesystems.nl/documenten/modbus-uwa2-b-uwa2-e-installation-regulations-614882.pdf

## COMMON HRU COMMANDS ## (WTWCommands.cs)
Expand Down
3 changes: 2 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from out import write_output
from out import write_output, write_known_devices
from converters import find_converters, device_to_name_current_to_name_param, converters_map
from sensor import get_dict_devices_sensor
from parameter import get_device_parameters
Expand Down Expand Up @@ -82,5 +82,6 @@
print("sensors_without_converters_set: " + str(len(sensors_without_converters_set)))

write_output(dict_devices_sensor, dict_devices_parameters)
write_known_devices(dict_devices_sensor, dict_devices_parameters)

print("SUCCESS")
23 changes: 14 additions & 9 deletions src/out.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ def get_latest_sw_for_device(device_name: str, devices: list[DeviceVersion]):
return device
return None


def write_known_devices(dict_devices_sensor: dict[DeviceVersion, list[Sensor]], dict_devices_parameter: dict[DeviceParameters, list[Parameter]]):
if os.path.exists(KNOWN_DEVICES_EN_DIR):
shutil.rmtree(KNOWN_DEVICES_EN_DIR)
os.mkdir(KNOWN_DEVICES_EN_DIR)
for known_device in known_devices:
with open(os.path.join(KNOWN_DEVICES_EN_DIR, f'{known_device.slave_address:02x}.{known_device.device_name}.csv'), "w", encoding="utf-8") as text_file:
latest_device_sensors = get_latest_sw_for_device(known_device.device_name, list(dict_devices_sensor.keys()))
latest_device_params = get_latest_sw_for_device(known_device.device_name, list(dict_devices_parameter.keys()))
text_file.write(CSV_HEADER)
text_file.write(csv_known_device(dict_devices_sensor[latest_device_sensors], known_device.device_name, dict_devices_parameter[latest_device_params], True, f'{known_device.slave_address:02x}'))


# Contents of output_dir are always cleaned before writing
# File format is [device_name].[lowest_sw_version].[highest_sw_version].[params|sensors.basic|sensors.plus].csv
def write_output(dict_devices_sensor: dict[DeviceVersion, list[Sensor]], dict_devices_parameter: dict[DeviceParameters, list[Parameter]]):
Expand All @@ -173,15 +186,7 @@ def write_output(dict_devices_sensor: dict[DeviceVersion, list[Sensor]], dict_de
text_file.write(CSV_HEADER)
text_file.write(csv_from_parameters(parameters, device_param.device_name, True))

if os.path.exists(KNOWN_DEVICES_EN_DIR):
shutil.rmtree(KNOWN_DEVICES_EN_DIR)
os.mkdir(KNOWN_DEVICES_EN_DIR)
for known_device in known_devices:
with open(os.path.join(KNOWN_DEVICES_EN_DIR, f'{known_device.slave_address:02x}.{known_device.device_name}.csv'), "w", encoding="utf-8") as text_file:
latest_device_sensors = get_latest_sw_for_device(known_device.device_name, list(dict_devices_sensor.keys()))
latest_device_params = get_latest_sw_for_device(known_device.device_name, list(dict_devices_parameter.keys()))
text_file.write(CSV_HEADER)
text_file.write(csv_known_device(dict_devices_sensor[latest_device_sensors], known_device.device_name, dict_devices_parameter[latest_device_params], True, f'{known_device.slave_address:02x}'))


if os.path.exists(DUMP_DIR):
shutil.rmtree(DUMP_DIR)
Expand Down

0 comments on commit 92a0cfb

Please sign in to comment.