Skip to content

Commit

Permalink
Allow setting of temperature unit (F or C) when setting temperature (#39
Browse files Browse the repository at this point in the history
)

Co-authored-by: Christopher H. Casebeer <christopher@chc.name>
  • Loading branch information
bm1549 and casebeer authored Sep 1, 2024
1 parent bfa28e1 commit fb775ec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frigidaire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,17 @@ def set_humidity(cls, humidity: int) -> List[Component]:
return [Component(Setting.TARGET_HUMIDITY, humidity)]

@classmethod
def set_temperature(cls, temperature: int) -> List[Component]:
def set_temperature(cls, temperature: int, temperature_unit: Unit = Unit.FAHRENHEIT) -> List[Component]:
# Note: Frigidaire sets limits for temperature which could cause this action to fail
# Temperature ranges are below, inclusive of the endpoints
# Fahrenheit: 60-90
# Celsius: 16-32
logging.debug("Client setting target to {} {}".format(temperature, temperature_unit))
temperature_unit_setting = Setting.TARGET_TEMPERATURE_F if temperature_unit == Unit.FAHRENHEIT else Setting.TARGET_TEMPERATURE_C

return [
Component(Setting.TEMPERATURE_REPRESENTATION, Unit.FAHRENHEIT),
Component(Setting.TARGET_TEMPERATURE_F, temperature),
Component(Setting.TEMPERATURE_REPRESENTATION, temperature_unit),
Component(temperature_unit_setting, temperature),
]


Expand Down

0 comments on commit fb775ec

Please sign in to comment.