echavet / MitsubishiCN105ESPHome

Mix of MisubishiHeatpump from SwiCago and esphome-mitsubishiheatpump from Geoffdavis.
156 stars 30 forks source link

Touche commande des Ailettes ( 2 Flow/ 1 Flow) #135

Open roumano opened 1 month ago

roumano commented 1 month ago

In my air-conditioning ( MFZ-KT35VG ), i don't have horizontal pan.

But i can, with the remote, open or close horizontal air flow

In the documentation, it's the button : 2 Flow / 1 Flow

Look like it's not (yet) possible to manage it with this code.

Clim 2flow

Do you think, it's option can be added ?

echavet commented 1 month ago

Hi @Roumano, thanks for you message. J'ai un peu envie de te répondre en français du coup!! I can't add this specific flow mode because I can't guess the digital value related to this flow mode. You could try to find it by setting the READ, Decoder and LOGS level to debug and see what happens when you set the mode with your remote. Decoding such specific features is impossible without the specific unit as the mitsubitshi protocole is not public. We (actually that's what SwiCago did) have to practice reverse engineering.

roumano commented 1 month ago

En français, ça sera plus simple du coup ;)

J'arrive pas à déployer le code esp si j'active le logger

Code rajouter :

# Enable logging
logger:
  #level: DEBUG
  #level: verbose
  baud_rate: 0
  level: DEBUG
  logs:
    EVT_SETS : INFO
    WIFI : INFO
    MQTT : INFO
    WRITE_SETTINGS : INFO
    SETTINGS : INFO
    STATUS : INFO
    CN105Climate: WARN
    CN105: INFO
    climate: WARN
    sensor: WARN
    chkSum : INFO
    WRITE : WARN
    READ : DEBUG
    Header: INFO
    Decoder : DEBUG
    CONTROL_WANTED_SETTINGS: INFO
echavet commented 1 month ago

Ce n'est pas ta faute, c'est depuis la mise à jour de ESPHome. Ca ne compilait plus (#134). On vient de faire un commit avec correction, mais ton intégration espHome utilise encore le cache. rajoute l'option refresh: 0spour forcer la récupération des dernières modifs.

external_components:
  - source: github://echavet/MitsubishiCN105ESPHome
    refresh: 0s
roumano commented 1 month ago

Ce n'est pas ta faute, c'est depuis la mise à jour de ESPHome. Ca ne compilait plus (#134). On vient de faire un commit avec correction, mais ton intégration espHome utilise encore le cache. rajoute l'option refresh: 0spour forcer la récupération des dernières modifs.

external_components:
  - source: github://echavet/MitsubishiCN105ESPHome
    refresh: 0s

C'est aller un peut plus loin (apres aussi un clean build) mais ca plante toujours :

Compiling .pioenvs/stationmeteo/src/esphome/components/cn105/climateControls.cpp.o
In file included from src/esphome.h:35,
                 from src/esphome/components/cn105/Globals.h:2,
                 from src/esphome/components/cn105/cn105.h:2,
                 from src/esphome/components/cn105/climateControls.cpp:1:
src/esphome/components/cn105/uptime_connection_sensor.h:2:10: fatal error: esphome/components/uptime/uptime_seconds_sensor.h: No such file or directory
 #include "esphome/components/uptime/uptime_seconds_sensor.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/stationmeteo/src/esphome/components/cn105/climateControls.cpp.o] Error 1
========================= [FAILED] Took 39.89 seconds =========================
revoka commented 1 month ago

I think you are using an older version of ESP Home than the latest 2024.7.0 version. Versions prior to 2024.7.0 don´t have the new uptime_seconds_sensor defined and that is what your error is during compilation. Upgrading to ESP Home latest version should solve your compilation problem.

roumano commented 1 month ago

I think you are using an older version of ESP Home than the latest 2024.7.0 version. Versions prior to 2024.7.0 don´t have the new uptime_seconds_sensor defined and that is what your error is during compilation. Upgrading to ESP Home latest version should solve your compilation problem.

Correct ( i was using the 2024.4.xxx , ...

Please found information i have found with the debug mode :

When it's set to 1flow, i get :

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B4 A8 A8 FE 42 00 00 14 7B 00 00 7D
[D][Decoder:239]: [Room °C: 20.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B4 A8 A8 FE 42 00 00 14 7B 00 00 7D
[D][Decoder:239]: [Room °C: 20.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A8 A8 FE 42 00 00 14 7B 00 00 7F
[D][Decoder:239]: [Room °C: 20.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B4 A8 A8 FE 42 00 00 14 7B 00 00 7D
[D][Decoder:239]: [Room °C: 20.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B4 A8 A8 FE 42 00 00 14 7B 00 00 7D
[D][Decoder:239]: [Room °C: 20.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B4 A8 A8 FE 42 00 00 14 7C 00 00 7C
[D][Decoder:239]: [Room °C: 20.000000]

When i use 2 flow :

[D][READ:157]: FC 62 01 30 10 03 00 00 0B 00 B2 AA AA FE 42 00 00 14 7A 00 00 7B
[D][Decoder:239]: [Room °C: 21.000000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A9 A9 FE 42 00 00 14 7A 00 00 7E
[D][Decoder:239]: [Room °C: 20.500000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A9 A9 FE 42 00 00 14 7A 00 00 7E
[D][Decoder:239]: [Room °C: 20.500000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A9 A9 FE 42 00 00 14 7A 00 00 7E
[D][Decoder:239]: [Room °C: 20.500000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A9 A8 FE 42 00 00 14 7A 00 00 7F
[D][Decoder:239]: [Room °C: 20.500000]

[D][READ:157]: FC 62 01 30 10 03 00 00 0A 00 B2 A9 A8 FE 42 00 00 14 7A 00 00 7F
[D][Decoder:239]: [Room °C: 20.500000]

I've try to get same temperature, but it's changing relatively quickly so it's not easy , ...

It's sufficient as this or not ?

roumano commented 1 month ago

c'est bon comme info ou pas ? ( je part bientôt en vacances et je pourrais avoir d'autres données avant longtemps , ... )

echavet commented 1 month ago

Salut, Désolé j'ai zappé! Non, sauf erreur (je vérifierai plus tard) je déduis de la trace que les trames reçues sont la température de la pièce. J'ai du me tromper en te donnant le setup de logs.

La boucle globale enchaîne des requêtes auprès du climatiseur. La réponse du climatiseur est une trame qui représente des types de données particuliers. C'est cette réponse qu'il faut tracer. Je suis sur mon tel là, et je pars bientôt en vacances moi aussi. Pas d'urgence. Je regarde le code et te précise la conf dès que possible.

echavet commented 2 weeks ago

salut @roumano, je rentre de vacances et je jette un oeil aux issues ouvertes... La première chose (que je ne t'ai pas demandée) c'est ton yaml. Parce qu'en regardant de plus près je suis étonné que tu ne reçoives que des trames de température. Peut-être as-tu toi aussi ajouté un filtre heartbeat avec un délai très court dans ton yaml ? Autrement où en es-tu ? As-tu évolué ou es-tu toujours en attente ?

roumano commented 2 weeks ago

Salut @echavet ,

Voici le code complet actuel :

substitutions:

  name: stationmeteo
  tx_pin_uart0: GPIO17
  rx_pin_uart0: GPIO16
  modbus_adress: '1'
  modbus_adress2: '2'
  modbus_adress3: '3'
  baudrate: '9600'
  updates: 1s

  tx_pin_uart1: GPIO18
  rx_pin_uart1: GPIO19
  baudrate1: '9600'

  tx_pin_uart_clim: GPIO3
  rx_pin_uart_clim: GPIO1

esphome:
  name: ${name}
  friendly_name: Station Météo

  includes:
#    - include/veml6075_custom_sensor.h
#    - include/tx23_custom_sensor.h
  libraries:
#    - "https://github.com/adafruit/Adafruit_VEML6075"
#    - "https://github.com/adafruit/Adafruit_BusIO"
#    - "https://github.com/egzumer/Arduino-LaCrosse-TX23-Library"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  #level: DEBUG
  #level: verbose
  baud_rate: 0
  level: INFO
  logs:
    EVT_SETS : INFO
    WIFI : INFO
    MQTT : INFO
    WRITE_SETTINGS : INFO
    SETTINGS : INFO
    STATUS : INFO
    CN105Climate: INFO
    CN105: INFO
    climate: INFO
    sensor: INFO
    chkSum : INFO
    WRITE : INFO
    READ : INFO
    Header: INFO
    Decoder : INFO
    CONTROL_WANTED_SETTINGS: INFO

# Enable Home Assistant API
api:
  encryption:
    key: "yyyyyyyyyyyyy"
  reboot_timeout: 0s

ota:
- platform: esphome
  password: "zzzzzzzzzz"

wifi:
  manual_ip:
    static_ip: 192.168.x.xx
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: high
  output_power: 8.5db

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Wifi Fallback Hotspot"
    password: "yyyyyyyyyy"

captive_portal:

web_server:
  port: 80

# External component reference
external_components:
  - source: github://echavet/MitsubishiCN105ESPHome
    refresh: 0s

uart:
  - id: uart_0
    tx_pin: ${tx_pin_uart0}
    rx_pin: ${rx_pin_uart0}
    baud_rate: ${baudrate}
    stop_bits: 1
  # debug:
    # direction: BOTH 

  - id: uart_1
    tx_pin: ${tx_pin_uart1}
    rx_pin: ${rx_pin_uart1}
    baud_rate: ${baudrate1}

    # debug:
    # direction: BOTH 

  # Clim
  - id: uart_2
    tx_pin: ${tx_pin_uart_clim}
    rx_pin: ${rx_pin_uart_clim}
    baud_rate: 2400

modbus:
  #flow_control_pin: 23
  uart_id: uart_0
  send_wait_time: 200ms
  id: modbus_weather_station

modbus_controller:
  - id: ${name}
    ## the Modbus device addr1
    address: ${modbus_adress}
    modbus_id: modbus_weather_station
    command_throttle: 200ms
    setup_priority: -10
    update_interval: 5s

  - id: ${name}_anemometre
    ## the Modbus device addr2
    address: ${modbus_adress2}
    modbus_id: modbus_weather_station
    command_throttle: 1000ms
    setup_priority: -10
    update_interval: ${updates}

  - id: ${name}_girouette
    ## the Modbus device addr3
    address: ${modbus_adress3}
    modbus_id: modbus_weather_station
    command_throttle: 1000ms
    setup_priority: -10
    update_interval: 5s

binary_sensor:
  # OK
  - platform: status
    id: ${name}_status
    name: Status
    entity_category: diagnostic

switch:
  # OK
  - platform: restart
    name: Restart

sensor:

  # OK Wifi
  - platform: wifi_signal
    id: WiFi_puissance_${name}
    name: WiFi Puissance
    update_interval: 60s
    entity_category: diagnostic

  - platform: uptime
    id: uptime_sec
    name: Uptime Seconde

##########pyranomètre PRY20###########
  - platform: modbus_controller
    modbus_controller_id: ${name}
    id: ${name}_solar_radiation
    name: ${name}_solar_radiation
    address: 0x0000
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 0
    icon: mdi:sun-wireless
    skip_updates: 1
    unit_of_measurement: "W/m²"

########### BME280 ###################    

  - platform: bme280_i2c
    temperature:
      name: "Temperature"
      oversampling: 16x
      id: ${name}_temperature
      # on_value:
      #   then:
      #     - lambda: 'id(Clim_Grenier).set_remote_temperature(x);'
    pressure:
      name: "Pression"
      id: ${name}_pression
    humidity:
      name: "Humidite"
      id: ${name}_humidite
    address: 0x76
    update_interval: 5s

text_sensor:
  - platform: template
    id: ${name}_uptime
    name: Uptime
    lambda: |-
      int seconds = (id(uptime_sec).state);
      int days = seconds / (24 * 3600);
      seconds = seconds % (24 * 3600); 
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds /  60;
      seconds = seconds % 60;
      if ( days ) {
        return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s ").c_str() };
      } else if ( hours ) {
        return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s ").c_str() };
      } else if ( minutes ) {
        return { (String(minutes) +"m "+ String(seconds) +"s ").c_str() };
      } else {
        return { (String(seconds) +"s ").c_str() };
      }
    icon: mdi:clock-start
    update_interval: 113s
    entity_category: config 

# Besoin pour le bme280
i2c:
  sda: GPIO21
  scl: GPIO22
  frequency: 50kHz
  id: bus_i2c

# Climate entity configuration
climate:
  - platform: cn105
    id: "Clim_Grenier"
    name: "Clim Grenier"
    # 'hardware_uart' options is not supported anymore. Please add a separate UART component with the correct rx and tx pin.
    # hardware_uart: uart_2
    uart_id: uart_2
    icon: mdi:heat-pump
    visual:
      min_temperature: 16
      max_temperature: 31
      temperature_step:
        target_temperature: 1
        current_temperature: 0.1
    vertical_vane_select:
      name: Clim Palette Verticale
    isee_sensor:
      name: Clim ISEE Sensor
    stage_sensor:
      name: Stage Sensor
    sub_mode_sensor:
      name: Sub Mode Sensor
    auto_sub_mode_sensor:
      name: Auto Sub Mode Sensor
    remote_temperature_timeout: 30min
    debounce_delay : 500ms
    update_interval: 4s

J'ai bien sur retirer le niveau de log level: DEBUG car trop verbeux pour le laisser en permanance , ...

Je suis toujours en attente, j'aimerais bien pouvoir activer les ailettes via HA , ...

Bonne journee

roumano commented 2 weeks ago

Ce esp fait aussi station meteo (avant de gerer la clim) donc une bonne partie du code est inutile pour la clim, mais je l'ai poster