substitutions: name: thr320d_filtre_bb04f0 friendly_name: "filtration" project_name: "Filtration piscine" project_version: "1.0" light_restore_mode: RESTORE_DEFAULT_OFF esphome: name: "${name}" # supply the external temp/hum sensor with 3v power by pulling this GPIO high on_boot: - priority: 90 then: - switch.turn_on: ${name}_sensor_power esp32: board: nodemcu-32s api: encryption: key: "zOAo/IyJfGlFafVzPae/pCJZQtGFRWc7i+O9ZXfRY+c=" ota: - platform: esphome password: "5e0d993d03804b33e56142c07cae7526" logger: baud_rate: 0 web_server: port: 80 wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: !secret ap_ssid_pool password: !secret ap_pass_pool captive_portal: one_wire: - platform: gpio pin: GPIO25 # This will take care of the display automatically. # You don't need to tell it to print something to the display manually. # It'll update every 60s or so. display: platform: tm1621 id: tm1621_display cs_pin: GPIO17 data_pin: GPIO5 read_pin: GPIO23 write_pin: GPIO18 lambda: |- it.printf(0, "%.1f", id(${name}_temp).state); it.display_celsius(true); /*it.printf(1, "%.1f", id(${name}_temp).state/10); /*it.display_kwh(true); /*it.printf(1, "%.1f", id(${name}_humi).state); it.display_humidity(true);*/ binary_sensor: # single main button that also puts device into flash mode when held on boot - platform: gpio pin: number: GPIO0 mode: INPUT_PULLUP inverted: True name: "${friendly_name} Button" on_click: - max_length: 350ms # short press to toggle the relay then: switch.toggle: mainRelayVirt - min_length: 360ms # long press to do... max_length: 3s then: switch.toggle: dryContRelay - min_length: 10s # very long press to reset max_length: 20s then: - switch.turn_on: ${name}_restart - platform: status name: "${friendly_name} Status" switch: # virtual switch to represent the main relay # as far as I know, we have no way to confirm the real state - platform: template id: mainRelayVirt name: "Pompe" turn_on_action: - switch.turn_on: mainRelayOn - switch.turn_on: ${name}_onoff_led turn_off_action: - switch.turn_on: mainRelayOff - switch.turn_off: ${name}_onoff_led assumed_state: True optimistic: True #restore_state: True #restore_mode: ALWAYS_ON # internal momentary switch for main relay ON - platform: gpio id: mainRelayOn internal: True pin: number: GPIO19 on_turn_on: - delay: 500ms - switch.turn_off: mainRelayOn restore_mode: ALWAYS_OFF # internal momentary switch for main relay OFF - platform: gpio id: mainRelayOff internal: True pin: number: GPIO22 on_turn_on: - delay: 500ms - switch.turn_off: mainRelayOff restore_mode: ALWAYS_OFF # dry contact relay switch - platform: gpio id: dryContRelay name: "Extension" pin: number: GPIO4 on_turn_on: - switch.turn_on: ${name}_ext_led on_turn_off: - switch.turn_off: ${name}_ext_led # Leftmost (red) LED that's used to indicate the relay being on/off - platform: gpio id: ${name}_onoff_led pin: number: GPIO16 inverted: true # Rightmost (green) LED; use as dry contact indicator - platform: gpio id: ${name}_ext_led pin: number: GPIO13 inverted: true # This is needed to power the external temp/humidity sensor. # It receives 3v from this pin, which is pulled up on boot. # TODO: This should probably be an internal switch. - platform: gpio pin: GPIO27 id: ${name}_sensor_power restore_mode: ALWAYS_ON - platform: restart name: "Filtration Restart" id: ${name}_restart icon: "mdi:restart" light: # The middle (blue) LED is used as wifi status indicator. - platform: status_led id: wifi_status_led name: "Wifi" pin: number: GPIO15 inverted: true sensor: - platform: dallas_temp name: "Température eau" id: ${name}_temp address: 0xfe3ce504578d3c28 update_interval: 1s climate: - platform: thermostat name: "${friendly_name} Climate" sensor: ${name}_temp default_preset: Home preset: - name: Home default_target_temperature_low: 31 °C mode: heat min_heating_off_time: 300s min_heating_run_time: 300s min_idle_time: 30s heat_action: - switch.turn_on: mainRelayVirt idle_action: - switch.turn_off: mainRelayVirt heat_deadband: 0.5 # how many degrees can we go under the temp before starting to heat heat_overrun: 0.5 # how many degrees can we go over the temp before stopping text_sensor: - platform: wifi_info ip_address: name: "Addresse IP" disabled_by_default: true interval: - interval: 30s then: if: condition: wifi.connected: then: - light.turn_on: wifi_status_led else: - light.turn_off: wifi_status_led