Disable power limit profile forecasts when optimisation is disabled#46
Disable power limit profile forecasts when optimisation is disabled#46igorrutka wants to merge 3 commits into
Conversation
wborn
left a comment
There was a problem hiding this comment.
Shouldn't it also remove optimisationDisabled from the existing attributes in the database?
There was a problem hiding this comment.
Pull request overview
Adds a new service-level disable switch for EMS optimisation and aims to prevent stale/incorrect power-limit forecast data from remaining in the predicted datapoint store when optimisation is disabled (per issue #45).
Changes:
- Introduces
disableOptimisationServiceattribute forEmsEnergyOptimisationAsset(DB migration + asset type UI include). - Updates
EmsOptimisationServiceto react to the new attribute and purge predicted power-limit profiles when stopping. - Prevents loading manual power-limit profiles into the forecast DB when optimisation is disabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
ems/src/main/resources/org/openremote/manager/setup/database/V20260609_01__AddDisableOptimisationServiceAttributes.sql |
Adds the new disableOptimisationService attribute to existing EMS optimisation assets. |
ems/src/main/resources/ems/config/asset-types.json |
Exposes disableOptimisationService in the EMS optimisation asset UI configuration and removes the old attribute from the include list. |
ems/src/main/java/org/openremote/extension/ems/manager/EmsOptimisationService.java |
Switches to the new disable attribute, purges predicted profiles on stop, and blocks manual profile forecast updates when disabled. |
ems/src/main/java/org/openremote/extension/ems/agent/EmsEnergyOptimisationAsset.java |
Replaces the old optimisationDisabled descriptor with disableOptimisationService and updates getters/setters accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| -- Add attribute disableOptimisationService to EmsEnergyOptimisationAsset | ||
| SELECT a.id, ADD_ATTRIBUTE(a, 'disableOptimisationService', 'boolean', null, now(), '{}'::jsonb) | ||
| FROM asset a WHERE a.type = 'EmsEnergyOptimisationAsset'; No newline at end of file |
@wborn good point. What I actually would want to do is this: UPDATE asset However, I don't know if it is allowed to use custom SQL queries in the migration script that are not part of the helper queries such as ADD_ATTRIBUTE? |
Yes you can. The helpers are just helping out so you don't need to reinvent the wheel all the time. Might make sense to add a rename attribute helper function one day. 🙂 |
Fixes #45