esphome:
  name: clim-mitsubishi-cn105
  friendly_name: Clim Mitsubishi CN105
  min_version: 2026.4.0

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Le logger ne doit pas écrire sur l'UART utilisé par le CN105.
logger:
  level: INFO
  baud_rate: 0

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none
  ap:
    ssid: "Clim CN105 secours"
    password: !secret fallback_password

captive_portal:

# Installation MQTT uniquement : ne pas ajouter de bloc api:.
mqtt:
  broker: !secret mqtt_broker
  port: !secret mqtt_port
  username: !secret mqtt_username
  password: !secret mqtt_password
  topic_prefix: clim-mitsubishi-cn105
  discovery: true
  discovery_retain: true
  discovery_object_id_generator: device_name
  discover_ip: false
  reboot_timeout: 0s
  idf_send_async: true
  log_topic: null

ota:
  - platform: esphome
    password: !secret ota_password

safe_mode:
  num_attempts: 3

# Convention : TX de l'ESP32 vers RX de la clim, RX de l'ESP32 depuis TX de la clim.
uart:
  id: cn105_uart
  tx_pin: GPIO26
  rx_pin:
    number: GPIO25
    mode:
      input: true
      pullup: true
  baud_rate: 2400
  data_bits: 8
  parity: EVEN
  stop_bits: 1

climate:
  - platform: mitsubishi_cn105
    id: clim_mitsubishi
    name: "Climatisation"
    uart_id: cn105_uart
    update_interval: 1s
    current_temperature_min_interval: 60s
    supported_swing_modes: VERTICAL
    visual:
      min_temperature: 16
      max_temperature: 31
      temperature_step: 0.5
