absalom-muc / MHI-AC-Ctrl

Reads and writes data (e.g. power, mode, fan status etc.) from/to a Mitsubishi Heavy Industries (MHI) air conditioner (AC) via SPI controlled by MQTT
MIT License
253 stars 58 forks source link

Question: why mhi_ac_ctrl_core.loop only when MQTT connected? #144

Closed glsf91 closed 1 year ago

glsf91 commented 1 year ago

@absalom-muc I have a question about:

  if((MQTTStatus==MQTT_RECONNECTED)|(MQTTStatus==MQTT_CONNECT_OK)){
    //Serial.println("MQTT connected in main loop");
    int ret = mhi_ac_ctrl_core.loop(80);
    if (ret < 0)
      Serial.printf_P(PSTR("mhi_ac_ctrl_core.loop error: %i\n"), ret);
  }

I understand MQTT is needed for publishing values and for receiving Troom and other commands. But if for example a DS18B20 is connected it should also work without MQTT (or even WiFi). Also when using Troom from MQTT it can continue operating with the internal AC temp sensor instead of aborting and let the AC poweroff after 120s when no (temporarily) MQTT/WiFi connection. The AC powering off because of the 120s no response when I'm not at home or sleeping is, I think, not desired. I think there is no need to abort responding to the MOSI packets if MQTT is not connected (temporarily) anymore.

Is there a specific reason why the mhi_ac_ctrl_core.loop(80) is only called when MQTT is connected ? Any objections when I change this ?

absalom-muc commented 1 year ago

Switching off the AC after 120 seconds w/o SPI communication is - as far as I know - a safety feature. It should prevent a working AC when the user has no more control. We had in the past already discussions if this feature is a must because several users had the problem that the WiFi/MQTT connection was unstable and this led to switching off the AC after 120 seconds. From my point of view it is a useful feature and effort should be spend for increasing the WiFi/MQTT stability. I can't judge if this feature is a must for safety and if there are rules/standards requiring it.

If you intend to deactivate it, I suggest you make a switch and leave it up to the user if he wants to use the feature or not. In this context please make clear in the description that there might be some safety implication and that the deactivation of this feature is on his own risk.

glsf91 commented 1 year ago

Thanks. I think this is depending of a user his situation. Not for every user (like me) Wifi/MQTT is essential. I will take a look and if I'm going to change it, I will make a switch and keep default current behavior.

glsf91 commented 1 year ago

Added to pull request https://github.com/absalom-muc/MHI-AC-Ctrl/pull/145