diff --git a/advanced/esphome/nspanel_esphome_addon_climate_base.yaml b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml index d1eebc9..81f2df3 100644 --- a/advanced/esphome/nspanel_esphome_addon_climate_base.yaml +++ b/advanced/esphome/nspanel_esphome_addon_climate_base.yaml @@ -10,7 +10,6 @@ substitutions: ### Local thermostat defaults ### # 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 cooler_relay: "0" # Select 1 for "Relay 1", 2 for "Relay 2" or "0" to a dummy switch/disabled min_off_time: "300" diff --git a/advanced/esphome/nspanel_esphome_core.yaml b/advanced/esphome/nspanel_esphome_core.yaml index e71b5a7..e900868 100644 --- a/advanced/esphome/nspanel_esphome_core.yaml +++ b/advanced/esphome/nspanel_esphome_core.yaml @@ -8,14 +8,9 @@ substitutions: ##### DON'T CHANGE THIS ##### 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: name: ${device_name} @@ -1145,7 +1140,7 @@ number: platform: template id: temperature_correction entity_category: config - unit_of_measurement: '°C' + unit_of_measurement: ${temp_units} initial_value: 0 min_value: -10 max_value: 10 @@ -1255,12 +1250,17 @@ sensor: platform: ntc id: temp_nspanel sensor: resistance_sensor + unit_of_measurement: ${temp_units} calibration: b_constant: 3950 reference_temperature: 25°C reference_resistance: 10kOhm 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: then: # Show panel's temperature if API or Wi-Fi are out