@@ -24,7 +24,10 @@ import { ClimateModeMenu } from 'lib/ui/thermostat/ClimateModeMenu.js'
2424import { ClimateSettingStatus } from 'lib/ui/thermostat/ClimateSettingStatus.js'
2525import { FanModeMenu } from 'lib/ui/thermostat/FanModeMenu.js'
2626import { TemperatureControlGroup } from 'lib/ui/thermostat/TemperatureControlGroup.js'
27- import { ThermostatCard } from 'lib/ui/thermostat/ThermostatCard.js'
27+ import {
28+ type TemperatureUnit ,
29+ ThermostatCard ,
30+ } from 'lib/ui/thermostat/ThermostatCard.js'
2831
2932interface ThermostatDeviceDetailsProps
3033 extends NestedSpecificDeviceDetailsProps {
@@ -38,6 +41,10 @@ export function ThermostatDeviceDetails({
3841 onBack,
3942 className,
4043} : ThermostatDeviceDetailsProps ) : JSX . Element | null {
44+ const [ temperatureUnit , setTemperatureUnit ] = useState <
45+ 'fahrenheit' | 'celsius'
46+ > ( 'fahrenheit' )
47+
4148 if ( device == null ) {
4249 return null
4350 }
@@ -47,15 +54,22 @@ export function ThermostatDeviceDetails({
4754 < ContentHeader title = { t . thermostat } onBack = { onBack } />
4855
4956 < div className = 'seam-body' >
50- < ThermostatCard device = { device } />
57+ < ThermostatCard
58+ device = { device }
59+ temperatureUnit = { temperatureUnit }
60+ onChangeTemperatureUnit = { setTemperatureUnit }
61+ />
5162
5263 < div className = 'seam-thermostat-device-details' >
5364 < DetailSectionGroup >
5465 < DetailSection
5566 label = { t . currentSettings }
5667 tooltipContent = { t . currentSettingsTooltip }
5768 >
58- < ClimateSettingRow device = { device } />
69+ < ClimateSettingRow
70+ device = { device }
71+ temperatureUnit = { temperatureUnit }
72+ />
5973 < FanModeRow device = { device } />
6074 </ DetailSection >
6175
@@ -112,8 +126,10 @@ function FanModeRow({ device }: { device: ThermostatDevice }): JSX.Element {
112126
113127function ClimateSettingRow ( {
114128 device,
129+ temperatureUnit,
115130} : {
116131 device : ThermostatDevice
132+ temperatureUnit : TemperatureUnit
117133} ) : JSX . Element {
118134 const deviceHeatValue =
119135 device . properties . current_climate_setting . heating_set_point_fahrenheit
@@ -257,7 +273,7 @@ function ClimateSettingRow({
257273 rightCollapsedContent = {
258274 < ClimateSettingStatus
259275 climateSetting = { device . properties . current_climate_setting }
260- temperatureUnit = 'fahrenheit'
276+ temperatureUnit = { temperatureUnit }
261277 iconPlacement = 'right'
262278 />
263279 }
0 commit comments