本帖最后由 25989406 于 2019-4-27 22:18 编辑
主要适用于之前菲佣的日立空调插件hitachi.py
其他类似的博联插件原理应该一样,仅供参考另外博联机顶盒插件使用的功能太复杂,目前还没看懂修改点。。。
老的代码
from homeassistant.components.climate import (
ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_OPERATION_MODE,
PLATFORM_SCHEMA, STATE_COOL, STATE_DRY,
STATE_FAN_ONLY, STATE_HEAT, STATE_OFF, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
ClimateDevice)
from homeassistant.const import (
TEMP_CELSIUS, ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME, CONF_HOST, CONF_MAC, CONF_TIMEOUT)
新代码,主要是一些homeassistant的基础常量引用方式发生了改变
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_OPERATION_MODE, STATE_COOL, STATE_DRY,
STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import (
STATE_OFF, TEMP_CELSIUS, ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME, CONF_HOST, CONF_MAC, CONF_TIMEOUT)
|