-
Notifications
You must be signed in to change notification settings - Fork 0
v1.2.0 #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement device actions to enable service calls through Home Assistant's automation UI. This allows users to trigger Divera operations (alarms, vehicle status, messages, etc.) directly from device-based automations without manually specifying service calls.
Changes:
- Add device_action.py with action definitions and capability schemas
* Implement async_get_actions with permission-based filtering
* Add async_call_action_from_config for service call delegation
* Implement async_get_action_capabilities with dynamic field generation
* Add _get_selector_options helper for coordinator data extraction
* Support multi-select dropdowns for groups, users, vehicles, statuses
* Add ObjectSelector for flexible YAML inputs (properties, survey data)
* Add DateTimeSelector for timestamp fields with auto-conversion
* Add NumberSelector with range validation for coordinates and IDs
- Update __init__.py
* Register device action platform on integration setup
* Add device action support to platform loading
- Update service.py
* Refactor service handlers to accept both list and string inputs
* Add normalize_to_comma_separated for multi-select handling
* Add get_coordinator_from_device_id utility function
* Update all service handlers for device action compatibility
* Add JSON parsing for flexible property inputs
* Add datetime-to-timestamp conversion for survey deadlines
- Update utils.py
* Add normalize_to_comma_separated utility function
* Add get_coordinator_from_device_id for device-to-coordinator mapping
* Enhance permission_check helper usage
- Update const.py
* Add device action type constants
* Add selector option constants
* Add permission mapping for action filtering
- Update manifest.json
* Declare device_action platform support
- Update divera_api.py
* Add missing API methods for device actions
* Enhance error handling for service calls
* Add support for all service parameters
- Update divera_data.py
* Add data models for device action responses
* Enhance coordinator data structure for selector population
- Update entity.py
* Add device info methods for device action integration
* Enhance entity-device relationships
- Update config_flow.py
* Add validation for device action parameters
* Enhance error handling for action setup
- Update calendar.py
* Minor adjustments for device action compatibility
- Update services.yaml
* Add comprehensive field descriptions for all services
* Add examples for complex parameters
* Document multi-select and YAML input fields
- Update translations (de.json, en.json)
* Add device action titles and descriptions
* Add field labels for all action parameters
* Add error messages for action validation
* Add help text for complex inputs (JSON, YAML, multi-select)
Changes to be committed:
modified: custom_components/diveracontrol/__init__.py
modified: custom_components/diveracontrol/calendar.py
modified: custom_components/diveracontrol/config_flow.py
modified: custom_components/diveracontrol/const.py
new file: custom_components/diveracontrol/device_action.py
modified: custom_components/diveracontrol/divera_api.py
modified: custom_components/diveracontrol/divera_data.py
modified: custom_components/diveracontrol/entity.py
modified: custom_components/diveracontrol/manifest.json
modified: custom_components/diveracontrol/service.py
modified: custom_components/diveracontrol/services.yaml
modified: custom_components/diveracontrol/translations/de.json
modified: custom_components/diveracontrol/translations/en.json
modified: custom_components/diveracontrol/utils.py
Changes to be committed:
modified: custom_components/diveracontrol/__init__.py
modified: custom_components/diveracontrol/calendar.py
modified: custom_components/diveracontrol/config_flow.py
modified: custom_components/diveracontrol/const.py
new file: custom_components/diveracontrol/device_action.py
modified: custom_components/diveracontrol/divera_api.py
modified: custom_components/diveracontrol/divera_data.py
modified: custom_components/diveracontrol/entity.py
modified: custom_components/diveracontrol/manifest.json
modified: custom_components/diveracontrol/service.py
modified: custom_components/diveracontrol/services.yaml
modified: custom_components/diveracontrol/translations/de.json
modified: custom_components/diveracontrol/translations/en.json
modified: custom_components/diveracontrol/utils.py
- Implement device actions for all major DiveraControl services, enabling automation UI support - Refactor service handlers for unified validation and translation-based error messages - Add dynamic selectors and schema generation in device_action.py for vehicles, alarms, groups, and properties - Update divera_api.py to support new service calls and error handling - Enhance config_flow.py for better validation and error reporting - Extend translations (de/en) with user-facing error messages and field labels for device actions - Update services.yaml with improved field descriptions and examples - Add utility functions for normalization and translation lookup in utils.py - Improve __init__.py to register device actions and support config entry setup Changes to be committed: modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/config_flow.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json modified: custom_components/diveracontrol/utils.py
- removed cluster_data and admin_data from coordinator - added translations of actions - changed overall translation handling - optimized device actions Changes to be committed: modified: custom_components/diveracontrol/calendar.py modified: custom_components/diveracontrol/config_flow.py modified: custom_components/diveracontrol/coordinator.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/device_tracker.py modified: custom_components/diveracontrol/diagnostics.py modified: custom_components/diveracontrol/divera_data.py modified: custom_components/diveracontrol/entity.py modified: custom_components/diveracontrol/sensor.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json modified: custom_components/diveracontrol/utils.py
Changes to be committed: modified: README.en.md modified: README.md
- improved error handling and logging - optimized permission checks - updated untility functions Changes to be committed: modified: README.en.md modified: README.md modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/divera_data.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/utils.py
bug: entity removal for device_tracker updated readme to be less specific to firefighters Changes to be committed: modified: custom_components/diveracontrol/device_tracker.py modified: custom_components/diveracontrol/entity.py modified: custom_components/diveracontrol/sensor.py modified: custom_components/diveracontrol/translations/en.json
- calendar: refactored update logic - device_tracker: improved state management - sensor: linted and optimized imports - __init__: added migration logic for v1.2.* Changes to be committed: modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/calendar.py modified: custom_components/diveracontrol/device_tracker.py modified: custom_components/diveracontrol/entity.py modified: custom_components/diveracontrol/sensor.py
- moved structure initialization to divera_data.py - fixed issue with empty calendar data (list instead of dict) - deleted individual listener management - minor code linting Changes to be committed: modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/calendar.py modified: custom_components/diveracontrol/config_flow.py modified: custom_components/diveracontrol/coordinator.py modified: custom_components/diveracontrol/divera_data.py
- changed position of parameters in some services for better usability - added selectors to actions in developer tools for better usability - added a normalizer module to refine service data - changed all services to use the normalizer - updated documentation - added crew to be safed in HA while updating Divera - removed unnecessary untility functions - added some german translations, mainly for services Changes to be committed: modified: README.en.md modified: README.md modified: custom_components/diveracontrol/coordinator.py new file: custom_components/diveracontrol/data_normalizer.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/device_tracker.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/sensor.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/utils.py
Changes to be committed: modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json
Changes to be committed: modified: custom_components/diveracontrol/data_normalizer.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json
Changes to be committed: modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json
Changes to be committed: modified: README.en.md modified: README.md
Major architectural improvements: - Introduce ConfigEntry.runtime_data for coordinator access - Split entity definitions into dedicated files by platform - Implement manager pattern for dynamic entity lifecycle Entity organization: - Create sensor_entity.py with sensor-specific classes - Create calendar_entity.py with calendar entity - Create device_tracker_entity.py with tracker classes - Keep only BaseDiveraEntity in entity.py Platform improvements: - Simplify platform setup files (sensor.py, calendar.py, device_tracker.py) - Move dynamic entity management to manager classes - Remove manual listener registration from platform files - Use CoordinatorEntity pattern consistently API enhancements: - Improve error handling in divera_api.py - Add centralized permission checking - Implement response validation helper - Better type hints and docstrings Code quality: - Remove redundant coordinator storage in hass.data - Implement proper async patterns - Add template rendering support in device_action.py - Improve diagnostic data collection Documentation: - Update README with new architecture - Add English translation improvements - Update service descriptions in services.yaml modified: README.en.md modified: README.md modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/calendar.py new file: custom_components/diveracontrol/calendar_entity.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/device_tracker.py new file: custom_components/diveracontrol/device_tracker_entity.py modified: custom_components/diveracontrol/diagnostics.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/divera_data.py modified: custom_components/diveracontrol/entity.py modified: custom_components/diveracontrol/sensor.py new file: custom_components/diveracontrol/sensor_entity.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json modified: custom_components/diveracontrol/utils.py
* test_service.py (30 tests): Service handlers * test_device_action.py (24 tests): Device automations * test_divera_api.py (25 tests): API client * test_config_flow.py (8 tests): Configuration flows * test_coordinator.py (3 tests): Data coordinator * test_init.py (3 tests): Integration setup - Test coverage: 63% overall * service.py: 88% * device_action.py: 79% * divera_api.py: 98% * config_flow.py: 92% * coordinator.py: 100% - Add test infrastructure * pytest.ini with coverage configuration * requirements_test.txt * conftest.py with centralized fixtures * Optimized test fixtures (94% size reduction) - Fix code quality issues (Ruff linting) * Remove unused imports and variables * Fix duplicate imports Changes to be committed: new file: .coveragerc new file: .github/workflows/test.yml new file: .vscode/settings.json modified: README.md new file: coverage_DaMonsta_Okt-15-221814-2025_Conflict.xml modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/config_flow.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/divera_credentials.py modified: custom_components/diveracontrol/divera_data.py modified: custom_components/diveracontrol/utils.py new file: pytest.ini new file: requirements_test.txt new file: tests/__init__.py new file: tests/conftest.py new file: tests/fixtures/api_get_pull_all.json new file: tests/fixtures/api_post_auth_invalid.json new file: tests/fixtures/api_post_auth_multi_ucr.json new file: tests/fixtures/api_post_auth_single_ucr.json new file: tests/test_calendar.py new file: tests/test_config_flow.py new file: tests/test_coordinator.py new file: tests/test_device_action.py new file: tests/test_device_tracker.py new file: tests/test_divera_api.py new file: tests/test_init.py new file: tests/test_sensor.py new file: tests/test_service.py
Refactor manager entities into helper classes and improve entity setup Convert sensor and device tracker managers to plain helpers (start/stop) Ensure platforms start managers and register unload hooks Improve entity naming and unique_id handling to avoid unnamed entities Tighten unsubscribe typing and add hass references where required Fix service handlers and payload parsing Accept both int and str keys for message channel lookups Make news survey extraction robust to list and string inputs Align news/news-survey payload structure with tests Improve input validation and error handling for service calls Tests, CI and quality Update and add unit tests (tests/test_divera_credentials.py, tests/test_divera_data.py, tests/test_utils.py) Update existing tests to reflect refactor and service changes Update CI workflow (ci_pipeline.yml) and services schema (services.yaml) Misc Update translations (de/en) and various module fixes (config_flow, utils, data normalizer, device action, coordinator, div era_api, div era_data) Small typing, import-order and lint fixes applied across the integration Changes to be committed: modified: .github/workflows/ci_pipeline.yml deleted: coverage_DaMonsta_Okt-15-221814-2025_Conflict.xml modified: custom_components/diveracontrol/__init__.py modified: custom_components/diveracontrol/calendar.py modified: custom_components/diveracontrol/calendar_entity.py modified: custom_components/diveracontrol/config_flow.py modified: custom_components/diveracontrol/const.py modified: custom_components/diveracontrol/coordinator.py modified: custom_components/diveracontrol/data_normalizer.py modified: custom_components/diveracontrol/device_action.py modified: custom_components/diveracontrol/device_tracker.py modified: custom_components/diveracontrol/device_tracker_entity.py modified: custom_components/diveracontrol/divera_api.py modified: custom_components/diveracontrol/divera_data.py modified: custom_components/diveracontrol/entity.py modified: custom_components/diveracontrol/sensor.py modified: custom_components/diveracontrol/sensor_entity.py modified: custom_components/diveracontrol/service.py modified: custom_components/diveracontrol/services.yaml modified: custom_components/diveracontrol/translations/de.json modified: custom_components/diveracontrol/translations/en.json modified: custom_components/diveracontrol/utils.py modified: tests/conftest.py modified: tests/test_calendar.py modified: tests/test_device_action.py modified: tests/test_divera_api.py new file: tests/test_divera_credentials.py new file: tests/test_divera_data.py modified: tests/test_init.py modified: tests/test_service.py new file: tests/test_utils.py
Changes to be committed: modified: tests/test_service.py
…ames in conftest\n\n- Update service tests to use (matches ServiceDataNormalizer)\n- Add autouse fixture to rename threads so pytest-homeassistant plugin does not fail in CI\n\nNo production code changed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
breaking changes:
major changes:
under the hood: