Repository navigation
Reset discharge limit register for GECloud use, entity edit, external event route - #2715
Conversation
routing for external events
There was a problem hiding this comment.
Pull Request Overview
This PR implements entity editing functionality for the web interface, updates component references, and adds GECloud discharge limit register configuration. The changes enable users to modify entity values directly through the web UI with appropriate form controls based on entity types.
- Adds POST endpoint and control HTML generation for entity editing in the web interface
- Updates component reference from "web_interface" to "web" for consistency
- Adds discharge target SOC configuration for GECloud batteries
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| apps/predbat/web.py | Adds entity editing functionality with POST handler and HTML form generation |
| apps/predbat/plan.py | Updates component reference from "web_interface" to "web" |
| apps/predbat/ha.py | Removes unused variable and adds external entity handling logic |
| apps/predbat/gecloud.py | Adds discharge_target_soc configuration for GECloud batteries |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| service_data = {"domain": domain} | ||
| if domain in ["switch", "input_boolean"]: | ||
| # For toggle switches, check if value is 'on' or 'off' | ||
| service_data["service"] = "turn_on" if new_value else "turn_off" |
There was a problem hiding this comment.
Variable new_value is used but not defined in this scope. It should be state instead, which contains the new value passed to the function.
| service_data["service_data"] = {"entity_id": entity_id, "value": new_value} | ||
| elif domain in ["select", "input_select"]: | ||
| service_data["service"] = "select_option" | ||
| service_data["service_data"] = {"entity_id": entity_id, "option": new_value} |
There was a problem hiding this comment.
Variable new_value is used but not defined in this scope. It should be state instead, which contains the new value passed to the function.
| if (old_value is None) or (new_value != old_value): | ||
| await self.trigger_watch_list(entity_id, attributes, old_state, new_state) | ||
| # Only trigger on value change or you get too many updates | ||
| if (old_value is None) or (new_value != old_value): |
There was a problem hiding this comment.
Variable new_value is used but not defined in this scope. It should be state instead, which contains the new value passed to the function.
| await self.trigger_watch_list(entity_id, attributes, old_state, new_state) | ||
| # Only trigger on value change or you get too many updates | ||
| if (old_value is None) or (new_value != old_value): | ||
| await self.base.trigger_watch_list(entity_id, attributes, old_state, new_state) |
There was a problem hiding this comment.
The method call was changed from self.trigger_watch_list to self.base.trigger_watch_list, but this appears to be incorrect as trigger_watch_list should be a method of the current class, not the base class.
| await self.base.trigger_watch_list(entity_id, attributes, old_state, new_state) | |
| await self.trigger_watch_list(entity_id, attributes, old_state, new_state) |
No description provided.