forked from KjetilSv/Win10As
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhass-sample.yaml
145 lines (142 loc) · 4.27 KB
/
hass-sample.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Replace the 'maczugapc' string with your topic defined in the mqtt client
# There is no need to device any sensor manually - it's all handled by MQTT auto-discovery.
switch:
- platform: wake_on_lan
mac_address: "12-34-45-56-67-78" # Replace with your device MAC
host: "192.168.1.2"
name: "MaczugaPC"
turn_off:
service: script.maczugapc_suspend
script:
maczugapc_suspend:
alias: MaczugaPC - suspend
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/power/suspend"
payload: "on"
maczugapc_vol_up:
alias: MaczugaPC - Vol Up
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/volume/up"
payload: 2
maczugapc_vol_down:
alias: MaczugaPC - Vol Down
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/volume/down"
payload: 2
# Mute can be done via switch - thus commented out.
# maczugapc_mute_toggle:
# alias: MaczugaPC - Mute
# sequence:
# - service: mqtt.publish
# data:
# topic: "maczugapc/cmd/volume/mute_toggle"
maczugapc_track_prev:
alias: MaczugaPC - Track Prev
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/mediaplayer/prev_track"
maczugapc_track_next:
alias: MaczugaPC - Track Next
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/mediaplayer/next_track"
maczugapc_pause_play:
alias: MaczugaPC - Pause/Play
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/mediaplayer/play_pause"
maczugapc_media_stop:
alias: MaczugaPC - Media Stop
sequence:
- service: mqtt.publish
data:
topic: "maczugapc/cmd/mediaplayer/stop"
# Code below is a sample control card for your device (mostly media playing), requires some custom cards/buttons tho.
# Preview: https://i.imgur.com/KDsSmqS.png
cards:
- entities:
- entity: switch.maczugapc
show_header_toggle: false
type: entities
- cards:
- action: service
icon: 'mdi:skip-backward'
tap_action:
action: call-service
service: script.maczugapc_track_prev
type: 'custom:button-card'
- action: service
icon: 'mdi:stop'
tap_action:
action: call-service
service: script.maczugapc_media_stop
type: 'custom:button-card'
- action: service
icon: 'mdi:play-pause'
tap_action:
action: call-service
service: script.maczugapc_pause_play
type: 'custom:button-card'
- action: service
icon: 'mdi:skip-next'
tap_action:
action: call-service
service: script.maczugapc_track_next
type: 'custom:button-card'
type: horizontal-stack
- color_type: label-card
entity: sensor.maczugapc_volume_level
name: Volume
show_icon: false
show_state: true
type: 'custom:button-card'
- cards:
- action: service
hold_action:
action: call-service
repeat: 200
service: media_player.volume_down
service_data:
entity_id: media_player.maczugapc
icon: 'mdi:volume-minus'
name: Ciszej
tap_action:
action: call-service
service: media_player.volume_down
service_data:
entity_id: media_player.maczugapc
type: 'custom:button-card'
- action: service
entity: switch.maczugapc_volume_mute
icon: 'mdi:volume-mute'
name: Wycisz
tap_action:
action: toggle
entity: switch.maczugapc_volume_mute
type: 'custom:button-card'
- action: service
hold_action:
action: call-service
repeat: 200
service: media_player.volume_up
service_data:
entity_id: media_player.maczugapc
icon: 'mdi:volume-plus'
name: Głośniej
tap_action:
action: call-service
service: media_player.volume_up
service_data:
entity_id: media_player.maczugapc
type: 'custom:button-card'
type: horizontal-stack
type: vertical-stack