Skip to content

Commit

Permalink
Merge pull request #1166 from derbohmann/main
Browse files Browse the repository at this point in the history
Added variable to set a custom temperature step in 'card_thermostat'.
  • Loading branch information
basbruss authored Feb 16, 2023
2 parents 0c190a4 + d8878e3 commit faf06b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ card_thermostat:
return 0;
} else {
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const new_temp = (parseFloat(entity.attributes.target_temp_high) - step)
return (new_temp - variables.ulm_card_thermostat_minimum_temp_spread < entity.attributes.target_temp_low ? new_temp - variables.ulm_card_thermostat_minimum_temp_spread : entity.attributes.target_temp_low);
}
Expand All @@ -242,7 +242,7 @@ card_thermostat:
return 0;
} else {
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(entity.attributes.target_temp_high) - step)
}
]]]
Expand All @@ -252,7 +252,7 @@ card_thermostat:
return 0;
} else {
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(states[entity.entity_id].attributes.temperature) - step)
}
]]]
Expand Down Expand Up @@ -309,7 +309,7 @@ card_thermostat:
return 0;
} else {
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(entity.attributes.target_temp_high) + step)
}
]]]
Expand All @@ -319,7 +319,7 @@ card_thermostat:
return 0;
} else {
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(states[entity.entity_id].attributes.temperature) + step)
}
]]]
Expand Down Expand Up @@ -354,7 +354,7 @@ card_thermostat:
target_temp_low: |
[[[
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(entity.attributes.target_temp_low) - step)
]]]
target_temp_high: "[[[ return entity.attributes.target_temp_high ]]]"
Expand Down Expand Up @@ -400,13 +400,13 @@ card_thermostat:
target_temp_low: |
[[[
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
return (parseFloat(entity.attributes.target_temp_low) + step)
]]]
target_temp_high: |
[[[
const unit = hass.config.unit_system.temperature
const step = entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const step = variables.ulm_card_thermostat_temp_step || entity.attributes.target_temp_step || (unit == '°F' ? 1.0 : 0.5)
const new_temp = (parseFloat(entity.attributes.target_temp_low) + step)
return (new_temp + variables.ulm_card_thermostat_minimum_temp_spread > entity.attributes.target_temp_high ? new_temp + variables.ulm_card_thermostat_minimum_temp_spread : entity.attributes.target_temp_high)
]]]
Expand Down
1 change: 1 addition & 0 deletions docs/usage/cards/card_thermostat.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This card merges the following one :
| ulm_card_thermostat_enable_popup | `false` | :material-close: | Enable `popup_thermostat` | |
| ulm_card_thermostat_fan_entity | `null` | :material-close: | `fan` entity for climate if separate entity | |
| ulm_card_thermostat_minimum_temp_spread | `1` | :material-close: | Minimum temperature spread between low and high temperature when in `heat_cool` mode | |
| ulm_card_thermostat_temp_step | `false` | :material-close: | Set the step size for increasing and decreasing temperature | |

## Usage

Expand Down

0 comments on commit faf06b0

Please sign in to comment.