-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtx_ultimate_03_ingresso_mansarda.yaml
156 lines (139 loc) · 4.16 KB
/
tx_ultimate_03_ingresso_mansarda.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
146
147
148
149
150
151
152
153
154
155
156
substitutions:
name: "interruttore-ingresso-mansarda"
friendly_name: "Ingresso mansarda"
use_ip_address: 192.168.2.143 # 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_1: !include
file: includes/tx_ultimate_light.yaml
vars:
id: relay_1
relay_index: 0
name: "Scale"
pin: ${relay_2_pin}
light_2: !include
file: includes/tx_ultimate_light.yaml
vars:
id: relay_2
relay_index: 1
name: "Ingresso mansarda"
pin: ${relay_1_pin}
light_3: !include
file: includes/tx_ultimate_mqtt_relay.yaml
vars:
id: relay_3
relay_index: 2
subscribe_topic: "interruttore-saletta-mansarda/light/sala_mansarda/state"
value_on: "ON"
mqtt_json_key: "state"
command_topic: "interruttore-saletta-mansarda/light/sala_mansarda/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-saletta-mansarda/light/saletta_mansarda/state"
value_on: "ON"
mqtt_json_key: "state"
command_topic: "interruttore-saletta-mansarda/light/saletta_mansarda/command"
command_toggle: "{ \"state\": \"TOGGLE\" }"
switch:
- platform: gpio
id: gpio_shutter_open
pin: ${relay_3_pin}
internal: True
interlock: &interlock_group [gpio_shutter_close, gpio_shutter_open]
restore_mode: ALWAYS_OFF
- platform: gpio
id: gpio_shutter_close
pin: ${relay_4_pin}
internal: True
interlock: *interlock_group
restore_mode: ALWAYS_OFF
cover:
- platform: time_based
name: "Vasistas"
id: vasistas
open_action:
- switch.turn_on: gpio_shutter_open
open_duration: 27s
close_action:
- switch.turn_on: gpio_shutter_close
close_duration: 27s
stop_action:
- switch.turn_off: gpio_shutter_close
- switch.turn_off: gpio_shutter_open
script:
- id: !extend on_release
then:
- if:
condition:
lambda: "return index == 0;"
then:
- light.toggle: relay_1
else:
- if:
condition:
lambda: "return index == 1;"
then:
- light.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:
- if:
condition:
lambda: 'return id(vasistas).current_operation == CoverOperation::COVER_OPERATION_IDLE;'
then:
- cover.open: vasistas
else:
- cover.stop: vasistas
- id: !extend on_swipe_left
then:
- if:
condition:
lambda: 'return id(vasistas).current_operation == CoverOperation::COVER_OPERATION_IDLE;'
then:
- cover.close: vasistas
else:
- cover.stop: vasistas
sensor:
- platform: mqtt_subscribe
id: vasistas_mqtt
internal: True
topic: interruttore-ingresso-mansarda/vasistas/open
on_value:
- if:
condition:
lambda: 'return id(vasistas).current_operation == CoverOperation::COVER_OPERATION_IDLE;'
then:
- if:
condition:
lambda: 'return x > 0;'
then:
- cover.open: vasistas
else:
- cover.close: vasistas
else:
- cover.stop: vasistas