Skip to content

Reset discharge limit register for GECloud use, entity edit, external event route - #2715

Merged
springfall2008 merged 3 commits into
mainfrom
fixes9
Oct 3, 2025
Merged

springfall2008 merged 3 commits into
mainfrom
fixes9

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

@springfall2008 springfall2008 changed the title Reset discharge downto Reset discharge limit register for GECloud use Oct 3, 2025
@springfall2008
springfall2008 requested a review from mgazza October 3, 2025 17:29
routing for external events
@springfall2008 springfall2008 changed the title Reset discharge limit register for GECloud use Reset discharge limit register for GECloud use, entity edit, external event route Oct 3, 2025
@springfall2008
springfall2008 requested a review from Copilot October 3, 2025 18:35
@springfall2008
springfall2008 merged commit 94a9294 into main Oct 3, 2025
1 check passed
@springfall2008
springfall2008 deleted the fixes9 branch October 3, 2025 18:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread apps/predbat/ha.py
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"

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread apps/predbat/ha.py
Comment on lines +506 to +509
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}

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread apps/predbat/ha.py
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):

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread apps/predbat/ha.py
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)

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants