8000 [valve] Tidy up template publish action location by jesserockz · Pull Request #8731 · esphome/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[valve] Tidy up template publish action location #8731

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

Merged
merged 1 commit into from
May 9, 2025
Merged

Conversation

jesserockz
Copy link
Member

What does this implement/fix?

  • The (Template)ValvePublishAction should only exist inside the Template Valve component files

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes

Pull request in esphome-docs with documentation (if applicable):

  • esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 05:23
@jesserockz jesserockz requested a review from a team as a code owner May 9, 2025 05:23
@probot-esphome
Copy link
probot-esphome bot commented May 9, 2025

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (valve) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Contributor
@Copilot Copilot AI left a comment

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 tidies up the location of the valve publish action by removing the generic ValvePublishAction from the global valve component and relocating a refined TemplateValvePublishAction into the template valve component.

  • Removed the redundant ValvePublishAction from esphome/components/valve/automation.h
  • Added a new TemplateValvePublishAction implementation in esphome/components/template/valve/automation.h
  • Updated the action registration and code generation in esphome/components/template/valve/init.py and relevant test configurations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/components/template/common.yaml Adds a test configuration for the new TemplateValvePublishAction with state set to CLOSED
esphome/components/valve/automation.h Removes the redundant ValvePublishAction class
esphome/components/template/valve/automation.h Adds the new TemplateValvePublishAction class using the Parented pattern for TemplateValve
esphome/components/template/valve/init.py Modifies the action registration and code generation to support the refactored action
Comments suppressed due to low confidence (3)

tests/components/template/common.yaml:177

  • Consider adding tests specific to TemplateValvePublishAction behavior to verify that state transitions (eg. CLOSED) are handled correctly.
      - valve.template.publish:

esphome/components/valve/automation.h:67

  • The removal of ValvePublishAction from the global valve component improves maintainability; verify that no external references to this class remain.
template<typename... Ts> class ValvePublishAction : public Action<Ts...> {

esphome/components/template/valve/init.py:94

  • [nitpick] Ensure that the updated registration using cg.register_parented and cv.GenerateID aligns with the intended object lifecycle and dependency injection patterns in the automation framework.
TemplateValvePublishAction = template_ns.class_("TemplateValvePublishAction", automation.Action, cg.Parented.template(TemplateValve)

@kbx81 kbx81 merged commit 2b3757d into dev May 9, 2025
30 checks passed
@kbx81 kbx81 deleted the jesserockz-2025-115 branch May 9, 2025 06:05
juanboro pushed a commit to juanboro/esphome that referenced this pull request May 10, 2025
@jesserockz jesserockz mentioned this pull request May 13, 2025
@jesserockz jesserockz mentioned this pull request May 21, 2025
sa-crespo pushed a commit to sa-crespo/esphome that referenced this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0