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

Avoid the initial Settings dialog #10

Open
estepper opened this issue May 8, 2023 · 0 comments
Open

Avoid the initial Settings dialog #10

estepper opened this issue May 8, 2023 · 0 comments

Comments

@estepper
Copy link

estepper commented May 8, 2023

Hello,

Thank you very much for this helpful little tool! I'm using it successfully to monitor and control my self-made smarthome devices.

A minor annoyance for me is that the Settings dialog comes up each time I open the page on my iPhone, even though I've hard-coded the correct (and only possible settings) directly in the app.js file. Is there a way to bypass that modal dialog and trigger the MQTT connect automatically?

Although I'm not a web developer (just a plain old Java programmer), I've tried to achieve it myself with the following changes:

  1. In app.js I've factored out a doConnect() method from the settingsHandleOK() method so that I can call it without an event argument:
    settingsHandleOK(bvModalEvt) {
      this.doConnect();
    },
    doConnect() {
      BASE_TOPIC = this.topic;
      DISCOVERY_TOPIC = `${this.topic}/+/$homie`;
      connect_to_mqtt(this);
    }
  1. In index.html I've changed the element from "visible" to "invisible":
         <b-modal
            id="modal-settings"
            ref="modal"
            title="MQTT Settings"
            ok-title="Connect"
            @ok="settingsHandleOK"
            @on.keyup.enter="settingsHandleOK"
            auto-focus-button="ok"
            invisible
          >
  1. At the bottom of index.html I've added a small script:
  <script>
    window.onload = function(event) {
      client_status.doConnect();
    };
  </script>

It seems to work almost correctly. The dialog does not appear. MQTT connect does happen. The page is rendered and filled with my devices. The only remaining (blocking) problem is that the window scrollbar does not appear, so that I can't scroll down in long devices.

Do you have some recommendations for me?

Thanks and all the best
/Eike

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

1 participant