Skip to content

Commit

Permalink
export checks can be ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Sep 24, 2024
1 parent 1c93d2a commit 365d74c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Fixed send message for fired gateways
* Improved writing sender ids into actuators for EEP F6-02-01/02
* Added List for supported devices.
* Configuration Checks which are made before generating Home Assistant Configuration can be ignored.

## v0.1.33 Added Supported Device View
* Improved template selection in Details View.
Expand Down
8 changes: 6 additions & 2 deletions eo_man/data/ha_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ def get_gateway_by(self, gw_d:Device) -> GatewayDeviceType:
return t.value
return None

def perform_tests(self):
def perform_tests(self) -> str:
device_list = [d for d in self.data_manager.devices.values() if not d.is_gateway() and d.use_in_ha]

self.test_unique_sender_ids(device_list)
try:
self.test_unique_sender_ids(device_list)
return None
except Exception as e:
return str(e)

def test_unique_sender_ids(self, device_list:list[Device]):
sender_ids = {}
Expand Down
7 changes: 6 additions & 1 deletion eo_man/view/menu_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,12 @@ def export_ha_config(self, save_as:bool=False):
self.app_bus.fire_event(AppBusEventType.LOG_MESSAGE, {'msg': msg, 'color': 'red', 'log-level': 'INFO'})


self.ha_conf_gen.perform_tests()
error = self.ha_conf_gen.perform_tests()
if error is not None:
self.app_bus.fire_event(AppBusEventType.LOG_MESSAGE, {'msg': error, 'log-level': 'ERROR', 'color': 'red'})
if not messagebox.askyesno(title="Error in Checking Configuration Data!", message=error+"\n\nDo you want to try to continue?"):
self.app_bus.fire_event(AppBusEventType.LOG_MESSAGE, {'msg': 'Exporting HA Configuration cancelled by user.', 'log-level': 'INFO'})
return

self.ha_conf_gen.save_as_yaml_to_file(self.remember_latest_ha_config_filename)

Expand Down

0 comments on commit 365d74c

Please sign in to comment.