- Notifications
You must be signed in to change notification settings - Fork36
Tags: henne49/dbus-opendtu
Tags
v2.0.0
📌 Pull Request: Refactor & Enhance dbus-opendtu (#227)* rename and refactor dbus-opendtu* add basic test wip* Refactor test_dbus-opendtu.py to remove unused mock_constants parameter in test_register_service method* since paths is used as constant I moved it* Refactor imports in dbus_opendtu.py* Refactor test_dbus-opendtu.py to remove unused mock_constants parameter in test_register_service method* Refactor code to remove unused paths* Refactor code to remove unused paths parameter in DbusService constructor* Refactor test_dbus-opendtu.py to use register_services instead of register_service* Refactor code to use register_services instead of register_service* Refactor code to use get_DbusServices instead of register_services* Refactor logging statement to use info level instead of critical* move code to add sign_of_life_all_services function and use it to send a 'sign of life' signal to all services* Refactor file paths to use underscore instead of hyphen in dbus_opendtu.py and restart.sh* remove dependency and move code the main function (update routine)* Add constants instead of hardcoded values* move tests in proper folder* move functions to helpers instead of constants; add unit tests and improve function* Add coverage configuration and script- Add .coveragerc file to control coverage.py and exclude certain directories from coverage analysis.- Add run_coverage.sh script to run unit tests with coverage and generate coverage report.* Refactor code and improve error handlingMove functions to helpers instead of constants, add unit tests, and improve function to handle cases where there are no inverters or templates to query. Also, remove the dependency on running tests within the main function.* Add more tests* Completed Coverage for dbus_opendtu.py: 96%* Refactor _get_serial method in dbus_service.py* Refactor _get_name and _get_status_url methods in dbus_service.py* wip working fetch* Change number of Inverters in ahoy_0.5.93_live.json* Added template and inverter tests* Move early fail condition to the right position* Refactored _read_config_dtu method and removed unreachable code- Removed unreachable code in the _read_config_dtu method.- Clarified the logic for reading the DTU variant and other configuration values.- Ensured that the DTU variant is either constants.DTUVARIANT_OPENDTU or constants.DTUVARIANT_AHOY, raising an error otherwise.- Improved readability and maintainability of the code.* adjust tests* Add test to verify that number_of_inverters are set- Added a new test case to verify that the number of inverters is correctly set in the DbusService.- Configured the test with a specific DTU variant and number of inverters.- Used mocking to simulate the configuration and requests.- Included assertions to validate the expected behavior.