1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.62k stars 795 forks source link

Add ability to change Discovery Prefix via WebUI or via mosquitto_pub #2007

Closed puterboy closed 3 months ago

puterboy commented 3 months ago

Description:

Changes made as discussed in https://github.com/1technophile/OpenMQTTGateway/issues/1996 Specifically:

  1. Declaration discovery_Topic deprecated (but still working) and changed to discovery_Prefix to avoid confusion with discovery_topic
  2. New variable discovery_prefix introduced that defaults on new installs to discovery_Prefix (or discovery_Topic if present), is stored in NVS, and can be changed via WebUI (under Configure MQTT) or via mosquitto_pub, using something like:
    mosquitto_pub -t "home/<GATEWAY_NAME>/commands/MQTTtoSYS/config" -m '{  "discovery_prefix": "<NEW_DISCOVERY_PREFIX" }'

I tested it using an esp32 with esp32dev-ble and the functionality works as described. Let me know if you are ok with the PR.

Checklist:

1technophile commented 3 months ago

Thanks, could you update the documentation also.

The build ko for the AWS environment is because some environments do not use discovery. Your change needs to be included when the macro ZmqttDiscovery is defined.

Finally check the box for the DCO in the PR and we will be good

puterboy commented 3 months ago
puterboy commented 3 months ago

Not sure what the lint formatting issues are - I tried to copy how you spaced and indented macro if/else/end statements.

1technophile commented 3 months ago

So as to format automatically your document you have to add the "clang-Format" extension to VSCode, once done, you can format the code by doing a right click into the code file window and clicking "Format document".

puterboy commented 3 months ago

I was actually doing the editing in the web version of github – not VS.

Do you have the ability to fix the formatting on my patch?

From: Florian @.> Sent: Friday, August 16, 2024 6:00 PM To: 1technophile/OpenMQTTGateway @.> Cc: puterboy @.>; Author @.> Subject: Re: [1technophile/OpenMQTTGateway] Add ability to change Discovery Prefix via WebUI or via mosquitto_pub (PR #2007)

So as to format automatically your document you have to add the "clang-Format" extension to VSCode, once done, you can format the code by doing a right click into the code file window and clicking "Format document".

— Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/pull/2007#issuecomment-2294366069 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPGZASM3YHZMXS7C3KQTGTZRZY4LAVCNFSM6AAAAABMTOJCJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJUGM3DMMBWHE . You are receiving this because you authored the thread.Message ID: @.***>

1technophile commented 3 months ago

Yes sure

puterboy commented 3 months ago

Thanks!