automation:
- alias: Stop XiaoAi Music at Night
description: "Stop XiaoAi music from 9 PM to 9 AM"
trigger:
- platform: state
entity_id: media_player.xiaoai # 请将这个更改为你的小爱设备的entity_id
to: 'playing'
condition:
- condition: time
after: '21:00:00'
- condition: time
before: '09:00:00'
action:
- service: media_player.turn_off
target:
entity_id: media_player.xiaoai # 请将这个更改为你的小爱设备的entity_id