Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################## DEFAULT_CONFIG ##################
- Used to shorten code per device #
- _device_base.yaml #
- ################## DEFAULT_CONFIG ##################
- esphome:
- mqtt:
- broker: !secret mqtt_broker
- username: !secret mqtt_usr
- password: !secret mqtt_pwd
- discovery: false
- discovery_retain: false
- reboot_timeout: 0s
- topic_prefix: ${device_name}
- logger:
- api:
- port: 6053
- reboot_timeout: 5min
- encryption:
- key: !secret api_key
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_pwd
- reboot_timeout: 5min
- fast_connect: true
- power_save_mode: none
- ap:
- ssid: "${device_name} AP"
- password: !secret fallback_pwd
- captive_portal:
- ota:
- safe_mode: true
- password: !secret ota_pwd
- port: 8266
- id: otap
- web_server:
- port: 80
- auth:
- username: !secret web_usr
- password: !secret web_pwd
- button:
- - platform: restart
- name: "${device_name}_restart"
- ####################################################
- ################## DEFAULT_CONFIG ##################
- packages: #
- device_base: !include _device_base.yaml #
- ################## DEFAULT_CONFIG ##################
- substitutions:
- device_name: somfy-remotes
- rmte1: 5ch
- rmte2: 1ch
- esphome:
- name: ${device_name}
- platform: ESP32
- board: nodemcu-32s
- text_sensor:
- - platform: template
- id: slct_chnl
- name: "Selected Channel"
- update_interval: never
- script:
- - id: ch_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
- - text_sensor.template.publish:
- id: slct_chnl
- state: "Channel 1"
- - id: ch_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
- - text_sensor.template.publish:
- id: slct_chnl
- state: "Channel 2"
- - id: ch_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
- - text_sensor.template.publish:
- id: slct_chnl
- state: "Channel 3"
- - id: ch_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
- - text_sensor.template.publish:
- id: slct_chnl
- state: "Channel 4"
- - id: ch_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
- - text_sensor.template.publish:
- id: slct_chnl
- state: "Channel 5"
- switch:
- - platform: gpio
- name: "${rmte1} Program"
- id: program_${rmte1}
- pin:
- number: GPIO33
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 500ms
- - switch.turn_off: program_${rmte1}
- - platform: gpio
- id: up_${rmte1}
- pin:
- number: GPIO25
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: up_${rmte1}
- - platform: gpio
- id: stop_${rmte1}
- pin:
- number: GPIO27
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: stop_${rmte1}
- - platform: gpio
- id: down_${rmte1}
- pin:
- number: GPIO26
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: down_${rmte1}
- - platform: gpio
- name: "${rmte1} Select"
- id: slct
- pin:
- number: GPIO32
- inverted: yes
- on_turn_on:
- - delay: 100ms
- - switch.turn_off: slct
- - platform: gpio
- name: "${rmte2} Program"
- id: program_${rmte2}
- pin:
- number: GPIO14
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 500ms
- - switch.turn_off: program_${rmte2}
- - platform: gpio
- id: up_${rmte2}
- pin:
- number: GPIO19
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: up_${rmte2}
- - platform: gpio
- id: stop_${rmte2}
- pin:
- number: GPIO18
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: stop_${rmte2}
- - platform: gpio
- id: down_${rmte2}
- pin:
- number: GPIO21
- mode: OUTPUT
- inverted: yes
- on_turn_on:
- - delay: 400ms
- - switch.turn_off: down_${rmte2}
- binary_sensor:
- - platform: gpio
- id: led1
- pin:
- number: GPIO35
- inverted: yes
- filters:
- - delayed_off: 90ms
- - platform: gpio
- id: led2
- pin:
- number: GPIO34
- inverted: yes
- filters:
- - delayed_off: 90ms
- - platform: gpio
- id: led3
- pin:
- number: GPIO39
- inverted: yes
- filters:
- - delayed_off: 90ms
- - platform: gpio
- id: led4
- pin:
- number: GPIO36
- inverted: yes
- filters:
- - delayed_off: 90ms
- - platform: gpio
- pin:
- number: GPIO5
- mode: INPUT_PULLUP
- inverted: true
- id: pwrlss
- name: "Stroom aanwezig"
- device_class: power
- on_release:
- then:
- - logger.log: "!Stroomuitval!"
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 3";'
- then:
- - script.execute: ch_3
- - script.wait: ch_3
- - switch.turn_on: up_${rmte1}
- cover:
- - platform: template
- device_class: shutter
- name: "Slaapkamer"
- assumed_state: true
- optimistic: true
- open_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 1";'
- then:
- - script.execute: ch_1
- - script.wait: ch_1
- - switch.turn_on: up_${rmte1}
- stop_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 1";'
- then:
- - script.execute: ch_1
- - script.wait: ch_1
- - switch.turn_on: stop_${rmte1}
- close_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 1";'
- then:
- - script.execute: ch_1
- - script.wait: ch_1
- - switch.turn_on: down_${rmte1}
- - platform: template
- device_class: shutter
- name: "Babykamer"
- id: studeerkamer
- assumed_state: true
- optimistic: true
- open_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 2";'
- then:
- - script.execute: ch_2
- - script.wait: ch_2
- - switch.turn_on: up_${rmte1}
- stop_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 2";'
- then:
- - script.execute: ch_2
- - script.wait: ch_2
- - switch.turn_on: stop_${rmte1}
- close_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 2";'
- then:
- - script.execute: ch_2
- - script.wait: ch_2
- - switch.turn_on: down_${rmte1}
- - platform: template
- device_class: shutter
- name: "Nina kamer"
- id: cvr_nina_kamer
- assumed_state: true
- optimistic: true
- open_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 3";'
- then:
- - script.execute: ch_3
- - script.wait: ch_3
- - switch.turn_on: up_${rmte1}
- stop_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 3";'
- then:
- - script.execute: ch_3
- - script.wait: ch_3
- - switch.turn_on: stop_${rmte1}
- close_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 3";'
- then:
- - script.execute: ch_3
- - script.wait: ch_3
- - switch.turn_on: down_${rmte1}
- - platform: template
- device_class: shutter
- name: "Slaapkamer/Babykamer"
- assumed_state: true
- optimistic: true
- open_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 4";'
- then:
- - script.execute: ch_4
- - script.wait: ch_4
- - switch.turn_on: up_${rmte1}
- stop_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 4";'
- then:
- - script.execute: ch_4
- - script.wait: ch_4
- - switch.turn_on: stop_${rmte1}
- close_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 4";'
- then:
- - script.execute: ch_4
- - script.wait: ch_4
- - switch.turn_on: down_${rmte1}
- - platform: template
- device_class: shutter
- name: "Alles"
- assumed_state: true
- optimistic: true
- open_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 5";'
- then:
- - script.execute: ch_5
- - script.wait: ch_5
- - switch.turn_on: up_${rmte1}
- stop_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 5";'
- then:
- - script.execute: ch_5
- - script.wait: ch_5
- - switch.turn_on: stop_${rmte1}
- close_action:
- - if:
- condition:
- lambda: 'return id(slct_chnl).state != "Channel 5";'
- then:
- - script.execute: ch_5
- - script.wait: ch_5
- - switch.turn_on: down_${rmte1}
- - platform: template
- device_class: shutter
- name: "Zolder"
- id: zolder
- assumed_state: true
- optimistic: true
- open_action:
- - switch.turn_on: up_${rmte2}
- stop_action:
- - switch.turn_on: stop_${rmte2}
- close_action:
- - switch.turn_on: down_${rmte2}
- time:
- - platform: homeassistant
- id: homeassistant_time
Advertisement
Add Comment
Please, Sign In to add comment