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

Aqara空调伴侣(升级版)如何使用自定义红外码 #136

Closed
cairy opened this issue Jul 18, 2021 · 10 comments
Closed

Aqara空调伴侣(升级版)如何使用自定义红外码 #136

cairy opened this issue Jul 18, 2021 · 10 comments

Comments

@cairy
Copy link

cairy commented Jul 18, 2021

Aqara空调伴侣(升级版) 可以接入和控制,设备信息为lumi.acpartner.v3 by lumi
我想自定义关闭空调的红外码。点击“关闭”时发送
FE00978022222194701fff7F0507008C27DA003C00A801C4038107D40FA913883201000000000000000100010100000000000000000000000100000000010001000001000400000000000000000000000000010000000000000000000000000000000100010532010000000000000001000101000000000000000000000001000000000101010000010004000000000000000000000000000000000000000000000000000000000000000106E7
想请教如何实现。
另外,Aqara空调伴侣(升级版)可以发送红外控制其他电器。比如控制风扇。请问如何设置?
初次使用HomeAssistant,有点一头雾水,请见谅。

@al-one
Copy link
Owner

al-one commented Jul 18, 2021

如果有小爱同学的话,可以通过HA服务执行小爱语音命令来控制红外设备。具体是在米家添加一个可以小爱控制的手动场景,然后通过xiaomi_miot.intelligent_speaker服务执行语音命令。
如果没有小爱同学,可以通过修改版米家APP获取空调伴侣的发送红外的miio命令,然后通过xiaomi_miot.send_command服务执行miio命令。
服务可以应用于脚本、自动化、template实体调用。

@cairy
Copy link
Author

cairy commented Jul 18, 2021

我没有小爱同学。红外码我都有,之前在homebridge里用过,但是这里我不知道怎么用。通过xiaomi_miot.send_command服务怎么执行,是改services.yaml那个文件还是在Home Assistant App里面改?可否给个示例?

替换 空调 默认的 关闭 按钮 红外发射码 这个是不能实现吗?

感谢您的回答。

@al-one
Copy link
Owner

al-one commented Jul 18, 2021

你可以把支持该设备的homebridge插件地址或者名称给我,我看下其源码中的miio命令。
通过开发者工具调用服务:xiaomi_miot.send_command

替换 空调 默认的 关闭 按钮 红外发射码 这个是不能实现吗?

无法替换climate实体的关闭按钮,不过你可以参考这里使用template switch + 服务模拟出一个开关实体。

@cairy
Copy link
Author

cairy commented Jul 18, 2021

非常感谢。
插件地址是 homebridge-mi-acpartner,最近几年都没有更新了。在ios中最近经常无法使用,温度变成0,无法控制,所以就想换到Home Assistant来。
模拟开关我改天尝试一下,初次使用,见谅😄。

@al-one
Copy link
Owner

al-one commented Jul 18, 2021

service: xiaomi_miot.send_command
data:
  entity_id: climate.lumi_acpartner_entity_id
  method: send_ir_code
  params:
    - FE00ABCDEF # IR Code

@al-one
Copy link
Owner

al-one commented Jul 19, 2021

使用template switch + 服务的实例:

# configuration.yaml
switch:
  - platform: template
    switches:
      lumi_acpartner_ir:
        value_template: "{{ is_state('climate.lumi_acpartner_entity_id', 'on') }}"
        turn_on:
          service: climate.turn_on
          target:
            entity_id: climate.lumi_acpartner_entity_id
        turn_off:
          service: xiaomi_miot.send_command
          data:
            entity_id: climate.lumi_acpartner_entity_id
            method: send_ir_code
            params:
              - FE00ABCDEF # IR Code

@cairy
Copy link
Author

cairy commented Jul 20, 2021

非常感谢。我写的是这样的,美的的风扇可以了。自定义的空调开关还没测。

fan:
  - platform: template
    # https://www.home-assistant.io/integrations/fan.template
    fans:
      woshi_fan:
        friendly_name: "卧室风扇"
        value_template: "{{ states('input_boolean.woshi_fan_state') }}"
        percentage_template: 0
        preset_mode_template: ""
        speed_count: 3
        preset_modes:
          - 静音
        turn_on:
          - service: xiaomi_miot.send_command
            data:
              entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
              method: send_ir_code
              params:
                - FE0000000000000000000000000500322257003600A701BC036E13883201000000000000000001010101010101010100000000000000000101010101010101000000000000000001010101010104F4 # IR Code
          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.woshi_fan_state
        turn_off:
          - service: xiaomi_miot.send_command
            data:
              entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
              method: send_ir_code
              params:
                - FE0000000000000000000000000500322257003600A701BC036E13883201000000000000000001010101010101010100000000000000000101010101010101000000000000000001010101010104F4 # IR Code
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.woshi_fan_state
        set_percentage:
          service: xiaomi_miot.send_command
          data:
            entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
            method: send_ir_code
            params:
              - FE00000000000000000000000006003222580033003C00A901BA0370138843020101000101010100020202020202020202020101000101010000020202020202020201010100000101010202020202056A # IR Code
        set_preset_mode: #模式
          service: xiaomi_miot.send_command
          data:
            entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
            method: send_ir_code
            params:
              - FE000000000000000000000000080036225E003500A800DF01BD0370052E13882523430100000000000000000101010101010100000000010001000101010100010001000000000100010001010101000100010542074206F4 # IR Code
switch:
  - platform: template
    switches:
      lumi_acpartner_ir:
        friendly_name: "空调开关"
        value_template: "{{ is_state('climate.kong_diao_cha_zuo_air_conditioner', 'on') }}"
        turn_on:
          service: climate.turn_on
          target:
            entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
        turn_off:
          service: xiaomi_miot.send_command
          data:
            entity_id: climate.kong_diao_cha_zuo_air_conditioner # 实体ID
            method: send_ir_code
            params:
              - FE00978022222194701fff7F0507008C27DA003C00A801C4038107D40FA913883201000000000000000100010100000000000000000000000100000000010001000001000400000000000000000000000000010000000000000000000000000000000100010532010000000000000001000101000000000000000000000001000000000101010000010004000000000000000000000000000000000000000000000000000000000000000106E7 # IR Code

@dpf1025
Copy link

dpf1025 commented Aug 20, 2022

A大,您说:如果没有小爱同学,可以通过修改版米家APP获取空调伴侣的发送红外的miio命令,然后通过xiaomi_miot.send_command服务执行miio命令。这个怎么抓取命令

@al-one
Copy link
Owner

al-one commented Aug 25, 2022

@dpf1025 空调伴侣需要通过vevs修改的米家添加红外按键并抓取日志中的红外码。

@YosenFree
Copy link

@dpf1025空调修改米家需要添加的红外码并提取日志中的红外码。

大佬,在日志中提取空调伴侣红外码的关键字是什么呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants