Skip to content

[component][pid] Pid climate add set deadband parameters action#14730

Open
ngolf wants to merge 15 commits intoesphome:devfrom
ngolf:pid-climate-add-set-deadband-parameters-action
Open

[component][pid] Pid climate add set deadband parameters action#14730
ngolf wants to merge 15 commits intoesphome:devfrom
ngolf:pid-climate-add-set-deadband-parameters-action

Conversation

@ngolf
Copy link
Copy Markdown

@ngolf ngolf commented Mar 12, 2026

What does this implement/fix?

Adds actions (climate.pid.set_deadband_control_parameters_multipliers, climate.pid.set_deadband_threshold_parameters) to allow tuning pid deadband multipliers at runtime.

Also adds sensors for PID multipliers and threshold parameters.

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) — policy
  • Developer breaking change (an API change that could break external components) — policy
  • Undocumented C++ API change (removal or change of undocumented public methods that lambda users may depend on) — policy
  • 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):

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040/RP2350
  • BK72xx
  • RTL87xx
  • LN882x
  • nRF52840

Example entry for config.yaml:

  - platform: template
    id: pid_deadband_kp_multiplier_input
    (...)
    on_value:
      then:
        - climate.pid.set_deadband_control_parameters_multipliers:
            id: chamber_climate
            kp_multiplier: !lambda 'return x;'
            ki_multiplier: !lambda 'return id(pid_deadband_ki_multiplier_input).state;'
            kd_multiplier: !lambda 'return id(pid_deadband_kd_multiplier_input).state;'

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:

@github-actions
Copy link
Copy Markdown
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#14730
    components: [pid]
    refresh: 1h

(Added by the PR bot)

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.38%. Comparing base (af5b98c) to head (906c413).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #14730      +/-   ##
==========================================
+ Coverage   75.36%   75.38%   +0.02%     
==========================================
  Files          55       55              
  Lines       12076    12076              
  Branches     1667     1667              
==========================================
+ Hits         9101     9104       +3     
+ Misses       2558     2556       -2     
+ Partials      417      416       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@esphome esphome bot removed the needs-docs label Mar 12, 2026
@ngolf ngolf marked this pull request as ready for review March 12, 2026 16:49
@ngolf ngolf requested a review from OttoWinter as a code owner March 12, 2026 16:49
Copilot AI review requested due to automatic review settings March 12, 2026 16:49
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi there! I've automatically requested reviews from codeowners based on the files changed in this PR.

@OttoWinter - You've been requested to review this PR as codeowner(s) of 2 file(s) that were modified. Thanks for your time! 🙏

Copy link
Copy Markdown
Contributor

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

Adds runtime tuning and observability for PID deadband multipliers in the PID climate component.

Changes:

  • Add a new automation action climate.pid.set_deadband_control_parameters_multipliers to set PID deadband KP/KI/KD multipliers at runtime.
  • Add new PID sensor types to expose deadband KP/KI/KD multipliers.
  • Extend PID component tests to cover the new action and sensor types.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/components/pid/common.yaml Adds config coverage for the new deadband multiplier action and new PID sensor types.
esphome/components/pid/sensor/pid_climate_sensor.h Extends the C++ enum with deadband multiplier sensor types.
esphome/components/pid/sensor/pid_climate_sensor.cpp Publishes the new deadband multiplier sensor readings from the PIDClimate parent.
esphome/components/pid/sensor/init.py Exposes the new sensor type strings mapped to the new enum values.
esphome/components/pid/pid_climate.h Introduces the new automation action class that sets deadband multipliers on the PIDClimate instance.
esphome/components/pid/climate.py Registers the new automation action and wires templatable config values into the C++ action.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 16, 2026

Memory Impact Analysis

Components: pid
Platform: esp8266-ard

Metric Target Branch This PR Change
RAM 29,648 bytes 30,128 bytes 📈 🚨 +480 bytes (+1.62%)
Flash 282,063 bytes 284,179 bytes 📈 🔸 +2,116 bytes (+0.75%)
📊 Component Memory Breakdown
Component Target Flash PR Flash Change
[esphome]pid 7,593 bytes 8,268 bytes 📈 🚨 +675 bytes (+8.89%)
app_framework 2,634 bytes 3,268 bytes 📈 +634 bytes (+24.07%)
[esphome]core 6,670 bytes 7,104 bytes 📈 🚨 +434 bytes (+6.51%)
[esphome]sensor 704 bytes 749 bytes 📈 🚨 +45 bytes (+6.39%)
rom_functions 5,522 bytes 5,533 bytes 📈 +11 bytes (+0.20%)
🔍 Symbol-Level Changes (click to expand)

Changed Symbols

Symbol Target Size PR Size Change
setup 933 bytes 1,567 bytes 📈 +634 bytes (+67.95%)
esphome::App 140 bytes 180 bytes 📈 +40 bytes (+28.57%)
esphome::entity_uom_lookup(unsigned char) 5 bytes 21 bytes 📈 +16 bytes (+320.00%)
esphome::EntityBase::configure_entity_(char const*, unsigned int, unsigned int) 165 bytes 177 bytes 📈 +12 bytes (+7.27%)
esphome::sensor::log_sensor(char const*, char const*, char const*, esphome::sensor::Sensor*) 176 bytes 184 bytes 📈 +8 bytes (+4.55%)
esphome::EntityBase::get_unit_of_measurement_ref() const 33 bytes 37 bytes 📈 +4 bytes (+12.12%)
esphome::Application::register_component_impl_(esphome::Component*, bool) 35 bytes 38 bytes 📈 +3 bytes (+8.57%)
esphome::sensor::Sensor::Sensor() 37 bytes 40 bytes 📈 +3 bytes (+8.11%)
setup::__pstr__ 12 bytes 11 bytes 📉 -1 bytes (-8.33%)

New Symbols (top 15)

Symbol Size
esphome::pid::PIDClimateSensor::update_from_parent_() 299 bytes
void std::vector<esphome::Callback<void ()>, std::allocator<esphome::Callback<void ()> > >::_M_re...void std::vector<esphome::Callback<void ()>, std::allocator<esphome::Callback<void ()> > >::_M_realloc_insert<esphome::Callback<void ()> const&>(__gnu_cxx::__normal_iterator<esphome::Callback<void ()>*, std::vector<esphome::Callback<void ()>, std::allocator<esphome::Callback<void ()> > > >, esphome::Callback<void ()> const&)
198 bytes
esphome::TemplatableValue<float>::operator=(esphome::TemplatableValue<float>&&) [$part$0] 85 bytes
esphome::pid::PIDClimateSensor::setup() 64 bytes
esphome::pid::PIDSetDeadbandControlParametersMultipliersAction<>::play() 60 bytes
esphome::log_entity_icon(char const*, char const*, esphome::EntityBase const&) 59 bytes
pid__pid_threshold_high__pstorage 52 bytes
pid__pid_kd_multiplier__pstorage 52 bytes
pid__pid_kp_multiplier__pstorage 52 bytes
pid__pid_ki_multiplier__pstorage 52 bytes
pid__pid_threshold_low__pstorage 52 bytes
esphome::pid::PIDClimateSensor::PIDClimateSensor() 49 bytes
vtable for esphome::pid::PIDClimateSensor 48 bytes
esphome::EntityBase::get_icon_to(std::span<char, 64u>) const 48 bytes
esphome::pid::PIDSetDeadbandThresholdParametersAction<>::play() 43 bytes
17 more new symbols... Total: 1,529 bytes

Removed Symbols (top 15)

Symbol Size
esphome::TemplatableValue<float>::operator=(esphome::TemplatableValue<float>&&) [$isra$0] 89 bytes

Note: This analysis measures static RAM and Flash usage only (compile-time allocation).
Dynamic memory (heap) cannot be measured automatically.
⚠️ You must test this PR on a real device to measure free heap and ensure no runtime memory issues.

This analysis runs automatically when components change. Memory usage is measured from a representative test configuration.

@esphome esphome bot removed the medium-pr PR < 100 lines label Mar 16, 2026
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.

3 participants