请选择 进入手机版 | 继续访问电脑版

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

 找回密码
 立即注册
查看: 39117|回复: 72

[经验分享] VLC网络广播

  [复制链接]

4

主题

171

帖子

1577

积分

金牌会员

Rank: 6Rank: 6

积分
1577
金钱
1406
HASS币
0
发表于 2017-5-10 14:08:14 | 显示全部楼层 |阅读模式
首先在树莓派中安装VLC-NOX,链接putty:
sudo apt-get install vlc-nox
sudo usermod -a -G audio homeassistant
speaker-test

如果能在树莓派的耳机插口中听到“沙沙”的声音,说明VLC工作正常了!
在Configuration.yaml中加入
media_player :
  - platform: vlc
    name: VLC player

homeassistant中出现如下组件
r2.JPG
###############Configuration.yaml中配置网络广播###################
将以下代码添加到Configuration.yaml中
#选择频道
input_select:
  radio_station:
    name: '广播频道:'
    options:
      - 100% NL
      - Veronica
      - Classic FM
      - Sleep Radio
      - Radio Art - Sleep
      - Ambi Nature Radio
      - Calm Radio - Sleep
      - Dinamo.FM Sleep
      - 89.9 The Wave

#选择播放器
  home_radio:
    name: '播放音源:'
    options:
      - "VLC 播放器"
      - "主卧播放器"
      - "客厅播放器"
    initial: "VLC 播放器"
    icon: mdi:speaker-wireless

#音量划杆
input_slider:
  volume_radio:
    name: '音量调节'
    icon: mdi:volume-high
    min: 0
    max: 1
    step: 0.05

#播放脚本
script:
  radio_house:
    alias: '开始播放'
    sequence:
      - service: media_player.volume_set
        data_template:
          entity_id: >
            {% if is_state("input_select.home_radio", "VLC 播放器") %} media_player.vlc_player
            {% elif is_state("input_select.home_radio", "主卧播放器") %} media_player.bedroom_kodi
            {% elif is_state("input_select.home_radio", "客厅播放器") %} media_player.livingroom_kodi
            {% endif %}
          volume_level: '{{  states.input_slider.volume_radio.state  }}'
      - service: media_player.play_media

        data_template:
          entity_id: >
            {% if is_state("input_select.home_radio", "VLC 播放器") %} media_player.vlc_player
            {% elif is_state("input_select.home_radio", "主卧播放器") %} media_player.bedroom_kodi
            {% elif is_state("input_select.home_radio", "客厅播放器") %} media_player.livingroom_kodi
            {% endif %}
          media_content_id: >
            {% if is_state("input_select.radio_station", "100% NL") %}
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %}
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% elif is_state("input_select.radio_station", "89.9 The Wave") %} http://chns.streamon.fm/
            {% endif %}
          media_content_type: 'music'


automation:
  - alias: 'Set Radio Volume'
    trigger:
      - platform: state
        entity_id: input_slider.volume_radio
    action:
      - service: media_player.volume_set
        data_template:
          entity_id: >
            {% if is_state("input_select.home_radio", "VLC 播放器") %} media_player.vlc_player
            {% elif is_state("input_select.home_radio", "主卧播放器") %} media_player.bedroom_kodi
            {% elif is_state("input_select.home_radio", "客厅播放器") %} media_player.livingroom_kodi
            {% endif %}
          volume_level: '{{  states.input_slider.volume_radio.state  }}'

      - service: media_player.play_media
        data_template:
          entity_id: >
            {% if is_state("input_select.home_radio", "VLC 播放器") %} media_player.vlc_player
            {% elif is_state("input_select.home_radio", "主卧播放器") %} media_player.bedroom_kodi
            {% elif is_state("input_select.home_radio", "客厅播放器") %} media_player.livingroom_kodi
            {% endif %}
          media_content_id: >
            {% if is_state("input_select.radio_station", "100% NL") %}
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %}
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% elif is_state("input_select.radio_station", "89.9 The Wave") %} http://chns.streamon.fm/
            {% endif %}
          media_content_type: 'music'


#播放面板分组
group:
  play_media_radio:
    view: no
    name: '播放面板'
   icon: mdi:view-dashboard
    entities:
      - input_select.radio_station
      - input_select.home_radio
      - input_slider.volume_radio
      - script.radio_house

安装正常后homeassistant中会出现如下组件:
r1.JPG

评分

参与人数 1金钱 +5 收起 理由
lidicn + 5 很给力!

查看全部评分

回复

使用道具 举报

7

主题

156

帖子

1327

积分

论坛技术达人

积分
1327
金钱
1171
HASS币
0
发表于 2017-5-10 15:18:17 | 显示全部楼层
学习学习
回复

使用道具 举报

25

主题

688

帖子

3630

积分

论坛元老

Rank: 8Rank: 8

积分
3630
金钱
2937
HASS币
219

活跃会员

发表于 2017-5-10 15:45:49 | 显示全部楼层
学习了,没有树莓派,在研究黑群晖的声音输出中
回复

使用道具 举报

30

主题

999

帖子

4117

积分

论坛元老

Rank: 8Rank: 8

积分
4117
金钱
3113
HASS币
0

活跃会员

发表于 2017-5-10 15:46:56 来自手机 | 显示全部楼层
谢谢分享!
回复

使用道具 举报

4

主题

28

帖子

144

积分

注册会员

Rank: 2

积分
144
金钱
106
HASS币
0
发表于 2017-5-11 14:41:06 | 显示全部楼层
感谢楼主分享
回复

使用道具 举报

4

主题

171

帖子

1577

积分

金牌会员

Rank: 6Rank: 6

积分
1577
金钱
1406
HASS币
0
 楼主| 发表于 2017-5-13 10:38:49 | 显示全部楼层
再分享一些广播网址,亲测可用:
   (Evropa 2)
  (Frekvence 1)
  (Country Radio)
   (DR P7 Mix)
   (Radio 100FM)
   (80s Music HotMixRadio)
http://94.23.40.70:8010  (Radio METAL)摇滚迷应该会比较喜欢
http://sc2.dubplate.fm:5000/DnB/192    (Dubplate.fm - Drum & Bass)电子音乐
http://sc2.dubplate.fm:5000/dubstep/192  (Dubplate.fm - Dubstep)还是电子音乐
大部分为音乐广播,后期持续更新中。。。。。
回复

使用道具 举报

25

主题

688

帖子

3630

积分

论坛元老

Rank: 8Rank: 8

积分
3630
金钱
2937
HASS币
219

活跃会员

发表于 2017-5-13 16:39:12 | 显示全部楼层
能不能通过群晖的蓝牙输出vlc player声音
回复

使用道具 举报

4

主题

171

帖子

1577

积分

金牌会员

Rank: 6Rank: 6

积分
1577
金钱
1406
HASS币
0
 楼主| 发表于 2017-5-13 23:56:51 | 显示全部楼层
aktifin 发表于 2017-5-13 16:39
能不能通过群晖的蓝牙输出vlc player声音

应该是可以的,群晖连接蓝牙音箱
回复

使用道具 举报

1

主题

47

帖子

172

积分

注册会员

Rank: 2

积分
172
金钱
125
HASS币
0
发表于 2017-5-14 20:27:45 | 显示全部楼层
谢谢分享!!!!!!
回复

使用道具 举报

0

主题

10

帖子

84

积分

版主

Rank: 7Rank: 7Rank: 7

积分
84
金钱
74
HASS币
0
发表于 2017-5-21 18:06:17 | 显示全部楼层
照您的教程可以使用,谢谢
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-3-29 22:22 , Processed in 0.082055 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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