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

Understanding BootStandalone #319

Closed
betpagal opened this issue Mar 15, 2017 · 5 comments
Closed

Understanding BootStandalone #319

betpagal opened this issue Mar 15, 2017 · 5 comments
Labels

Comments

@betpagal
Copy link

I'm having trouble understanding how BootStandalone works. Does anyone have sample code that I could filch? I can't find anything on the webs.

It looks like it can define a different loop function at boot time. From there, I would expect that I could have some offline (standalone) functionality while waiting for wifi and mqtt connections. Once these are obtained, I would assume that the normal operating mode (and loop function) would take over.

Do I have the gist of this? Sample code is worth a thousand words.

@bertmelis
Copy link
Contributor

check out #125

@betpagal
Copy link
Author

Yes, that's where I started. Marvin said there was a setStandalone in version 2. It's also in the v2 docs, but it's not in the code. There's only one reference to that, and it's in keywords.txt.

I found BootStandalone, but there's no documentation on it. In perusing the code, I found a rich set of functions that allow for setting the boot behavior, but I can't figure out how to make it work. I could go through the code and try to understand how it works, but someone's gotta have an implementation of this functionality that would help me kickstart the feature.

So that's what I'm looking for: some samples of the functionality or perhaps documentation that shows how it works.

@jamesmyatt
Copy link
Contributor

Is setStandalone actually implemented? What would it actually do?

As far as I can tell from the code, the only option is to use it with setHomieBootModeOnNextBoot and setHomieBootMode, which would either wait for or force a reboot.

@marvinroger
Copy link
Member

Well, the setHomieBootModeOnNextBoot PR indeed changed the standalone behavior. To be honest, I'll have to take a look to understand more deeply how it works now. 😅

@amayii0
Copy link

amayii0 commented Oct 29, 2017

Just came across this today. I was looking at having a node running without a MQTT broker.
(I'm having a test creating a clock, so networking is fine for NTP but not yet using more than that).

So we have :
http://marvinroger.github.io/homie-esp8266/develop/advanced-usage/standalone-mode/
https://github.com/marvinroger/homie-esp8266/blob/develop/src/Homie.cpp#L271
https://github.com/marvinroger/homie-esp8266/blob/develop/src/HomieBootMode.hpp#L5

As i'm not that used to Arduino/C++, I struggled to find how to use enum, I ended up to do:

// Arduino Setup Handler
void setup() {
  // When not using MQTT, set as standalone
  Homie.setHomieBootMode(HomieBootMode::STANDALONE);

  // Some more code here
}

As I'm not yet used to PR in GitHub, I'll leave it like this for now but will probably get back some day soon.

For now, I'll try to figure out what is called when using standalone mode and how this would benefit to me :-)
Actually, is there network at all configured? That'll be for later, I have a few days off :)

@stritti stritti closed this as completed Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants