Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Latest commit

 

History

History
126 lines (107 loc) · 3.82 KB

README.md

File metadata and controls

126 lines (107 loc) · 3.82 KB

HA UStvgo sensor

hacs_badge

description:

This custom component for watching UStvgo channels via home assistant, broadcasting to google chromecast. This component will create senosr for every channel from UStvgo


instaltion:

Using HACS (add this repo as custome repository)

Or copy ustvgo folder to your custom component folder and restart your HA.

add sensor to your configuration.yaml

-  sensor:
	- platform: ustvgo
	  name: ustvgo
	  scan_interval: 3600
	  hide_vpn_required: true # optional- default true

this will create sensor for each channel from UStvgo

Create Lovelace card

enter image description here

To create such card that cast the selected channel to selected Chromecast device you need to add the following

Lovelace card: (using auto-entities awesome card )


type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_select.media_tv
  - type: custom:auto-entities
    card:
      type: glance
      show_name: true
      show_icon: false
      show_state: false
      title: USA TV
    filter:
      include:
        - state: ustvgo_*
          options:
            tap_action:
              action: call-service
              service: script.cast_ustvgo
              service_data:
                sensor: this.entity_id
      exclude: []
    sort:
      method: none
    show_empty: true

Script:


'cast_ustvgo':
  sequence:
    - service: media_player.play_media
      data_template:
        media_content_id: >-
          {{ state_attr(sensor, 'm3u') }}
        media_content_type: media
      data:
        entity_id: "{{ states('input_text.media_tv_to_play') }}"

add to your input_select.yaml


    media_tv:
      name: 'TV Players:'
      options:
        - Living
        - Bedroom
        - Office
        - Kitchen

add to your input_text.yaml


    media_tv_to_play:
      name: 'TV Devices'

add to your automation.yaml


  - alias: "Cast - Selected Name to Device"
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_select.media_tv
    action:
      - service: input_text.set_value
        data:
          entity_id: input_text.media_tv_to_play
          value: >-
            {% if is_state("input_select.media_tv", "Living") -%}
              media_player.xbr_75x800g #your device
            {% elif is_state("input_select.media_tv", "Bedroom") -%} 
              media_player.chromecast9410 #your device
            {% elif is_state("input_select.media_tv", "Office") -%}
              media_player.chromecast8612 #your device
            {% elif is_state("input_select.media_tv", "Kitchen") -%}
              media_player.chromecast0280 #your device
            {% endif %}

restart HA

Note

I able to cast to LG TV (with Chromecast connected to HDMI) and 2 Sony Bravia (one with cast build in and second one with Chromecast connected to HDMI) and Insignia (with Chromecast connected to HDMI)

Thanks

to everyone @Home Assistant for creating the amazing opensource platform for smart home integrations! 🙏🏼

Thanks/Forked from https://github.com/yohaybn/HA_ustvgo_sensor

Thanks to @benmoose39 for writing the automation on m3u fetching. Thanks to @yishait for the idea.