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

Modify new BT config using MQTT #1259

Merged
merged 17 commits into from
Sep 3, 2022

Conversation

BadWolf42
Copy link
Contributor

@BadWolf42 BadWolf42 commented Aug 26, 2022

Description:

Hello Team,

In the continuity of #1256, this PR introduces the ability to modify BT configurations with MQTT payloads.
It also brings the capability to store the configuration directly in chip Non-volatile storage (if desired by the user).

This only adds new functionalities, it does not change current behavior for users that does not use them.

To achieve this, the following changes were made:

  • Move BT Config initialisation BTConfig_default to ZgatewayBT.ino as BTConfig_init()
  • Move BT configuration parameters in function BTConfig_fromJson()
  • Add new parameters to json payload on .../commands/MQTTtoBT/config : presenceEnable, presenceTopic, presenceUseBeaconUuid, extDecoderEnable, extDecoderTopic, filterConnectable, pubKnownServiceData, pubUnknownServiceData, pubKnownManufData, pubUnknownManufData, pubServiceDataUUID, pubBeaconUuidForTopic
  • Add ignoreWBlist as new configuration parameter
  • Report all configuration change on topic .../commands/BTtoMQTT/config
  • Add BT config bool commands (init, load, erase & save) to persist config parameters
  • Update the documentation accordingly

The next (and last) step will be:

As usual, tell me if this is going in the right way for you,

Bad

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

@BadWolf42
Copy link
Contributor Author

BadWolf42 commented Aug 27, 2022

OK, there are 2 issues here:

  • first one is fixed by reverting commit c63b550, in commit cbf92dc (sorry pre-compilation is really tricky with ino files),
  • second one is related to usage of Preference to store BT configuration and I would like your opinion on that.

Currently Preference is a ESP32 specific built-in lib.
A Preference lib for ESP82* and Arduino exists: vshymanskyy/Preferences@^2.0.0

So, should I:

  • modify platformio.ini to include this lib on the required platforms (to have functional parity on all platforms), or
  • do not add any lib and avoid using Preference on non-ESP32 platforms (and only store BT Config in NVS on ESP32) ?

Thanks,
Bad

@BadWolf42
Copy link
Contributor Author

The declaration trick also seems to work for Code Format issue regarding this (redacted) warning:

I spent a lot of time to figure out that the template declaration line 118 will prevent compilation to succeed:
image

if there is a space between template and <typename T> as OMG format guidelines demands:
image

Code Format is now fixed with commit 9392ad0.

@1technophile
Copy link
Owner

Good that you did this only for ESP32 as we are planning to drop the support of HM10 , so no need to save this BLE configuration for ESP8266 or Arduino

@1technophile
Copy link
Owner

1technophile commented Sep 2, 2022

Thanks this is great !

Tested it, LGTM

@1technophile 1technophile merged commit 312ef85 into 1technophile:development Sep 3, 2022
@BadWolf42 BadWolf42 deleted the btconfig branch September 4, 2022 08:34
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

Successfully merging this pull request may close these issues.

2 participants