Aangezien ik niet weet in welk topic ik dit anders moet plaatsen (en ESPHome tegenwoordig van dezelfde eigenaren als HA is
):
Toch afgesplitst omdat het echt een vraag betreft los van HA
Ik zou mijn code graag slimmer/netter willen. Ik heb alleen geen idee hoe. Weet iemand hier hoe je met name de scripts kunt combineren tot 1 slimme, welke geautomatiseerd het juiste kanaal berekend?
Wat sfeerbeelden
Toch afgesplitst omdat het echt een vraag betreft los van HA
Bovenstaande bestuurt een ESP32 welke op een Situo 5 io Pure II is aangesloten. Ik liet eerst 100% van de berekening via Node-RED icm MQTT en HA lopen, maar dit werkt veel sneller/betrouwbaarder. Máár: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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 ################## DEFAULT_CONFIG ################## api: !include _api.yaml # wifi: !include _wifi.yaml # captive_portal: # ota: !include _ota.yaml # mqtt: !include _mqtt.yaml # web_server: !include _webserver.yaml # logger: # ################## DEFAULT_CONFIG ################## substitutions: device_name: nodemcu_test esphome: name: ${device_name} platform: ESP32 board: nodemcu-32s script: - id: chnnl_1 then: - while: condition: or: - binary_sensor.is_off: led1 - binary_sensor.is_on: led2 - binary_sensor.is_on: led3 - binary_sensor.is_on: led4 then: - switch.turn_on: slct - delay: 250ms - id: chnnl_2 then: - while: condition: or: - binary_sensor.is_on: led1 - binary_sensor.is_off: led2 - binary_sensor.is_on: led3 - binary_sensor.is_on: led4 then: - switch.turn_on: slct - delay: 250ms - id: chnnl_3 then: - while: condition: or: - binary_sensor.is_on: led1 - binary_sensor.is_on: led2 - binary_sensor.is_off: led3 - binary_sensor.is_on: led4 then: - switch.turn_on: slct - delay: 250ms - id: chnnl_4 then: - while: condition: or: - binary_sensor.is_on: led1 - binary_sensor.is_on: led2 - binary_sensor.is_on: led3 - binary_sensor.is_off: led4 then: - switch.turn_on: slct - delay: 250ms - id: chnnl_5 then: - while: condition: or: - binary_sensor.is_off: led1 - binary_sensor.is_off: led2 - binary_sensor.is_off: led3 - binary_sensor.is_off: led4 then: - switch.turn_on: slct - delay: 250ms switch: - platform: restart name: "${device_name}_restart" - platform: gpio name: "${device_name} Program" id: program pin: number: GPIO32 mode: OUTPUT inverted: yes - platform: gpio id: up pin: number: GPIO27 mode: OUTPUT inverted: yes on_turn_on: - delay: 500ms - switch.turn_off: up - platform: gpio id: stop pin: number: GPIO25 mode: OUTPUT inverted: yes on_turn_on: - delay: 500ms - switch.turn_off: stop - platform: gpio id: down pin: number: GPIO26 mode: OUTPUT inverted: yes on_turn_on: - delay: 500ms - switch.turn_off: down - platform: gpio id: slct pin: number: GPIO33 inverted: yes on_turn_on: - delay: 100ms - switch.turn_off: slct binary_sensor: - platform: gpio id: led1 pin: number: GPIO36 mode: INPUT_PULLDOWN inverted: yes filters: - delayed_off: 100ms - platform: gpio id: led2 pin: number: GPIO39 mode: INPUT_PULLDOWN inverted: yes filters: - delayed_off: 100ms - platform: gpio id: led3 pin: number: GPIO34 mode: INPUT_PULLDOWN inverted: yes filters: - delayed_off: 100ms - platform: gpio id: led4 pin: number: GPIO35 mode: INPUT_PULLDOWN inverted: yes filters: - delayed_off: 100ms cover: - platform: template device_class: shutter name: "Babykamer" assumed_state: true optimistic: true open_action: - script.execute: chnnl_1 - script.wait: chnnl_1 - switch.turn_on: up stop_action: - script.execute: chnnl_1 - script.wait: chnnl_1 - switch.turn_on: stop close_action: - script.execute: chnnl_1 - script.wait: chnnl_1 - switch.turn_on: down - platform: template device_class: shutter name: "Studeerkamer" assumed_state: true optimistic: true open_action: - script.execute: chnnl_2 - script.wait: chnnl_2 - switch.turn_on: up stop_action: - script.execute: chnnl_2 - script.wait: chnnl_2 - switch.turn_on: stop close_action: - script.execute: chnnl_2 - script.wait: chnnl_2 - switch.turn_on: down - platform: template device_class: shutter name: "Slaapkamer" assumed_state: true optimistic: true open_action: - script.execute: chnnl_3 - script.wait: chnnl_3 - switch.turn_on: up stop_action: - script.execute: chnnl_3 - script.wait: chnnl_3 - switch.turn_on: stop close_action: - script.execute: chnnl_3 - script.wait: chnnl_3 - switch.turn_on: down - platform: template device_class: shutter name: "Zolder/Studeerkamer" assumed_state: true optimistic: true open_action: - script.execute: chnnl_4 - script.wait: chnnl_4 - switch.turn_on: up stop_action: - script.execute: chnnl_4 - script.wait: chnnl_4 - switch.turn_on: stop close_action: - script.execute: chnnl_4 - script.wait: chnnl_4 - switch.turn_on: down - platform: template device_class: shutter name: "Alles" assumed_state: true optimistic: true open_action: - script.execute: chnnl_5 - script.wait: chnnl_5 - switch.turn_on: up stop_action: - script.execute: chnnl_5 - script.wait: chnnl_5 - switch.turn_on: stop close_action: - script.execute: chnnl_5 - script.wait: chnnl_5 - switch.turn_on: down
Ik zou mijn code graag slimmer/netter willen. Ik heb alleen geen idee hoe. Weet iemand hier hoe je met name de scripts kunt combineren tot 1 slimme, welke geautomatiseerd het juiste kanaal berekend?
Wat sfeerbeelden
![]() | ![]() | ![]() | ![]() | ![]() |
[ Voor 1% gewijzigd door Septillion op 02-06-2021 09:51 ]