home-assistant-core/homeassistant/util/temperature.py
2016-01-27 00:08:06 +01:00

16 lines
360 B
Python

"""
homeassistant.util.temperature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Temperature util functions.
"""
def fahrenheit_to_celcius(fahrenheit):
""" Convert a Fahrenheit temperature to Celcius. """
return (fahrenheit - 32.0) / 1.8
def celcius_to_fahrenheit(celcius):
""" Convert a Celcius temperature to Fahrenheit. """
return celcius * 1.8 + 32.0