『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 5265|回复: 6

通过Aqara Opple无线场景开关的自动化演示下7.0引入的trigger id

[复制链接]

11

主题

313

帖子

1324

积分

金牌会员

Rank: 6Rank: 6

积分
1324
金钱
1011
HASS币
10
发表于 2021-7-14 15:02:20 | 显示全部楼层 |阅读模式
QQ图片20210714145231.jpg
Aqara Opple 无线场景开关6键版一直呆在收藏夹里都快忘记了,前两天群里有人晒图,我就又想起了这货,正好感觉床头的米家小圆饼按键太少了不方便,就买了一个回来。通过多模网关Xiaomi Gateway 3插件接入HA,每个按键比米家里多了长按释放和三击两个动作,总共可用的触发动作就是6x5=30个,当然一般人也用不了这么多。个人很不喜欢长按这个动作,因为效率太低了,三击是个很好的替代,按键时间会缩短很多。
分享一个刚设置好的自动化,用到了7.0正式引入的trigger id,简单说就是可以给触发条件自定义一个标签,触发动作时可以根据标签指定是由哪个条件触发的,挺实用的新特性,可以很方便的将以前分开设置的几个自动化合为一个。
QQ截图20210714145820.jpg
QQ截图20210714145954.jpg

id: '1626237442875'
alias: 老婆床头 - 六键开关
description: ''
trigger:
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_1_single
    to: button_1_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_1_double
    to: button_1_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_1_triple
    to: button_1_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_1_hold
    to: button_1_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_1_release
    to: button_1_release
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_2_single
    to: button_2_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_2_double
    to: button_2_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_2_triple
    to: button_2_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_2_hold
    to: button_2_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_2_release
    to: button_2_release
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_3_single
    to: button_3_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_3_double
    to: button_3_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_3_triple
    to: button_3_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_3_hold
    to: button_3_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_3_release
    to: button_3_release
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_4_single
    to: button_4_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_4_double
    to: button_4_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_4_triple
    to: button_4_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_4_hold
    to: button_4_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_4_release
    to: button_4_release
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_5_single
    to: button_5_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_5_double
    to: button_5_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_5_triple
    to: button_5_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_5_hold
    to: button_5_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_5_release
    to: button_5_release
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_6_single
    to: button_6_single
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_6_double
    to: button_6_double
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_6_triple
    to: button_6_triple
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_6_hold
    to: button_6_hold
  - platform: state
    entity_id: sensor.0x4cf8cdf3c7d9f83_action
    id: button_6_release
    to: button_6_release
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: button_1_single
        sequence:
          - type: toggle
            device_id: 333e3744be9987bf045145947720dcdf
            entity_id: light.yeelight_moon
            domain: light
      - conditions:
          - condition: trigger
            id: button_1_double
        sequence:
          - service: homeassistant.toggle
            target:
              entity_id: input_boolean.yeelink_moon_nightlight
      - conditions:
          - condition: trigger
            id: button_1_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击开关月亮灯,双击开关月光模式
      - conditions:
          - condition: trigger
            id: button_2_single
        sequence:
          - type: toggle
            device_id: d45ccad6506724b0369c7fea90a95d65
            entity_id: light.mi_jia_tai_deng
            domain: light
      - conditions:
          - condition: trigger
            id: button_2_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击开关台灯
      - conditions:
          - condition: trigger
            id: button_3_single
        sequence:
          - device_id: 333e3744be9987bf045145947720dcdf
            domain: light
            entity_id: light.yeelight_moon
            type: brightness_decrease
      - conditions:
          - condition: trigger
            id: button_3_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击降低月亮灯亮度
      - conditions:
          - condition: trigger
            id: button_4_single
        sequence:
          - device_id: 333e3744be9987bf045145947720dcdf
            domain: light
            entity_id: light.yeelight_moon
            type: brightness_increase
      - conditions:
          - condition: trigger
            id: button_4_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击增加月亮灯亮度
      - conditions:
          - condition: trigger
            id: button_5_single
        sequence:
          - device_id: d45ccad6506724b0369c7fea90a95d65
            domain: light
            entity_id: light.mi_jia_tai_deng
            type: brightness_decrease
      - conditions:
          - condition: trigger
            id: button_5_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击降低台灯亮度
      - conditions:
          - condition: trigger
            id: button_6_single
        sequence:
          - device_id: d45ccad6506724b0369c7fea90a95d65
            domain: light
            entity_id: light.mi_jia_tai_deng
            type: brightness_increase
      - conditions:
          - condition: trigger
            id: button_6_hold
        sequence:
          - service: xiaomi_miot_raw.speak_text
            data:
              entity_id: media_player.21_cloud_143935
              text: 单击增加台灯亮度
    default: []
mode: single
QQ图片20210714145403.png
给老婆用的,所以只有第一个按键设置了单击、双击具体功能,其他按键只有单击有具体功能,所有按键长按小爱音箱会tts播报该按键的功能。等后面再买一个自己用,给它设个24个动作,

评分

参与人数 1金钱 +5 收起 理由
tt123511 + 5 感谢楼主分享!

查看全部评分

回复

使用道具 举报

0

主题

1

帖子

16

积分

新手上路

Rank: 1

积分
16
金钱
15
HASS币
0
发表于 2021-8-28 07:50:35 | 显示全部楼层
请问opple 场景开关可以透过Xiaomi Gateway 3插件接入HA后,然后在反带回apple homekit吗?我想让他在homekit面也使用
回复

使用道具 举报

0

主题

115

帖子

913

积分

高级会员

Rank: 4

积分
913
金钱
798
HASS币
0
发表于 2021-10-25 15:13:16 | 显示全部楼层
666 像楼主学习
回复

使用道具 举报

0

主题

152

帖子

1456

积分

金牌会员

Rank: 6Rank: 6

积分
1456
金钱
1304
HASS币
0
发表于 2021-11-17 12:26:56 | 显示全部楼层
你好,请问是通过什么接入的,我的通过多模接入,但是没有操作状态
回复

使用道具 举报

11

主题

313

帖子

1324

积分

金牌会员

Rank: 6Rank: 6

积分
1324
金钱
1011
HASS币
10
 楼主| 发表于 2021-11-17 20:02:18 | 显示全部楼层
13990973177 发表于 2021-11-17 12:26
你好,请问是通过什么接入的,我的通过多模接入,但是没有操作状态

就是通过多模接入的啊
回复

使用道具 举报

0

主题

152

帖子

1456

积分

金牌会员

Rank: 6Rank: 6

积分
1456
金钱
1304
HASS币
0
发表于 2021-11-19 15:52:02 | 显示全部楼层
我删了再试一试谢谢
回复

使用道具 举报

0

主题

115

帖子

913

积分

高级会员

Rank: 4

积分
913
金钱
798
HASS币
0
发表于 2021-11-19 22:30:28 | 显示全部楼层
本帖最后由 xiaoo 于 2021-11-19 22:33 编辑

NB,向楼主学习了,发现这个还可以设置四击,六键的话一共可设置30种功能 (长按和释放好像只能算一种吧)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-27 18:38 , Processed in 0.250934 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表