ulic75 / lovelace-mushroom

Custom Cards for Mushroom ๐Ÿ„
Apache License 2.0
1 stars 0 forks source link

Fix auto logic for heat-/cool-only thermostats #24

Closed kevin-brown closed 2 years ago

kevin-brown commented 2 years ago

Description

This fixes a bug that was introduced when handling heat-only and cool-only thermostats that caused thermostats supporting both to render incorrect temperatures within the slider. This occurs because of a short-circuit that exists when checking for support for heat_cool which caused them to always be treated as being in heat_cool mode.

This fix now properly checks for heat-only or cool-only support in addition to the thermostats being in the relevant heat or cool state to render those specific cases. For all other cases (auto or heat_cool mode in a thermostat that supports both, or supports target ranges), we default back to the previous logic of using the target ranges to render both sliders. This no longer requires us to check for target range support since it is normally required in heat_cool and auto mode on thermostats that support both heating and cooling.

Related Issue

Fixes bug introduced in #20 when fixing #19.

Motivation and Context

How Has This Been Tested

Tested locally on thermostats which support both heat/cool as well as cool-only thermostats to ensure it renders correctly.

Types of changes

Checklist