From df867f76e08683435a83cbf7a93b49e6465c6db9 Mon Sep 17 00:00:00 2001 From: "Tristan B." Date: Fri, 15 Mar 2024 14:50:09 -0600 Subject: [PATCH 1/3] fix: Show temperature in climate setting rows --- .../DeviceDetails/ThermostatDeviceDetails.tsx | 2 ++ src/lib/ui/thermostat/ClimateSettingStatus.tsx | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx b/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx index 257c4824c..0ac5ea649 100644 --- a/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +++ b/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx @@ -133,6 +133,7 @@ export function ThermostatDeviceDetails({ ) : (

{t.none}

@@ -397,6 +398,7 @@ function ClimateSettingRow({ } > diff --git a/src/lib/ui/thermostat/ClimateSettingStatus.tsx b/src/lib/ui/thermostat/ClimateSettingStatus.tsx index 52051ec15..ce41e9d99 100644 --- a/src/lib/ui/thermostat/ClimateSettingStatus.tsx +++ b/src/lib/ui/thermostat/ClimateSettingStatus.tsx @@ -69,16 +69,16 @@ function Content(props: { }): JSX.Element | null { const { mode, coolingSetPoint, heatingSetPoint, temperatureUnit } = props - if (mode === 'cool' && isSetPoint(coolingSetPoint)) + if (mode === 'cool' && isSetPoint(coolingSetPoint, temperatureUnit)) return - if (mode === 'heat' && isSetPoint(heatingSetPoint)) + if (mode === 'heat' && isSetPoint(heatingSetPoint, temperatureUnit)) return if ( mode === 'heat_cool' && - isSetPoint(heatingSetPoint) && - isSetPoint(coolingSetPoint) + isSetPoint(heatingSetPoint, temperatureUnit) && + isSetPoint(coolingSetPoint, temperatureUnit) ) return ( @@ -93,7 +93,12 @@ function Content(props: { return null } -function isSetPoint(setPoint: Partial): setPoint is SetPoint { +function isSetPoint( + setPoint: Partial, + temperatureUnit: 'fahrenheit' | 'celsius' +): setPoint is SetPoint { + if (temperatureUnit === 'fahrenheit') return setPoint.fahrenheit != null + if (temperatureUnit === 'celsius') return setPoint.celsius != null return setPoint.fahrenheit != null && setPoint.celsius != null } From eda9250dd38353414cdbaa4ee70bb383c2724fd6 Mon Sep 17 00:00:00 2001 From: "Tristan B." Date: Fri, 15 Mar 2024 14:55:01 -0600 Subject: [PATCH 2/3] Add celsius values to fake --- .storybook/seed-fake.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.storybook/seed-fake.js b/.storybook/seed-fake.js index c0828746c..7834225b6 100644 --- a/.storybook/seed-fake.js +++ b/.storybook/seed-fake.js @@ -374,7 +374,9 @@ export const seedFake = (db) => { automatic_cooling_enabled: true, automatic_heating_enabled: true, cooling_set_point_fahrenheit: 75, + cooling_set_point_celsius: 23.8, heating_set_point_fahrenheit: 65, + heating_set_point_celsius: 18.3, }, default_climate_setting: { hvac_mode_setting: 'heat_cool', @@ -382,7 +384,9 @@ export const seedFake = (db) => { automatic_cooling_enabled: true, automatic_heating_enabled: true, cooling_set_point_fahrenheit: 75, + cooling_set_point_celsius: 23.8, heating_set_point_fahrenheit: 65, + heating_set_point_celsius: 18.3, }, available_hvac_mode_settings: ['off', 'cool', 'heat', 'heat_cool'], can_enable_automatic_cooling: true, From 718fb87f800730120b49e130977b6cd5d473b65d Mon Sep 17 00:00:00 2001 From: "Tristan B." Date: Mon, 18 Mar 2024 15:59:13 -0600 Subject: [PATCH 3/3] Remove conditional change to `isSetPoint` function --- src/lib/ui/thermostat/ClimateSettingStatus.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/lib/ui/thermostat/ClimateSettingStatus.tsx b/src/lib/ui/thermostat/ClimateSettingStatus.tsx index ce41e9d99..52051ec15 100644 --- a/src/lib/ui/thermostat/ClimateSettingStatus.tsx +++ b/src/lib/ui/thermostat/ClimateSettingStatus.tsx @@ -69,16 +69,16 @@ function Content(props: { }): JSX.Element | null { const { mode, coolingSetPoint, heatingSetPoint, temperatureUnit } = props - if (mode === 'cool' && isSetPoint(coolingSetPoint, temperatureUnit)) + if (mode === 'cool' && isSetPoint(coolingSetPoint)) return - if (mode === 'heat' && isSetPoint(heatingSetPoint, temperatureUnit)) + if (mode === 'heat' && isSetPoint(heatingSetPoint)) return if ( mode === 'heat_cool' && - isSetPoint(heatingSetPoint, temperatureUnit) && - isSetPoint(coolingSetPoint, temperatureUnit) + isSetPoint(heatingSetPoint) && + isSetPoint(coolingSetPoint) ) return ( @@ -93,12 +93,7 @@ function Content(props: { return null } -function isSetPoint( - setPoint: Partial, - temperatureUnit: 'fahrenheit' | 'celsius' -): setPoint is SetPoint { - if (temperatureUnit === 'fahrenheit') return setPoint.fahrenheit != null - if (temperatureUnit === 'celsius') return setPoint.celsius != null +function isSetPoint(setPoint: Partial): setPoint is SetPoint { return setPoint.fahrenheit != null && setPoint.celsius != null }