Table des matières

Volets roulants - Home Assistant

Contexte / Objectif

Toujours ces volets roulants Legrand, et voilà des petits nouveaux dans l'extension : moteurs BHz Simu.

On fait le point :

Et ben ça sera toujours sans moi. On démonte et on soude un esp8266 qui pilotera les boutons d’émetteurs Legrand et Simu.

Sauf qu'à présent, exit Blynk et Blitzwolf on va découvrir l'excellent ESP Home pour Home Assistant.

Réalisation

Electronique

esphome_volets_roulants_carte.jpg

Commande centralisée Legrand à gauche et commande centralisée Simu à droite.

Code ESPHome

esphome:
  name: "volets-roulants"
  friendly_name: "volets-roulants"

esp8266:
  board: esp01_1m
 
# Enable logger
logger:
  level: NONE
 
# Enable Home Assistant API
api:
  encryption:
    key: "bla"

ota:
  - platform: esphome
    password: "bla"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  manual_ip:
    static_ip: 192.168.0.76
    gateway: 192.168.0.1
    subnet: 255.255.255.0

substitutions:
  # GPIO https://doku.floriantales.fr//lib/plugins/ckgedit/fckeditor/userfiles/image/electronique/micro_controleurs/esp8266/wemos_pins.jpg
  device_1_name: "Legrand"
  device_1_gpio_up: "13"
  device_1_gpio_stop: "12"
  device_1_gpio_down: "14"
  device_2_name: "Simu"
  device_2_gpio_up: "15"
  device_2_gpio_stop: "16"
  device_2_gpio_down: "5"

switch:
  # Cover 1
  - platform: gpio
    id: cover1_up
    name: "${device_1_name} UP"
    pin:
      number: "${device_1_gpio_up}"
      inverted: true
      mode:
        output: true
    interlock: [cover1_stop, cover1_down]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover1_up

  - platform: gpio
    id: cover1_stop
    name: "${device_1_name} STOP"
    pin:
      number: "${device_1_gpio_stop}"
      inverted: true
      mode:
        output: true
    interlock: [cover1_up, cover1_down]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover1_stop

  - platform: gpio
    id: cover1_down
    name: "${device_1_name} DOWN"
    pin:
      number: "${device_1_gpio_down}"
      inverted: true
      mode:
        output: true
    interlock: [cover1_stop, cover1_up]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover1_down
 
  # Cover 2
  - platform: gpio
    id: cover2_up
    name: "${device_2_name} UP"
    pin:
      number: "${device_2_gpio_up}"
      inverted: true
      mode:
        output: true
    interlock: [cover2_stop, cover2_down]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover2_up

  - platform: gpio
    id: cover2_stop
    name: "${device_2_name} STOP"
    pin:
      number: "${device_2_gpio_stop}"
      inverted: true
      mode:
        output: true
    interlock: [cover2_up, cover2_down]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover2_stop

  - platform: gpio
    id: cover2_down
    name: "${device_2_name} DOWN"
    pin:
      number: "${device_2_gpio_down}"
      inverted: true
      mode:
        output: true
    interlock: [cover2_stop, cover2_up]
    internal: true
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: cover2_down

cover:
  # Cover 1
  - platform: time_based
    id: cover1
    device_class: shutter
    name: "${device_1_name}"
    assumed_state: true
    open_action:
      - switch.turn_on: cover1_up
    open_duration: 22s
    close_action:
      - switch.turn_on: cover1_down
    close_duration: 21s
    stop_action:
      - switch.turn_on: cover1_stop
    # Replace :
    #on_open:
    #  then:
    #    - delay: 1s
    #    - switch.turn_on: cover1_up
    #on_closed:
    #  then:
    #    - delay: 1s
    #    - switch.turn_on: cover1_down
    # By :
    has_built_in_endstop: True
 
  # Cover 2
  - platform: time_based
    id: cover2
    device_class: shutter
    name: "${device_2_name}"
    assumed_state: true
    has_built_in_endstop: True
    open_action:
      - switch.turn_on: cover2_up
    open_duration: 25s
    close_action:
      - switch.turn_on: cover2_down
    close_duration: 24s
    stop_action:
      - switch.turn_on: cover2_stop

Y'a plus qu'à se faire un petit dashboard home assistant sympa :

Déroutant de simplicité …