Repository navigation
fix(climate): forward setpoint to configured thermostat and support climate entities in sensor reading - #191
Open
StefanoPierini wants to merge 1 commit into
Conversation
…te entities in sensor float conversion
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR addresses two related issues when using a secondary/physical thermostat entity (
climate.*, e.g. ESPHome, Zigbee, or smart wall thermostats) with SAT:Forward target temperature to connected thermostat entity:
When
push_setpoint_to_thermostatis enabled,async_set_temperaturepreviously only calledself._coordinator.async_set_control_thermostat_setpoint(temperature). For coordinators without native bus thermostat control or when an external Home Assistant climate entity is configured (self._config.thermostat), the target temperature was never forwarded to that entity.climate.set_temperatureforself._config.thermostatif configured, ensuring external thermostats stay in sync when SAT changes its setpoint.Handle
climateentities in_get_entity_state_float:When a user configures a
climateentity as an indoor temperature sensor (e.g. using the thermostat's built-in room temperature sensor),_get_entity_state_floatattempted to executefloat(entity.state). In Home Assistant, a climate entity's state represents its HVAC mode (heat,off,idle, etc.), causing aValueError: could not convert string to floatand breaking temperature readings.climatedomain or contains acurrent_temperatureattribute, safely extract that numeric attribute first before falling back toentity.state.Changes Made
custom_components/sat/climate.py:async_set_temperature(): invokeclimate.set_temperatureonself._config.thermostatwhenpush_setpoint_to_thermostatis true._get_entity_state_float(): inspectentity.domain == "climate"/current_temperatureattribute and extract temperature safely.Testing