Skip to content

Commit fb775ec

Browse files
bm1549casebeer
andauthored
Allow setting of temperature unit (F or C) when setting temperature (#39)
Co-authored-by: Christopher H. Casebeer <christopher@chc.name>
1 parent bfa28e1 commit fb775ec

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

frigidaire/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,17 @@ def set_humidity(cls, humidity: int) -> List[Component]:
202202
return [Component(Setting.TARGET_HUMIDITY, humidity)]
203203

204204
@classmethod
205-
def set_temperature(cls, temperature: int) -> List[Component]:
205+
def set_temperature(cls, temperature: int, temperature_unit: Unit = Unit.FAHRENHEIT) -> List[Component]:
206206
# Note: Frigidaire sets limits for temperature which could cause this action to fail
207207
# Temperature ranges are below, inclusive of the endpoints
208208
# Fahrenheit: 60-90
209209
# Celsius: 16-32
210+
logging.debug("Client setting target to {} {}".format(temperature, temperature_unit))
211+
temperature_unit_setting = Setting.TARGET_TEMPERATURE_F if temperature_unit == Unit.FAHRENHEIT else Setting.TARGET_TEMPERATURE_C
212+
210213
return [
211-
Component(Setting.TEMPERATURE_REPRESENTATION, Unit.FAHRENHEIT),
212-
Component(Setting.TARGET_TEMPERATURE_F, temperature),
214+
Component(Setting.TEMPERATURE_REPRESENTATION, temperature_unit),
215+
Component(temperature_unit_setting, temperature),
213216
]
214217

215218

0 commit comments

Comments
 (0)