2024年11月22日星期五 下午4:25:34

小爱音箱-xiaomi miot auto integration -上班前自动报告时间(每5分钟)global | A - every 5 minute time-pattern-trigger say time - media_player.wifipuffer1c tts.edge_tts_say dlna xiaodu speaker

1 年 前
#20921 引用
小爱音箱-xiaomi miot auto -上班前自动报告时间(每5分钟)


global | A - every 5 minute time-pattern-trigger say time - media_player.wifipuffer1c tts.edge_tts_say dlna xiaodu speaker

http://192.168.2.50:8123/config/automation/edit/1693846834258

小爱音箱整点报时 -global | A - every 60 minute time-pattern-trigger say time xiaoai player pro via xiaomi_miot.intelligent_speaker
http://192.168.2.50:38123/config/automation/edit/1704513541809
0
1 年 前
#20922 引用
1. 小爱音箱dlna功能需要在app里打开
2.等待些时间,ha应该能扫描到Digital Media Renderer自动发现小爱

不同小爱音箱,没有dlna功能

推送的意思是让AI按我的媒体地址播放广播

输入文本,TTS让小爱音箱朗读出来

xiaomi_miot.intelligent_speaker   测试功能正常!
Home Assistant Core 2023.9.3

Version  core-2023.9.3
Installation Type  Home Assistant Core
Development  false
Supervisor  false
Docker  false
User  homeassistant20221103
Virtual Environment  true
Python Version  3.11.5
Operating System Family  Linux
Operating System Version  6.1.53-v7+
CPU Architecture  armv7l
Timezone  Asia/Shanghai
Configuration Directory  /home/homeassistant20221103/.homeassistant
0
1 年 前
#20923 引用
小爱音箱语音播报指定文字工作原理

xiaomi miot auto插件集成小爱音响后,会得到一个media_player实体(
entity_id: media_player.xiaoai_entity_id   
entity_id: media_player.xiaomi_lx06_026c_play_control)

xiaomi miot auto插件为小爱提供了xiaomi_miot.intelligent_speaker服务
在ha中,调用xiaomi_miot.intelligent_speaker服务,可以让小爱音箱将自定义的文字内容传递给
entity_id: media_player.xiaomi_lx06_026c_play_control
实现TTS语音播报 。

服务xiaomi_miot.intelligent_speaker仅將文本发送给小爱音箱,TTS是在小爱内部进行的,插件无法播报时长,也不知道什么时候结束。
0
1 年 前
#20924 引用

step 1.create a New A
0
1 年 前
#20925 引用
step 2.让小爱同学播放文本(TTS)

https://github.com/al-one/hass-xiaomi-miot/issues/100#issuecomment-885989099

播放文本(TTS)
service: xiaomi_miot.intelligent_speaker
data:
  entity_id: media_player.xiaoai_entity_id
  text: 你好
  execute: false # 不执行,朗读text文本


小爱执行语音命令(控制米家设备)

service: xiaomi_miot.intelligent_speaker
data:
  entity_id: media_player.xiaomi_entity_id
  text: 打开客厅的小米电视
  execute: true # true执行语音命令
  silent: true  # true为静默执行,小爱音响不回应执行结果


0
1 年 前
#20926 引用
step 3.Test the Automation  run ok
http://192.168.2.50:8123/config/automation/edit/1688414079097



alias: >-
  Bedroom | New Automation - xiaoai pro speak time auto
  -xiaomi_miot.intelligent_speaker
description: http://localhost:4999/boards/topic/14616/8#20924
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: state
    entity_id: media_player.xiaomi_lx06_026c_play_control
    state: idle
  - condition: template
    value_template: "{{ is_state(\"media_player.xiaomi_lx06_026c_play_control\", \"idle\")}}"
  - condition: time
    after: "07:00:00"
    before: "09:00:00"
action:
  - service: xiaomi_miot.intelligent_speaker
    data:
      execute: false
      silent: true
      throw: false
      entity_id: media_player.xiaomi_lx06_026c_play_control
      text: 现在时时间{{ now().strftime('%H点%M分') }}
mode: single





run ok
0
10 个月 前
#26297 引用



alias: global | A - every 5 minute time-pattern-trigger say time
description: >-
  https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger
  https://github.com/al-one/hass-xiaomi-miot/issues/537
  https://bbs.hassbian.com/thread-5609-1-1.html
  https://zhuanlan.zhihu.com/p/623197380 #strftime('%Y-%m-%d %H:%M:%S')
  #本例中,字符串格式为‘年-月-日 时:分:秒’
trigger:
  - platform: time_pattern
    minutes: /5
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: time
                after: "07:00:00"
                before: "09:00:00"
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%H时%M分') }}
      - conditions:
          - condition: and
            conditions:
              - condition: time
                after: "07:25:00"
                before: "07:26:00"
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%Y-%m-%d %H:%M:%S') }}
    default: []
mode: single


0
9 个月 前
#28508 引用


alias: >-
  global | A - every 5 minute time-pattern-trigger say time -
  media_player.wifipuffer1c
description: >-
  https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger
  https://github.com/al-one/hass-xiaomi-miot/issues/537
  https://bbs.hassbian.com/thread-5609-1-1.html
  https://zhuanlan.zhihu.com/p/623197380 #strftime('%Y-%m-%d %H:%M:%S')
  http://localhost:4999/boards/topic/14616/%E5%B0%8F%E7%88%B1%E9%9F%B3%E7%AE%B1-xiaomi-miot-auto-integration-%E4%B8%8A%E7%8F%AD%E5%89%8D%E8%87%AA%E5%8A%A8%E6%8A%A5%E5%91%8A%E6%97%B6%E9%97%B4%E6%AF%8F5%E5%88%86%E9%92%9F
  #本例中,字符串格式为‘年-月-日 时:分:秒’
trigger:
  - platform: time_pattern
    minutes: /5
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: time
                after: "07:00:00"
                before: "09:00:00"
          - condition: state
            entity_id: binary_sensor.workday_sensor
            state: "on"
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%H点%M分') }}
      - conditions:
          - condition: and
            conditions:
              - condition: time
                after: "07:25:00"
                before: "07:26:00"
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%Y-%m-%d %H:%M:%S') }}
    default: []
mode: single


0
8 个月 前
#29720 引用
Add  binary_sensor.workday_sensor  run ok

alias: >-
  Bedroom | New Automation - xiaoai pro speak time auto
  -xiaomi_miot.intelligent_speaker
description: http://localhost:4999/boards/topic/14616/8#20924
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: state
    entity_id: media_player.xiaomi_lx06_026c_play_control
    state: idle
  - condition: template
    value_template: "{{ is_state(\"media_player.xiaomi_lx06_026c_play_control\", \"idle\")}}"
  - condition: time
    after: "07:00:00"
    before: "09:00:00"
  - condition: state
    entity_id: binary_sensor.workday_sensor
    state: "on"
action:
  - service: xiaomi_miot.intelligent_speaker
    data:
      execute: false
      silent: true
      throw: false
      entity_id: media_player.xiaomi_lx06_026c_play_control
      text: 现在时间{{ now().strftime('%H点%M分') }}
mode: single


output


Triggered by the time pattern at March 16, 2024 at 08:45:00
Test Confirm Mi AI Speaker Pro Play Control is Idle
Test Test if template renders a value equal to true
Test Confirm the time is after 07:00 and before 09:00
Test Confirm Workday Sensor is On
Stopped because a condition failed at March 16, 2024 at 08:45:00 (runtime: 0.00 seconds)

0