Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle timeout, reseting cycle... MSZ-FS06NA and MSZ-FS15NA #167

Open
totempole opened this issue Oct 9, 2024 · 22 comments
Open

Cycle timeout, reseting cycle... MSZ-FS06NA and MSZ-FS15NA #167

totempole opened this issue Oct 9, 2024 · 22 comments

Comments

@totempole
Copy link

totempole commented Oct 9, 2024

Hello.. First off thank you for maintaining this. Your implementation has saved me from the poor quality that Kumo Cloud is.

Attached is the DEBUG log output from my board where I'm getting a cycle timeout. I did look at another issue with the same error but that was marked fixed (which I cannot seem to find anymore).

ESP-Home: 2024.9.2
Board: ESP8266 ESP-01S
Mitsubishi Indoor Model: MSZFS15NA and MSZFS06NA
Mitsubishi Outdoor Model: MXZ3C0NA
All fan speeds, vane settings and modes have worked so far and with minimal delay if any. The only issue is the cycle timeout I see in the logs. I've tried changing the update_interval but that hasn't made any difference. I've attached the debug log below to see if it's something peculiar to my model.

I've also tried with the d1_mini as the board model and recompiled it but that didn't change the cycle timeout behavior

If you need anything else please let me know

logs_guest-room_logs (2).txt
guest-room (1).yaml.txt

@echavet
Copy link
Owner

echavet commented Oct 9, 2024

Hello.. First off thank you for maintaining this. Your implementation has saved me from the poor quality that Kumo Cloud is.

Attached is the DEBUG log output from my board where I'm getting a cycle timeout. I did look at another issue with the same error but that was marked fixed (which I cannot seem to find anymore).

ESP-Home: 2024.9.2

Board: ESP8266 ESP-01S

Mitsubishi Indoor Model: MSZFS15NA and MSZFS06NA

Mitsubishi Outdoor Model: MXZ3C0NA

All fan speeds, vane settings and modes have worked so far and with minimal delay if any. The only issue is the cycle timeout I see in the logs. I've tried changing the update_interval but that hasn't made any difference. I've attached the debug log below to see if it's something peculiar to my model.

I've also tried with the d1_mini as the board model and recompiled it but that didn't change the cycle timeout behavior

If you need anything else please let me know

logs_guest-room_logs (2).txt

guest-room (1).yaml.txt

Hello @totempole

Thank you for your message
Reading your logs I'd say the cycle timeout is too short. Probably because your ship is slow and your logs are verbose.
What you could try is

  • Either to turn off the logs or configure them less verbose
  • Or increase the update interval in your yaml because timeout is processed in ms this way:
    (2 * update_interval) + 1000;

@totempole
Copy link
Author

Hi @echavet,

Thanks for getting back to me.. I put the logger in DEBUG just so you had a better picture instead of it being just in INFO mode.. The same issue happens while in INFO as well.

As for the update_interval, I've had it at 10s, 20s and 9s... all of them ended in cycle timeout. Of course, this was without the above formula so I will try it again and re-post the logs in INFO mode. Will do in the next 10 minutes. Thanks again

@echavet
Copy link
Owner

echavet commented Oct 9, 2024

Ok
Another thing:
There was an added feature that is not fully supported by all units.
In this case, unit can't reply. So when this situation occurred 3 or 4 times, the request is cancelled and not sent anymore.
This means you get 3, 4 or 5 attempts (I don't remember) with a cycle timeout. But then it should work fine.
You can check that by looking at the diagnose sensors in home assistant. One of them deals with the cycles. Look at history graph. It should be more detailed information.

@totempole
Copy link
Author

Here you go.. New logs attached.. in INFO mode with update_interval set at 11s

The timeout error message now reads at 23s. This is the thing, if I update the interval to let's say 47s, the new timeout occurs at >47s and so on and so forth
logs_guest-room_logs--timeoutat23s.txt

@totempole
Copy link
Author

Ok Another thing: There was an added feature that is not fully supported by all units. In this case, unit can't reply. So when this situation occurred 3 or 4 times, the request is cancelled and not sent anymore. This means you get 3, 4 or 5 attempts (I don't remember) with a cycle timeout. But then it should work fine. You can check that by looking at the diagnose sensors in home assistant. One of them deals with the cycles. Look at history graph. It should be more detailed information.

OK let me add the diagnostic sensors to my template and report back

@totempole
Copy link
Author

Seems I'm getting compile errors with the diagnostic section added to my yaml (attached). Originally, the variable id(hp) wasn't recognized, so I changed it to id(guest-room) and now get compile errors. Any help? Thank you so much
guest-room--with-diagnostic-cant-compile.yaml.txt

@echavet
Copy link
Owner

echavet commented Oct 9, 2024

sure what is the error message?

@totempole
Copy link
Author

Here's the error while trying to install it to the device. I changed the original lambda function from id(hp) to id(guest-room) since leaving it at id(hp), the editor in ESPHome would throw up errors before I could even get to installing the new yaml (Attached in my previous post). guest-room is the name of the device fyi

Thanks!

/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:78:24: error: 'guest' was not declared in this scope
78 | return (bool) id(guest-room).isUARTConnected_;
| ^~~~~
/config/esphome/guest-room.yaml:78:30: error: 'room' was not declared in this scope
78 | return (bool) id(guest-room).isUARTConnected_;
| ^~~~
/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:85:33: error: 'guest' was not declared in this scope
85 | return (unsigned long) id(guest-room).nbCompleteCycles_;
| ^~~~~
/config/esphome/guest-room.yaml:85:39: error: 'room' was not declared in this scope
85 | return (unsigned long) id(guest-room).nbCompleteCycles_;
| ^~~~
/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:92:33: error: 'guest' was not declared in this scope
92 | return (unsigned long) id(guest-room).nbCycles_;
| ^~~~~
/config/esphome/guest-room.yaml:92:39: error: 'room' was not declared in this scope
92 | return (unsigned long) id(guest-room).nbCycles_;
| ^~~~
/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:99:32: error: 'guest' was not declared in this scope
99 | return (unsigned int) id(guest-room).nbHeatpumpConnections_;
| ^~~~~
/config/esphome/guest-room.yaml:99:38: error: 'room' was not declared in this scope
99 | return (unsigned int) id(guest-room).nbHeatpumpConnections_;
| ^~~~
/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:107:43: error: 'guest' was not declared in this scope
107 | unsigned long nbCompleteCycles = id(guest-room).nbCompleteCycles_;
| ^~~~~
/config/esphome/guest-room.yaml:107:49: error: 'room' was not declared in this scope
107 | unsigned long nbCompleteCycles = id(guest-room).nbCompleteCycles_;
| ^~~~
*** [.pioenvs/guest-room/src/main.cpp.o] Error 1
========================== [FAILED] Took 4.76 seconds ==========================

@echavet
Copy link
Owner

echavet commented Oct 9, 2024

Well you have found the issue!!
You did not define the climate id.
It should be defined as "guest-room".

@totempole
Copy link
Author

Thanks for point me in that direction... I know I'm on the right track but can't seem to figure out where to define the climate id.. If I use the same id as defined under

platform: climate
name: "Guest-Room-HeatPump"

I still get errors.. sorry if these are simple/stupid questions..

@phidauex
Copy link
Collaborator

phidauex commented Oct 9, 2024

/config/esphome/guest-room.yaml: In lambda function:
/config/esphome/guest-room.yaml:78:24: error: 'guest' was not declared in this scope
78 | return (bool) id(guest-room).isUARTConnected_;
| ^~~~~
/config/esphome/guest-room.yaml:78:30: error: 'room' was not declared in this scope
78 | return (bool) id(guest-room).isUARTConnected_;

Here is your problem - dashes aren't supported in "id" names (I think in this case the C++ lambda is interpreting guest-room as "guest minus room"). I'd rename your id as guestroom or guest_room. That should let it compile.

@totempole
Copy link
Author

@phidauex

Thanks for the pointer.. not used to case sensitive programming languages.. Only dabble and definitely not C++ haha..

So I changed all of the hyphens to underscrores and then got an error of upper case id names which I then changed to lower case.. Now im stumped... Attaching the yaml if you have time. Thanks.

Uploading guest-room-climate-id-not-compiling.yaml.txt…

@phidauex
Copy link
Collaborator

phidauex commented Oct 9, 2024

Hmm, lets try this another way - try this configuration, it is my working config for a D1 mini, ESP8266, with a few details changed to match your example YAML. One note is that you don't need to spend much time thinking about the id of the component, that is only used internally to that ESPHome device, so hp as the id will work just fine in all cases, even if you have multiple heat pumps.

substitutions:
  name: guest-room
  friendly_name: Guest Room Heatpump

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  
esp8266:
  board: esp01_1m

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

uart:
  id: HP_UART
  baud_rate: 2400
  tx_pin: 1
  rx_pin: 3

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${friendly_name} ESP"
    password: "JJTG9QXWw2sv"

captive_portal:

# Enable logging
logger:
  hardware_uart: UART1
  level: INFO
  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 : WARN
    Header: INFO
    Decoder : INFO
    CONTROL_WANTED_SETTINGS: INFO

# Enable Home Assistant API
api:
  encryption:
    key: "6NIizdHdHwNKYYt/fwXL+3aJSdzSN8uGSIG8UVbB3I0="
  services:
    - service: set_remote_temperature
      variables:
        temperature: float
      then:
# Select between the C version and the F version
#        - lambda: 'id(hp).set_remote_temperature(temperature);'
        - lambda: 'id(hp).set_remote_temperature((temperature - 32.0) * (5.0 / 9.0));'
    - service: use_internal_temperature
      then:
        - lambda: 'id(hp).set_remote_temperature(0);'

ota:
  platform: esphome
  password: "b4369c1e82497c65433911a7e62b9488"

# Enable Web server.
web_server:
  port: 80

# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: ESPHome Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: IP
    ssid:
      name: SSID
    bssid:
      name: BSSID

# Sensors with general information.
sensor:
  # Uptime sensor.
  - platform: uptime
    name: Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: WiFi Signal
    update_interval: 120s

# Create a button to restart the unit from HomeAssistant. Rarely needed, but can be handy.
button:
  - platform: restart
    name: "Restart ${friendly_name}"

climate:
  - platform: cn105
    id: hp
    name: "${friendly_name}"
    icon: mdi:heat-pump
    visual:
      min_temperature: 15
      max_temperature: 31
      temperature_step:
        target_temperature: 1
        current_temperature: 0.5
#    compressor_frequency_sensor:
#      name: ${name} Compressor Frequency
    outside_air_temperature_sensor:
      name: Outside Air Temp
    vertical_vane_select:
      name: Vertical Vane
#    horizontal_vane_select:
#      name: ${name} Horizontal Vane
#    isee_sensor:
#      name: ${name} ISEE Sensor
    remote_temperature_timeout: 30min
    update_interval: 2s
    debounce_delay : 100ms
#    stage_sensor:
#      name: Stage Sensor
#    sub_mode_sensor:
#      name: Sub Mode Sensor
#    auto_sub_mode_sensor:
#      name: Auto Sub Mode Sensor

@totempole
Copy link
Author

@phidauex Awesome and thanks! Trying right now..

@totempole
Copy link
Author

YES!! Got it to compile.. Thank you @phidauex .. I made a silly mistake by not actually defining the id under climate for whatever reason.. Now to get to the part I need to, which is actually the cycle information

@totempole
Copy link
Author

totempole commented Oct 9, 2024

Looking at the diagnostic info.. I dont see any back-off (or request cancelling) happening as per @echavet's comment (# 4).
Screenshot attached

image

@phidauex
Copy link
Collaborator

phidauex commented Oct 9, 2024

Yeah, you aren't getting any connections at all. Here is what I have after about 28 hours of uptime:

image

Hate to say it, but have you considered switching to an ESP32 device? It seems like people have had a devil of a time with the ESP8266 devices (even though mine have been running fine for a few years now).

@totempole
Copy link
Author

Yeah I have a couple D1 Minis lying around...might give that a shot. The funny thing is I can control literally everything on the units... All modes, vane settings, fan speeds etc and pretty instantaneously. Do the errors mean that it's short cycling the unit or it just the read/write comms from the board to the heat pump? Just want to make sure it's not damaging to the heatpump.

@phidauex
Copy link
Collaborator

phidauex commented Oct 9, 2024

Well, if the settings are working then it may not be much of a problem. Sounds like the UART may not be getting a clean signal (can happen on the ESP8266 without external voltage regulator), but that at least some of the communications are going through.

Whatever it is it won’t hurt your unit, it just means that sometimes the settings change will take until the next cycle to get applied.

I wouldn’t bother trying a D1, it could be better or worse. Moving to ESP32 has solved a lot of people’s dodgy communications issues. In this case you have proven that the config is correct, not much else to be done on the software side.

@totempole
Copy link
Author

Yeah I think it's trying to read/write a function that isnt supported and causing it to timeout. I'm using the ESP8266 (https://a.co/d/5Q32kYL) with a 3.3V - 5V LDO regulator (https://a.co/d/dLHqbrv)

Silly question, do I wait for @echavet to confirm I can close this issue? It's still an issue but isnt getting in the way of controlling the actual unit.. My OCD would love to get to the bottom of it if it helps anyone else down the road.

Thanks!

@phidauex
Copy link
Collaborator

phidauex commented Oct 9, 2024

I’d let Eric have the final word on it, I try to help with docs and support but he is the real code owner. Glad it is working, there may be a way to improve the error handling to make it more clear what is happening when the function isn’t supported.

@totempole
Copy link
Author

Awesome.. Thanks @phidauex Appreciate your support. I'll wait for @echavet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants