Support internal temperature in Fahrenheit

This commit is contained in:
Edward Firmo
2023-12-18 12:44:16 +01:00
parent c97be551c0
commit 773de2bd51
2 changed files with 8 additions and 9 deletions

View File

@@ -10,7 +10,6 @@
substitutions: substitutions:
### Local thermostat defaults ### ### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html # https://esphome.io/components/climate/thermostat.html
temp_units: "°C"
heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled heater_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled
cooler_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled cooler_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled
min_off_time: "300" min_off_time: "300"

View File

@@ -8,14 +8,9 @@
substitutions: substitutions:
##### DON'T CHANGE THIS ##### ##### DON'T CHANGE THIS #####
version: "4.2dev" version: "4.2dev"
temp_units: "°C"
############################# #############################
#external_components:
# - source: github://pr#5825 #5683 # Remove this when that pr is merged and released
# components:
# - nextion
# refresh: 1s
##### ESPHOME CONFIGURATION ##### ##### ESPHOME CONFIGURATION #####
esphome: esphome:
name: ${device_name} name: ${device_name}
@@ -1145,7 +1140,7 @@ number:
platform: template platform: template
id: temperature_correction id: temperature_correction
entity_category: config entity_category: config
unit_of_measurement: '°C' unit_of_measurement: ${temp_units}
initial_value: 0 initial_value: 0
min_value: -10 min_value: -10
max_value: 10 max_value: 10
@@ -1255,12 +1250,17 @@ sensor:
platform: ntc platform: ntc
id: temp_nspanel id: temp_nspanel
sensor: resistance_sensor sensor: resistance_sensor
unit_of_measurement: ${temp_units}
calibration: calibration:
b_constant: 3950 b_constant: 3950
reference_temperature: 25°C reference_temperature: 25°C
reference_resistance: 10kOhm reference_resistance: 10kOhm
filters: filters:
- lambda: return x + temperature_correction->state; - lambda: |-
if ("${temp_units}" == "°F" or "${temp_units}" == "F" or "${temp_units}" == "°f" or "${temp_units}" == "f")
return (x * (9.0/5.0)) + 32.0 + temperature_correction->state;
else
return x + temperature_correction->state;
on_value: on_value:
then: then:
# Show panel's temperature if API or Wi-Fi are out # Show panel's temperature if API or Wi-Fi are out