Advertisement
Guest User

Untitled

a guest
Aug 5th, 2021
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.17 KB | None | 0 0
  1. # home assistant media player config
  2. # by : badbummer#6975
  3.  
  4. input_boolean:
  5.   computer_power:
  6.     name: 'pc status'
  7.  
  8. switch:
  9.   - platform: template
  10.     switches:
  11.    
  12.       pc :
  13.         value_template: "{{ is_state('input_boolean.computer_power', 'on') }}"
  14.        
  15.         turn_on:
  16.           - service: switch.turn_on
  17.             entity_id: switch.MY SMART PLUG
  18.            
  19.           - service: input_boolean.turn_on
  20.             entity_id: input_boolean.computer_power
  21.              
  22.              
  23.         turn_off:
  24.         -   service: mqtt.publish
  25.             data_template:
  26.                 topic: homeassistant/switch/PC NAME/Shutdown/set
  27.                 payload: 'ON'
  28.          
  29.         -   service: input_boolean.turn_off
  30.             entity_id: input_boolean.computer_power
  31.  
  32.  
  33. media_player:
  34.   - platform: universal
  35.     name: pc_media_player
  36.     children:
  37.      - media_player.kodi_b327aa7af788b026800fd8eb8586b3c5
  38.       - switch.pc
  39.     commands:
  40.    
  41.       turn_on:
  42.         service: switch.turn_on
  43.         target:
  44.             entity_id: switch.pc
  45.    
  46.       turn_off:
  47.         service: switch.turn_off
  48.         target:
  49.             entity_id: switch.pc
  50.        
  51.       volume_up:
  52.         service: switch.turn_on
  53.         target:
  54.             entity_id: switch.volumeup
  55.        
  56.       volume_down:
  57.         service: switch.turn_on
  58.         target:
  59.             entity_id: switch.volumedown
  60.        
  61.       volume_mute:
  62.         service: switch.turn_on
  63.         target:
  64.             entity_id: switch.mute
  65.        
  66.       media_play:
  67.         service: switch.turn_on
  68.         target:
  69.             entity_id: switch.playpause
  70.            
  71.       media_pause:
  72.         service: switch.turn_on
  73.         target:
  74.             entity_id: switch.playpause
  75.        
  76.       media_previous_track:
  77.         service: switch.turn_on
  78.         target:
  79.             entity_id: switch.previous
  80.        
  81.       media_next_track:
  82.         service: switch.turn_on
  83.         target:
  84.             entity_id: switch.next
  85.        
  86.     attributes:
  87.      # is_volume_muted:
  88.       state: input_boolean.computer_power
  89.       volume_level: sensor.currentvolume
  90.     device_class: tv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement