Advertisement
ninhvanthang

Untitled

Jun 23rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.87 KB | None | 0 0
  1. binary_sensor:
  2.   - platform: mqtt
  3.     name: "My Computer - Connected"
  4.     state_topic: "iotlink/workgroup/thanga-pc/lwt"
  5.     value_template: "{{ value }}"
  6.     payload_on: "ON"
  7.     payload_off: "OFF"
  8.     device_class: "connectivity"
  9.     qos: 1
  10.  
  11. switch 4:
  12.   - platform: template
  13.     switches:
  14.       my_computer:
  15.         friendly_name: "My Computer"
  16.         value_template: "{{ is_state('binary_sensor.my_computer_connected', 'on') }}"
  17.         turn_on:
  18.           service: script.my_computer_wake
  19.         turn_off:
  20.           service: script.my_computer_suspend
  21.         icon_template: mdi:laptop
  22.  
  23. script:
  24.   my_computer_wake:
  25.     alias: "My Computer - Wake"
  26.     sequence:
  27.       - service: wake_on_lan.send_magic_packet
  28.         data:
  29.           mac: "00:00:00:00:00:00"
  30.   my_computer_shutdown:
  31.     alias: "My Computer - Shutdown"
  32.     sequence:
  33.       - service: mqtt.publish
  34.         data:
  35.           topic: "iotlink/workgroup/thanga-pc/commands/shutdown"
  36.           payload: ""
  37.   my_computer_suspend:
  38.     alias: "My Computer - Suspend"
  39.     sequence:
  40.       - service: mqtt.publish
  41.         data:
  42.           topic: "iotlink/workgroup/thanga-pc/commands/suspend"
  43.           payload: ""
  44.   my_computer_vol_mute:
  45.     alias: "My Computer - Toggle Mute"
  46.     sequence:
  47.       - service: mqtt.publish
  48.         data:
  49.           topic: "iotlink/workgroup/thanga-pc/commands/volume/mute"
  50.           payload: ""
  51.  
  52.  
  53. input_number:
  54.   target_temp:
  55.     name: Computer volume
  56.     min: 1
  57.     max: 100
  58.     step: 1
  59.     unit_of_measurement: step  
  60.     icon: mdi:volume-high
  61.  
  62. automation:
  63.   - alias: Temp slider moved
  64.     trigger:
  65.       platform: state
  66.       entity_id: input_number.target_temp
  67.     action:
  68.       service: mqtt.publish
  69.       data_template:
  70.         topic: 'iotlink/workgroup/thanga-pc/commands/volume/set'
  71.         payload: "{{ states('input_number.target_temp') | int }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement