hass-core/homeassistant/util/temperature.py

16 lines
360 B
Python
Raw Normal View History

2015-08-16 21:36:33 -07:00
"""
homeassistant.util.temperature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Temperature util functions.
"""
2015-08-16 22:06:01 -07:00
def fahrenheit_to_celcius(fahrenheit):
2015-08-16 21:36:33 -07:00
""" Convert a Fahrenheit temperature to Celcius. """
return (fahrenheit - 32.0) / 1.8
2015-08-16 22:06:01 -07:00
def celcius_to_fahrenheit(celcius):
2015-08-16 21:36:33 -07:00
""" Convert a Celcius temperature to Fahrenheit. """
return celcius * 1.8 + 32.0