本文整理匯總了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()