[DISC] Add runtime configuration for OpenHAB (#1658)

* [DISC] Add runtime configuration for OpenHAB

Add an MQTT configurable system key "ohdiscovery" for OpenHAB auto discovery

* Docs and environments update
This commit is contained in:
Florian authored and GitHub committed 2023-05-31 11:35:35 -05:00
1 parent 4a28f491f5
commit 6e23ca029b
11 files changed
+83 -128

No files matched your search

-3
View File
@@ -7,9 +7,6 @@ So as to use the autodiscovery function you need to have:
* The Jinga transformation addon installed
* The Json transformation addon installed
You need to set `OpenHABAutoDiscovery` to true into `config_mqttDiscovery.h`
`#define OpenHABDiscovery true`
::: tip
If you are connecting to BLE devices it is highly recommended to set `filterConnectable` to `true` in [BT configuration](../use/ble.md#advanced-filter-out-connectable-devices). Otherwise you may encounter incomplete data.
:::
+5 -1
View File
@@ -64,7 +64,7 @@ Bravo👏, second step done! Now let's add the Jinja transformation service.
Second step done!
## Upload OpenMQTTGateway to an ESP32
[Upload OpenMQTTGateway from the web](../upload/web-install.md) by selecting `esp32dev-ble-openhab`
[Upload OpenMQTTGateway from the web](../upload/web-install.md) by selecting the environment corresponding to your need.
Or use another upload method from the Upload section.
@@ -75,6 +75,10 @@ Or use another upload method from the Upload section that requires credentials b
You should see the gateway connected to your broker by checking with an MQTT client like MQTT Explorer.
To make the auto discovery compatible with OpenHAB you have to send the following command with a retain flag.
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"ohdiscovery":true}'`
## Adding the things
1. From the Administration click on "Things" under "Settings", you should see a number in the INBOX button
+9
View File
@@ -33,6 +33,15 @@ If you want the settings to be kept upon gateway restart, you can publish the co
Auto discovery is enable by default on release binaries, on platformio (except for UNO). With Arduino IDE please read the [advanced configuration section](../upload/advanced-configuration#auto-discovery) of the documentation.
:::
## AutoDiscovery compatible with OpenHAB (default: false)
OpenHAB does not support the key `is_defined` in the json template, to remove it at runtime and make the auto discovery compatible you can use the following command with a retain flag.
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"ohdiscovery":true}'`
::: tip
This command can also be used with other controllers that does not support the is_defined key.
:::
## Change the WiFi credentials
`mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoSYS/config" -m '{"wifi_ssid":"ssid", "wifi_pass":"password"}'`