Skip to content
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

Allow overriding thermostat card sensor #8043

Closed
wants to merge 1 commit into from

Conversation

nattgris
Copy link

@nattgris nattgris commented Dec 28, 2020

Proposed change

Some climate integrations do not have a temperature sensor available to show the current temperature. In these cases, the card shows a big pointless zero as the main element of the card (since a few versions back, I think previously it was just blank, which was better).

Allow to configure a separate temperature sensor to display instead of the current temperature that may or may not be provided by the climate entity. Even if the climate entity, e.g. a A/C unit,m provides a temperature reading, a separate sensor that could be placed away from the heat source could be more relevant.

Display the main temperature value from the following sources, in
order of priority:

  1. The state of the new 'sensor' entity configuration, if set.
  2. The current_temperature attribute of the climate entity, if available.
  3. The target temperature of the climate entity, if it's a single value.
  4. An empty placeholder, if the set-point is a range.

If the target temperature is displayed as the main element, do not also
show it below.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

type: thermostat
entity: climate.living_room
sensor: sensor.living_room_temperature

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

@homeassistant
Copy link
Contributor

Hi @nattgris,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@bramkragten
Copy link
Member

This is not something the frontend should take care of, we will not add this feature.
A thermostat has a setpoint and current temp, an external sensor doesn't work with this.

You could create a PR to fix the dot when there is no temperature reading.

You should look at something like the https://www.home-assistant.io/integrations/generic_thermostat/ for things like this.

@bramkragten bramkragten closed this Jan 5, 2021
@nattgris
Copy link
Author

nattgris commented Jan 5, 2021

Because you suggested the generic thermostat integration, I think you probably misunderstood what this was for. A climate entity already provides the thermostat functionality, perhaps as in my case built into a A/C unit and controlled from HA via an IR transmitter. Adding a separate thermostat is not useful and wouldn't work. The problem is when the A/C doesn't expose its internally measured actual temperature. The best we can do in this case, if we still want to show the current temperature in the card, is to show the current temperature from a separate sensor in the same room. That's what this was meant for, as suggested in #7036.

But, yeah, after using this a bit it's clear there are some caveats. Mostly it's the nice history graph you get with a "full-featured" climate entity, where both the set-point, actual temperature, and the heating/cooling status is shown. With this change, you get a current temperature shown in the card, but the history graph still only shows the set-point. It would be better if a custom sensor could be added as the current_temperature of an existing climate entity directly in the backend. Do you know if this makes sense for HA core or should I ask the core devs? Maybe it's already possible to override arbitrary attributes in existing entities, to a templated value that could come from an arbitrary temperature sensor. I'll look into it.

Actually, what I mostly wanted to fix was the annoying zero that recently started to be displayed in the card. I've broken out that fix to a separate PR: #8095

@nattgris nattgris deleted the thermostat-sensor branch January 5, 2021 18:34
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow thermostat card to use custom temperature sensor
3 participants