本文整理汇总了Python中homeassistant.const.ATTR_TEMPERATURE属性的典型用法代码示例。如果您正苦于以下问题:Python const.ATTR_TEMPERATURE属性的具体用法?Python const.ATTR_TEMPERATURE怎么用?Python const.ATTR_TEMPERATURE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类homeassistant.const
的用法示例。
在下文中一共展示了const.ATTR_TEMPERATURE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: async_set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
target_temperature = kwargs.get(ATTR_TEMPERATURE)
if target_temperature is None:
return False
_LOGGER.info("Setting temperature for %s to %s", self.name, target_temperature)
await self.hass.async_add_executor_job(
partial(
self.data.wiserhub.setRoomTemperature, self.room_id, target_temperature,
)
)
self._force_update = True
await self.async_update_ha_state(True)
return True
示例2: set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def set_temperature(self, **kwargs):
""" Set new target temperature. """
response = self.json_request({"SET_TEMP": [int(kwargs.get(ATTR_TEMPERATURE)), self._name]})
if response:
_LOGGER.info("set_temperature response: %s " % response)
# Need check for success here
# {'result': 'temperature was set'}
示例3: async_set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is None:
return
await self.device.set_target_temperature(temperature)
self.async_write_ha_state()
示例4: set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def set_temperature(self, **kwargs):
"""Set new target temperatures."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
temp = int(kwargs.get(ATTR_TEMPERATURE) * 100)
if self.preset_mode == 'away':
attr = 0x0014
else:
attr = 0x0012
self.hass.data[ZIGATE_DOMAIN].write_attribute_request(self._device.addr,
self._endpoint,
0x0201,
[(attr, 0x29, temp)])
self.schedule_update_ha_state()
示例5: async_set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
_LOGGER.debug("Setting temperature for: %s", self.instrument.attr)
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature:
await self.instrument.set_temperature(temperature)
示例6: async_set_temperature
# 需要导入模块: from homeassistant import const [as 别名]
# 或者: from homeassistant.const import ATTR_TEMPERATURE [as 别名]
def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
if kwargs.get(ATTR_TEMPERATURE) is not None:
self._device.target_temperature = int(kwargs.get(ATTR_TEMPERATURE))
self._changed = True
self.async_schedule_update_ha_state()