Giter Site home page Giter Site logo

Comments (7)

gysmo38 avatar gysmo38 commented on June 29, 2024

ok thank. I will check if it possible to add a check before load the page

from mitsubishi2mqtt.

wabarkley avatar wabarkley commented on June 29, 2024

Thanks. Ideally, the control page would load and operate correctly even if mqtt wasn't configured.
This repo really is super easy to use and fairly robust already. For folks that aren't necessarily interested in mqtt, this would be great to just control the heat pump.

from mitsubishi2mqtt.

rscoleNZ avatar rscoleNZ commented on June 29, 2024

I wish I had seen this... As a complete beginner I assumed either my soldering was wrong tx/rx won't way round, or I was about to reflash my board until I checked here.
But I agree, having it work without MQTT would be ideal.
Thanks for everything you've done to date.

from mitsubishi2mqtt.

smichtch avatar smichtch commented on June 29, 2024

I ran into this as well and was convinced that I botched the crimp terminals yet again.

I think what's happening is handleControl() calls change_states(settings) which triggers hpSettingsChanged() and/or hpStatusChanged() callbacks and neither of those test whether mqtt_client is initialized before trying to publish and that must be causing the crash/reset?
Also handleControl() should probably skip calling change_states(settings) on GET requests.

This is just speculation after skimming though the code, haven't had a chance to try to fix the code yet.

from mitsubishi2mqtt.

wabarkley avatar wabarkley commented on June 29, 2024

Do you think it would be more efficient to initialize the mqtt client but keep it disconnected in some way, or to wrap all the various publish commands with a mqtt_client initialization check?

from mitsubishi2mqtt.

wabarkley avatar wabarkley commented on June 29, 2024

Digging in further, I'm thinking about just setting the setSettingsChangedCallback and setStatusChangedCallback callbacks within initMQTT since I know both hp and mqtt_client will have been initialized at that point. (I'm not sure if that's bad practice, though.)

from mitsubishi2mqtt.

smichtch avatar smichtch commented on June 29, 2024

Ok my hypothesis about hpSettingsChanged()/hpStatusChanged() was wrong.
It's actually crashing in handleControl() when accessing the heatpumpSettings struct:

  if (strcmp(settings.power, "ON") == 0) {
    controlPage.replace("_POWER_ON_", "selected");
  }
  ...

Looks like the default heatpumpSettings is corrupt when loop() isn't polling the heat pump - i.e. when MQTT is not configured.
The control page seems happy after changing loop() from:

  if (!captive and mqtt_config) {
    // Sync HVAC UNIT
    ...
    //MQTT failed retry to connect
    ...
  }
  else ...

to

  if (!captive) {
    // Sync HVAC UNIT
    ...
    if (mqtt_config) {
      //MQTT failed retry to connect
      ...
    }
  }
  else ...

from mitsubishi2mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.