- 积分
- 344
- 金钱
- 274
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 344
- 金钱
- 274
- HASS币
- 0
|
发表于 2019-4-2 00:15:03
|
显示全部楼层
这个问题已经解决
自动化里监控小度音箱的播放进度,,如果进度和总长相等,就停止,恢复idle状态,,亲测,可行
自动化代码如下:
- alias: xiaodu_reset
trigger:
- platform: event
event_type: time_changed
condition:
- condition: state
entity_id: media_player.xiaodu
state: 'playing'
- condition: template
value_template: >
{% if (states.media_player.xiaodu.attributes.media_position | int) == (states.media_player.xiaodu.attributes.media_duration | int) %}
true
{% else %}
false
{% endif %}
action:
- service: media_player.play_media
data:
entity_id: media_player.xiaodu
media_content_id: http://192.168.2.10/test/1.mp3
#这里播放地址自己换一个就可以了
media_content_type: music
- service: media_player.media_stop
entity_id: media_player.xiaodu |
|