How to use the homeassistant.const.TEMP_CELSIUS function in homeassistant

To help you get started, we’ve selected a few homeassistant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github home-assistant / home-assistant / tests / components / thermostat / test_heat_control.py View on Github external
    def _setup_sensor(self, temp, unit=TEMP_CELSIUS):
        """Setup the test sensor."""
        self.hass.states.set(ENT_SENSOR, temp, {
            ATTR_UNIT_OF_MEASUREMENT: unit
        })
github home-assistant / home-assistant / homeassistant / components / ambiclimate / climate.py View on Github external
def temperature_unit(self):
        """Return the unit of measurement which this thermostat uses."""
        return TEMP_CELSIUS
github kayjei / adax_wifi / climate.py View on Github external
def temperature_unit(self):
        """Return the unit of measurement which this device uses."""
        return TEMP_CELSIUS
github home-assistant / home-assistant / homeassistant / components / octoprint / __init__.py View on Github external
"Printing": ["printer", "state", "printing", None],
    "Printing Error": ["printer", "state", "error", None],
}

BINARY_SENSOR_SCHEMA = vol.Schema(
    {
        vol.Optional(
            CONF_MONITORED_CONDITIONS, default=list(BINARY_SENSOR_TYPES)
        ): vol.All(cv.ensure_list, [vol.In(BINARY_SENSOR_TYPES)]),
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    }
)

SENSOR_TYPES = {
    # API Endpoint, Group, Key, unit, icon
    "Temperatures": ["printer", "temperature", "*", TEMP_CELSIUS],
    "Current State": ["printer", "state", "text", None, "mdi:printer-3d"],
    "Job Percentage": ["job", "progress", "completion", "%", "mdi:file-percent"],
    "Time Remaining": ["job", "progress", "printTimeLeft", "seconds", "mdi:clock-end"],
    "Time Elapsed": ["job", "progress", "printTime", "seconds", "mdi:clock-start"],
}

SENSOR_SCHEMA = vol.Schema(
    {
        vol.Optional(CONF_MONITORED_CONDITIONS, default=list(SENSOR_TYPES)): vol.All(
            cv.ensure_list, [vol.In(SENSOR_TYPES)]
        ),
        vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    }
)

CONFIG_SCHEMA = vol.Schema(
github home-assistant / home-assistant / homeassistant / components / sensor / hive.py View on Github external
def unit_of_measurement(self):
        """Return the unit of measurement."""
        if self.device_type == "Hive_OutsideTemperature":
            return TEMP_CELSIUS
github home-assistant / home-assistant / homeassistant / components / danfoss_air / sensor.py View on Github external
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the available Danfoss Air sensors etc."""
    from pydanfossair.commands import ReadCommand

    data = hass.data[DANFOSS_AIR_DOMAIN]

    sensors = [
        [
            "Danfoss Air Exhaust Temperature",
            TEMP_CELSIUS,
            ReadCommand.exhaustTemperature,
            DEVICE_CLASS_TEMPERATURE,
        ],
        [
            "Danfoss Air Outdoor Temperature",
            TEMP_CELSIUS,
            ReadCommand.outdoorTemperature,
            DEVICE_CLASS_TEMPERATURE,
        ],
        [
            "Danfoss Air Supply Temperature",
            TEMP_CELSIUS,
            ReadCommand.supplyTemperature,
            DEVICE_CLASS_TEMPERATURE,
        ],
        [
            "Danfoss Air Extract Temperature",
            TEMP_CELSIUS,
            ReadCommand.extractTemperature,
            DEVICE_CLASS_TEMPERATURE,
        ],
        ["Danfoss Air Remaining Filter", "%", ReadCommand.filterPercent, None],
github home-assistant / home-assistant / homeassistant / components / netatmo / sensor.py View on Github external
SUPPORTED_PUBLIC_SENSOR_TYPES = [
    "temperature",
    "pressure",
    "humidity",
    "rain",
    "windstrength",
    "guststrength",
    "sum_rain_1",
    "sum_rain_24",
]

SENSOR_TYPES = {
    "temperature": [
        "Temperature",
        TEMP_CELSIUS,
        "mdi:thermometer",
        DEVICE_CLASS_TEMPERATURE,
    ],
    "co2": ["CO2", "ppm", "mdi:periodic-table-co2", None],
    "pressure": ["Pressure", "mbar", "mdi:gauge", None],
    "noise": ["Noise", "dB", "mdi:volume-high", None],
    "humidity": ["Humidity", "%", "mdi:water-percent", DEVICE_CLASS_HUMIDITY],
    "rain": ["Rain", "mm", "mdi:weather-rainy", None],
    "sum_rain_1": ["sum_rain_1", "mm", "mdi:weather-rainy", None],
    "sum_rain_24": ["sum_rain_24", "mm", "mdi:weather-rainy", None],
    "battery_vp": ["Battery", "", "mdi:battery", None],
    "battery_lvl": ["Battery_lvl", "", "mdi:battery", None],
    "battery_percent": ["battery_percent", "%", None, DEVICE_CLASS_BATTERY],
    "min_temp": ["Min Temp.", TEMP_CELSIUS, "mdi:thermometer", None],
    "max_temp": ["Max Temp.", TEMP_CELSIUS, "mdi:thermometer", None],
    "windangle": ["Angle", "", "mdi:compass", None],
github home-assistant / home-assistant / homeassistant / components / nws / weather.py View on Github external
def temperature(self):
        """Return the current temperature."""
        temp_c = None
        if self.observation:
            temp_c = self.observation.get("temperature")
        if temp_c:
            return convert_temperature(temp_c, TEMP_CELSIUS, TEMP_FAHRENHEIT)
        return None
github SebuZet / samsungrac / custom_components / climate_ip / properties.py View on Github external
from homeassistant.const import (
    STATE_UNKNOWN, STATE_OFF, STATE_ON, TEMP_CELSIUS, TEMP_FAHRENHEIT, 
)

CLIMATE_IP_PROPERTIES = []
CLIMATE_IP_STATUS_GETTER = []

PROPERTY_TYPE_MODE = 'modes'
PROPERTY_TYPE_SWITCH = 'switch'
PROPERTY_TYPE_NUMBER = 'number'
PROPERTY_TYPE_TEMP = 'temperature'
STATUS_GETTER_JSON = 'json_status'

UNIT_MAP = {
    'C': TEMP_CELSIUS,
    'c': TEMP_CELSIUS,
    'Celsius': TEMP_CELSIUS,
    'F': TEMP_FAHRENHEIT,
    'f': TEMP_FAHRENHEIT,
    'Fahrenheit': TEMP_FAHRENHEIT,
    TEMP_CELSIUS: TEMP_CELSIUS,
    TEMP_FAHRENHEIT: TEMP_FAHRENHEIT,
}

test_json = {'Devices':[{'Alarms':[{'alarmType':'Device','code':'FilterAlarm','id':'0','triggeredTime':'2019-02-25T08:46:01'}],'ConfigurationLink':{'href':'/devices/0/configuration'},'Diagnosis':{'diagnosisStart':'Ready'},'EnergyConsumption':{'saveLocation':'/files/usage.db'},'InformationLink':{'href':'/devices/0/information'},'Mode':{'modes':['Auto'],'options':['Comode_Off','Sleep_0','Autoclean_Off','Spi_Off','FilterCleanAlarm_0','OutdoorTemp_63','CoolCapa_35','WarmCapa_40','UsagesDB_254','FilterTime_10000','OptionCode_54458','UpdateAllow_0','FilterAlarmTime_500','Function_15','Volume_100'],'supportedModes':['Cool','Dry','Wind','Auto']},'Operation':{'power':'Off'},'Temperatures':[{'current':22.0,'desired':25.0,'id':'0','maximum':30,'minimum':16,'unit':'Celsius'}],'Wind':{'direction':'Fix','maxSpeedLevel':4,'speedLevel':0},'connected':True,'description':'TP6X_RAC_16K','id':'0','name':'RAC','resources':['Alarms','Configuration','Diagnosis','EnergyConsumption','Information','Mode','Operation','Temperatures','Wind'],'type':'Air_Conditioner','uuid':'C0972729-EB73-0000-0000-000000000000'}]}

def register_property(dev_prop):
    """Decorate a function to register a propery."""
    CLIMATE_IP_PROPERTIES.append(dev_prop)
    return dev_prop

def register_status_getter(getter):
github home-assistant / home-assistant / homeassistant / components / vera / sensor.py View on Github external
def update(self):
        """Update the state."""

        if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
            self.current_value = self.vera_device.temperature

            vera_temp_units = self.vera_device.vera_controller.temperature_units

            if vera_temp_units == "F":
                self._temperature_units = TEMP_FAHRENHEIT
            else:
                self._temperature_units = TEMP_CELSIUS

        elif self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
            self.current_value = self.vera_device.light
        elif self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
            self.current_value = self.vera_device.light
        elif self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
            self.current_value = self.vera_device.humidity
        elif self.vera_device.category == veraApi.CATEGORY_SCENE_CONTROLLER:
            value = self.vera_device.get_last_scene_id(True)
            time = self.vera_device.get_last_scene_time(True)
            if time == self.last_changed_time:
                self.current_value = None
            else:
                self.current_value = value
            self.last_changed_time = time
        elif self.vera_device.category == veraApi.CATEGORY_POWER_METER: