OpenMQTTGateway icon indicating copy to clipboard operation
OpenMQTTGateway copied to clipboard

[SYS] Use PicoMQTT for MQTT communication

Open mlesniew opened this issue 1 year ago • 4 comments

Description:

This replaces the MQTT library from PubSubClient to PicoMQTT.

This PR doesn't change functionality, the changes shouldn't affect the end user, because the project should work just as before.

Switching to PicoMQTT opens the path to implementing a MQTT broker withing OMG.

TODO

A few things still need to be updated before this is merged:

  • The project does not build for the rfbridge-direct, shelly-plus1 and nodemcuv2-pilight environments. These configurations use outdated board core versions, which are not supported by PicoMQTT. Simply updating the configs to use newer core versions results in linker errors.
  • Just like in the original code, MQTT settings are reverted to old values when a new configuration doesn't work. However, the original logic around this was complex and recently updated, so it needs a careful review.

Checklist:

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

mlesniew avatar May 28 '24 13:05 mlesniew

The configurations, which failed to build should be fixed now. Their board cores are upgraded:

  • In contrast to other configs, shelly-plus1 uses the Tasmota core, it's now updated to use 2.0.7. This is the minimum version supported by PicoMQTT. Unfortunately, upgrading to a newer version of the core is not possible, because it doesn't include support for the legacy SPIFFS file system, which OMG uses.
  • rfbridge-direct and nodemcuv2-pilight are upgraded to use the same core version as all other espressif8266 configs. Unfortunately, simply updating the platform version number was not sufficient. There were linking errors in the ESPiLight library. I found that the root cause for that was the updated GCC version in the newer core, which has different default compilation flags -- more details can be found here. The problem is now fixed with an extra -fcommon build flag.

Let's see if all configs now succeed in the CI.

mlesniew avatar May 28 '24 17:05 mlesniew

@1technophile, I think this PR is now ready to review, please let me know if there's anything that needs updated.

mlesniew avatar May 28 '24 19:05 mlesniew

I need to add #1979 , it has been removed by the merge

1technophile avatar Jun 28 '24 21:06 1technophile

@1technophile no problem, I have now additionally squashed the fixup commit too, so this should be ready for merging as is.

mlesniew avatar Jun 29 '24 19:06 mlesniew

Thanks

1technophile avatar Jul 03 '24 16:07 1technophile