-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtx_ultimate_09_sogg_ingresso.yaml
More file actions
156 lines (141 loc) · 4.3 KB
/
tx_ultimate_09_sogg_ingresso.yaml
File metadata and controls
156 lines (141 loc) · 4.3 KB
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
146
147
148
149
150
151
152
153
154
155
substitutions:
name: "interruttore-sogg-ingresso"
friendly_name: "Soggiorno ingresso"
use_ip_address: 192.168.2.149 # Usato da esphome per monitor e upload
wifi_ssid: !secret wifi_dmz_ssid
wifi_password: !secret wifi_dmz_password
#esp32_ble_tracker:
# scan_parameters:
# active: True
# continuous: false
packages:
# Connessione MQTT
mqtt_client: !include includes/mqtt_client.yaml
# Configurazione di base
device_base: !include includes/tx_ultimate_base.yaml
# Configurazione leds
leds: !include includes/tx_ultimate_leds_4_zone.yaml
# Configurazione Custom multitouch
multitouch: !include includes/tx_ultimate_custom_multitouch.yaml
# Relè e luci locali
light_ing: !include
file: includes/tx_ultimate_light.yaml
vars:
id: relay_ing
name: "Relay luci esterne ingresso"
pin: ${relay_1_pin}
light_1: !include
file: includes/tx_ultimate_mqtt_relay.yaml
vars:
id: relay_1
relay_index: 0
subscribe_topic: "LUCI/luci_esterne"
value_on: "ON"
command_topic: "LUCI_SWITCH/luci_esterne"
command_toggle: "2"
light_2: !include
file: includes/tx_ultimate_mqtt_relay.yaml
vars:
id: relay_2
relay_index: 1
subscribe_topic: "interruttore-soggiorno-corr/light/soggiorno_sinistra/state"
value_on: "ON"
mqtt_json_key: "state"
command_topic: "interruttore-soggiorno-corr/light/soggiorno_sinistra/command"
command_toggle: "{ \"state\": \"TOGGLE\" }"
light_3: !include
file: includes/tx_ultimate_mqtt_relay.yaml
vars:
id: relay_3
relay_index: 2
subscribe_topic: "interruttore-soggiorno-corr/light/soggiorno_destra/state"
value_on: "ON"
mqtt_json_key: "state"
command_topic: "interruttore-soggiorno-corr/light/soggiorno_destra/command"
command_toggle: "{ \"state\": \"TOGGLE\" }"
light_4: !include
file: includes/tx_ultimate_mqtt_relay.yaml
vars:
id: relay_4
relay_index: 3
subscribe_topic: "interruttore-soggiorno-cucina/light/cucina/state"
value_on: "ON"
mqtt_json_key: "state"
command_topic: "interruttore-soggiorno-cucina/light/cucina/command"
command_toggle: "{ \"state\": \"TOGGLE\" }"
script:
- id: !extend on_release
then:
- if:
condition:
lambda: "return index == 0;"
then:
- script.execute: mqtt_toggle_relay_1
else:
- if:
condition:
lambda: "return index == 1;"
then:
- script.execute: mqtt_toggle_relay_2
else:
- if:
condition:
lambda: "return index == 2;"
then:
- script.execute: mqtt_toggle_relay_3
else:
- script.execute: mqtt_toggle_relay_4
- id: !extend on_swipe_right
then:
- mqtt.publish:
topic: sonoff_4ch_02/cmnd/ShutterStopOpen2
payload: ""
- mqtt.publish:
topic: sonoff_4ch_03/cmnd/ShutterStopOpen2
payload: ""
- id: !extend on_swipe_left
then:
- mqtt.publish:
topic: sonoff_4ch_02/cmnd/ShutterStopClose2
payload: ""
- mqtt.publish:
topic: sonoff_4ch_03/cmnd/ShutterStopClose2
payload: ""
switch:
- platform: template
id: loop_campanello
name: "Loop Campanello"
restore_mode: ALWAYS_OFF
optimistic: true
on_turn_on:
then:
- while:
condition:
switch.is_on: loop_campanello
then:
- button.press: campanello
- delay: 5s
output:
- platform: gpio
pin: ${relay_2_pin}
id: campanello_gpio
button:
- id: campanello
name: "Campanello"
platform: output
output: campanello_gpio
duration: 200ms
mqtt:
on_message:
- topic: "interruttore-sogg-ingresso/light/relay_luci_esterne_ingresso/command"
payload: "ON"
then:
light.turn_on: relay_ing
- topic: "interruttore-sogg-ingresso/light/relay_luci_esterne_ingresso/command"
payload: "OFF"
then:
light.turn_off: relay_ing
- topic: "interruttore-sogg-ingresso/light/relay_luci_esterne_ingresso/command"
payload: "TOGGLE"
then:
light.toggle: relay_ing