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

Fix temperature cards not syncing #18463

Closed
wants to merge 1 commit into from

Conversation

dbolger
Copy link

@dbolger dbolger commented Oct 29, 2023

Proposed change

Ensure the thermostat tile card, the thermostat card, and the thermostat dialog card keep their original values when an exception is thrown.

Demo:

ha_frontend_climate_sync_bug_fixed.mp4

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.nest_thermostat
type: tile
entity: climate.nest_thermostat
tap_action:
  action: call-service
  service: ''
vertical: false
features:
  - type: climate-hvac-modes
    hvac_modes:
      - 'off'
      - heat
      - cool
      - heat_cool
  - type: target-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:

@dbolger dbolger marked this pull request as ready for review November 2, 2023 02:31
try {
await this.hass!.callService("climate", service, data);
} catch (err: any) {
this._error = err.message;
Copy link
Member

Choose a reason for hiding this comment

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

This is not used in render?

Copy link
Member

Choose a reason for hiding this comment

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

Also this should be lokalized :-)

Copy link
Author

Choose a reason for hiding this comment

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

Correct, it's not used in render. But when an exception is thrown and not caught, this method doesn't finish executing and as a result, doesn't revert the UI back to its original state.

Copy link
Member

@bramkragten bramkragten Nov 29, 2023

Choose a reason for hiding this comment

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

You can catch the error and swallow? No need to set it as a property?

Copy link
Author

Choose a reason for hiding this comment

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

I was following the convention I saw in other cards. Maybe setting the error isn't necessary but I don't think swallowing an exception is a good practice.

Copy link
Contributor

@silamon silamon left a comment

Choose a reason for hiding this comment

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

The target temperature tile feature (or card feature in newer releases) does also support water heater entities. For the linting to pass, you may need to add the attributes "target_temp_low", and "target_temp_high" to the WaterHeaterEntity class.

@dbolger dbolger closed this Dec 14, 2023
@dbolger dbolger deleted the sync-temp-cards branch January 5, 2024 03:55
@github-actions github-actions bot locked and limited conversation to collaborators Jan 4, 2025
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.

Thermostat card doesn't reset values when an exception is thrown
3 participants