Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FAQ]红外风扇或者其他平台绑定到米家的风扇如何通过本插件接入HA? #128

Closed
al-one opened this issue Jul 9, 2021 · 2 comments
Labels
device: fan FAQ Frequently Asked Questions

Comments

@al-one
Copy link
Owner

al-one commented Jul 9, 2021

  1. 首先你得有一个通过本插件接入HA的小爱
  2. 新建一个开关辅助元素:input_boolean.xiaoai_fan_state
  3. 配置文件加入下面的YAML
# configuration.yaml
fan:
  - platform: template
    # https://www.home-assistant.io/integrations/fan.template
    fans:
      xiaoai_fan:
        friendly_name: "小爱风扇"
        value_template: "{{ states('input_boolean.xiaoai_fan_state') }}"
        percentage_template: 0
        preset_mode_template: ""
        oscillating_template: false
        speed_count: 3
        preset_modes:
          - 直吹风
          - 自然风
        turn_on:
          - service: xiaomi_miot.intelligent_speaker
            data:
              entity_id: media_player.xiaoai_entity_id # 改成你的小爱实体ID
              text: 打开风扇
              execute: true
              silent: true
          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.xiaoai_fan_state
        turn_off:
          - service: xiaomi_miot.intelligent_speaker
            data:
              entity_id: media_player.xiaoai_entity_id # 改成你的小爱实体ID
              text: 关闭风扇
              execute: true
              silent: true
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.xiaoai_fan_state
        set_percentage:
          service: xiaomi_miot.intelligent_speaker
          data:
            entity_id: media_player.xiaoai_entity_id # 改成你的小爱实体ID
            text: "风扇风速调到{{ percentage }}"
            execute: true
            silent: true
        set_preset_mode:
          service: xiaomi_miot.intelligent_speaker
          data:
            entity_id: media_player.xiaoai_entity_id # 改成你的小爱实体ID
            text: "风扇模式切换为{{ preset_mode }}"
            execute: true
            silent: true
        set_oscillating:
          service: xiaomi_miot.intelligent_speaker
          data:
            entity_id: media_player.xiaoai_entity_id
            text: "{{ '风扇摇头' if oscillating else '风扇停止摇头' }}"
            execute: true
            silent: true

如果想通过空调伴侣实现可以参考:#136 (comment)

@al-one al-one changed the title 红外风扇或者其他平台绑定到米家的风扇如何通过本插件接入HA? [FAQ]红外风扇或者其他平台绑定到米家的风扇如何通过本插件接入HA? Jul 9, 2021
@al-one al-one closed this as completed Jul 9, 2021
@al-one al-one added the FAQ Frequently Asked Questions label Jul 9, 2021
@cclucky1
Copy link

cclucky1 commented Apr 8, 2024

您好,请问通过其他平台接入但不是红外遥控,小爱同学控制的设备是不是也只能通过控制小爱同学执行语音指令的方式去执行

@al-one
Copy link
Owner Author

al-one commented Apr 9, 2024

您好,请问通过其他平台接入但不是红外遥控,小爱同学控制的设备是不是也只能通过控制小爱同学执行语音指令的方式去执行

@cclucky1 可以,标题有写。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device: fan FAQ Frequently Asked Questions
Projects
None yet
Development

No branches or pull requests

2 participants