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

HVAC Control portion of Web UI dashboard doesn't seem to work at all (other than temp) #182

Closed
anth-dinosaur opened this issue Oct 18, 2022 · 3 comments

Comments

@anth-dinosaur
Copy link

anth-dinosaur commented Oct 18, 2022

Is it just me, or does the HVAC control portion of the web UI not seem to work except for Set Temp setting? I am unable to set power, mode, fan, vane, or wide vane from the UI - as I monitor the MQTT topics, I do not see my "settings" update. Verified that the POST requests are working fine. I've noted the following:

When modifying the beginning of the change_states function on line 1202 as follows:

heatpumpSettings change_states(heatpumpSettings settings) {
  if (server.hasArg("CONNECT")) {
    hp.connect(&Serial1);
  }
  else {
    bool update = false;
    if (server.hasArg("POWER")) {
      settings.power = server.arg("POWER").c_str();
      if (_debugMode) mqtt_client.publish((ha_debug_topic + "msg").c_str(), (char*)("Power: ")); //debugmsg
      if (_debugMode) mqtt_client.publish((ha_debug_topic + "msg").c_str(), (char*)(server.arg("POWER").c_str())); //debugmsg
      if (_debugMode) mqtt_client.publish((ha_debug_topic + "msg").c_str(), (char*)(settings.power)); //debugmsg
      update = true;
    }
...

I get the following three messages on my "debugmsg" MQTT topic:

1. Power:
2. ON
3. �?/

Perhaps this is my unfamiliarity with C++, but settings.power was set equal to server.arg("POWER").c_str(), shouldn't # 2 and # 3 show identical output?

Confirming the above:

  • If I insert hp.setPowerSetting(settings.power); just after the hp.setSettings(settings); at the end of the function, behavior is unchanged.
  • If I insert hp.setPowerSetting(server.arg("POWER").c_str()); just after the hp.setSettings(settings); at the end of the function, the power setting is updated appropriately.

I noticed this as I was able to set the power setting properly by publishing to MQTT, which calls hp.set functions explicitly rather than building a heatpumpSettings object and calling hp.setSettings.

Last thought, the set temperature from the web UI does seem to work properly. Again I am not very familiar with C++ but it seems this is passed as a float rather than a pointer which might make the difference?

Using latest versions of this and Swicago/Heatpump library.

@anth-dinosaur
Copy link
Author

anth-dinosaur commented Oct 30, 2022 via email

@maxmacstn
Copy link

I have the same issue. The solution for me was to copy the string before assigning it to the setting

  if (server.hasArg("CONNECT")) {
    hp.connect(acSerial);
  }
  else {
    bool update = false;
    if (server.hasArg("POWER")) {
      settings.power = strdup(server.arg("POWER").c_str());
      Log.ln(TAG, "Power = " + String(settings.power));
      update = true;
    }
    if (server.hasArg("MODE")) {
      settings.mode = strdup(server.arg("MODE").c_str());
      Log.ln(TAG, "Mode = " + String(settings.mode));
      update = true;
    }
    if (server.hasArg("TEMP")) {
      settings.temperature = convertLocalUnitToCelsius(server.arg("TEMP").toInt(), useFahrenheit);
      Log.ln(TAG, "Temp = " + String(settings.temperature));
      update = true;
    }
    if (server.hasArg("FAN")) {
      settings.fan = strdup(server.arg("FAN").c_str());
      Log.ln(TAG, "Fan = " + String(settings.fan));
      update = true;
    }
    if (server.hasArg("VANE")) {
      settings.vane = strdup(server.arg("VANE").c_str());
      Log.ln(TAG, "Vane = " + String(settings.vane));
      update = true;
    }
    if (server.hasArg("WIDEVANE")) {
      settings.wideVane = strdup(server.arg("WIDEVANE").c_str());
      Log.ln(TAG, "WideVane = " + String(settings.wideVane));
      update = true;
    }

ps. Please ignore Log.ln() function.

@andrewleech
Copy link
Contributor

FYI this issue has been addressed in similar ways in both #248 and #253

@gysmo38 gysmo38 closed this as completed Aug 25, 2024
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

4 participants