HomeAssistant(8) - HelloMorningStar/HomeAssistant GitHub Wiki
提到米家互联网空调,吐槽:homeassistant居然没有控制组件,小米红外外能遥控也没有该设备的库,只好用学习功能,郁闷!
空调采用MQTT HAV和小米IR remote进行控制:
- 用input_boolean制作一个布尔开关
input_boolean: airconditioner1: name: AC1 initial: off
- 用remote学习和制作红外控制码
remote: - platform: xiaomi_miio name: "主卧遥控器" host: 192.168.x.xx token: 1xxxa9c3ea7xx23dbeexxxxxfc79xxx3 slot: 1 timeout: 30 hidden: false commands: activate_power_on_dehumidification: command: - raw:Z6XzAO8BAABRAgAAIAYAABEQAADnIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA$ activate_power_off_dehumidification: command: - raw:Z6XzANQBAAD+AQAAQQIAABYGAAA/BgAAMhAAAMogAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA$
- 在script.yaml中添加描述, 在自动化的action中需要调用script service
xiaomi_air_conditioner_power_on: sequence: - service: remote.send_command entity_id: 'remote.zhu_wo_yao_kong_qi' data: command: - 'activate_power_on_dehumidification' xiaomi_air_conditioner_power_off: sequence: - service: remote.send_command entity_id: 'remote.zhu_wo_yao_kong_qi' data: command: - 'activate_power_off_dehumidification'
- 在自动化中实现开关控制功能
- alias: turn on the AC1 hide_entity: true trigger: platform: state entity_id: input_boolean.airconditioner1 from: 'off' to: 'on' action: # - service: ifttt.trigger # data: {"event": "input_boolean.light1"} - service: script.xiaomi_air_conditioner_power_on entity_id: input_boolean.airconditioner1 - alias: turn off the AC1 hide_entity: true trigger: platform: state entity_id: input_boolean.airconditioner1 from: 'on' to: 'off' action: # - service: ifttt.trigger # data: {"event": "input_boolean.light1"} - service: script.xiaomi_air_conditioner_power_off entity_id: input_boolean.airconditioner1
- 在group中作一张卡片
master_bedroom_climates: name: 主卧Climates entities: - input_boolean.airconditioner1 #主卧空调开关
HVAC (Heating, Ventilation and Air Conditioning)
参考此文以及另外一篇文章,大概分为以下几个步骤:
1)安装MQTT客户端,安装MQTT库,运行客户端;
2)配置configuration.yaml;
3)测试;
4)将MQTT客户端作为服务运行
以上理论可行,不过我目前用的是小米ir,不能用MQTT,好在有一个componets
5) 关于使用customer components时,去github将components克隆到本地,然后将相应的componets复制到/.homeassistant/customer_components/目录下,在yaml文件中按照例子进行配置即可使用
it's a good tool
about climate, try these codes:
climate: - platform: xiaomi_miio_airconditioningcompanion name: Aqara Air Conditioning Companion host: 192.168.2.60 token: 4b02fc51d38a target_sensor: sensor.temperature_158d000159f05a scan_interval: 60 - platform: xiaomi_miio_airconditioningcompanion name: Xiaomi Air Conditioning Companion host: 192.168.2.125 token: 73a8d7000799d58d target_sensor: sensor.temperature_158d00015319a6 scan_interval: 60 - platform: xiaomi_remote name: N-AC remote: remote.bei_wo_shi_yao_kong_qi commands: !include mijia-internet-aircondictioner.yaml temp_sensor: sensor.temperature_158d000159f05a # power_template: "{{ states.climate.aqara_air_conditioning_companion.attributes[load_power] | float > 10 }}" power_template: "{{ states.climate.aqara_air_conditioning_companion.attributes['load_power'] | float > 15 }}" min_temp: 16 max_temp: 32 target_temp: 24 target_temp_step: 1 # operation_mode: cool hvac_mode: 'off' fan_mode: auto customize: hvac_modes: - 'off' - cool - heat - dry - fan_only - auto fan_modes: # - low # - medium # - high - auto # commands: #!include Roda-YKR-H-102E.yaml - platform: xiaomi_remote name: 主卧空调 remote: remote.zhu_wo_yao_kong_qi commands: !include Roda-YKR-H-102E.yaml temp_sensor: sensor.temperature_158d00015319a6 power_template: "{{ states.climate.xiaomi_air_conditioning_companion.attributes['load_power'] | float > 15 }}" # power_template: "{{ states('sensor.plug_power_158d0002366887') | float > 50 }}" min_temp: 16 max_temp: 32 target_temp: 24 target_temp_step: 1 # operation_mode: cool hvac_mode: 'off' fan_mode: auto customize: hvac_modes: - 'off' - cool - heat - dry - fan_only - auto fan_modes: # - low # - medium # - high - auto