[SSD1306] Add discovery (#1505)

This commit is contained in:
Florian authored and GitHub committed 2023-03-06 12:52:40 -06:00
1 parent 113ce15643
commit 6e8ada44b5
2 files changed
+33 -3

No files matched your search

-3
View File
@@ -8,10 +8,7 @@ If you want to use the BLE decoding capabilities of OpenMQTTGateway with a table
::: warning Note ::: warning Note
If you are on macOS and have a LilyGo LoRa32 V2.1 board, make sure you have the [correct driver for the CH9102 Serial Chip](https://github.com/WCHSoftGroup/ch34xser_macos) installed and selected in the popup when initiating the web install. If you are on macOS and have a LilyGo LoRa32 V2.1 board, make sure you have the [correct driver for the CH9102 Serial Chip](https://github.com/WCHSoftGroup/ch34xser_macos) installed and selected in the popup when initiating the web install.
:::
To finalise the driver installation don't forget the confirmation in the **Security** section of **System Preferences** after the restart. To finalise the driver installation don't forget the confirmation in the **Security** section of **System Preferences** after the restart.
The correct driver to then select in the popup of this web install is The correct driver to then select in the popup of this web install is
`/dev/cu.wchusbserialXXXXXXXXXXX` `/dev/cu.wchusbserialXXXXXXXXXXX`
::: :::
+33
View File
@@ -424,6 +424,39 @@ void pubMqttDiscovery() {
"", "", "", "", false, // device name, device manufacturer, device model, device ID, retain "", "", "", "", false, // device name, device manufacturer, device model, device ID, retain
stateClassNone //State Class stateClassNone //State Class
); );
# ifdef ZdisplaySSD1306
createDiscovery("switch", //set Type
subjectSSD1306toMQTT, "SS1306: Control", (char*)getUniqueId("onstate", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "{{ value_json.onstate }}", //set availability_topic,device_class,value_template,
"{\"onstate\":true,\"save\":true}", "{\"onstate\":false,\"save\":true}", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSSD1306set, //set,payload_available,payload_not available ,is a gateway entity, command topic
"", "", "", "", false, // device name, device manufacturer, device model, device MAC, retain
stateClassNone, //State Class
"false", "true" //state_off, state_on
);
createDiscovery("switch", //set Type
subjectSSD1306toMQTT, "SS1306: Display metric", (char*)getUniqueId("displaymetric", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "{{ value_json.displaymetric }}", //set availability_topic,device_class,value_template,
"{\"displaymetric\":true,\"save\":true}", "{\"displaymetric\":false,\"save\":true}", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSSD1306set, //set,payload_available,payload_not available ,is a gateway entity, command topic
"", "", "", "", false, // device name, device manufacturer, device model, device MAC, retain
stateClassNone, //State Class
"false", "true" //state_off, state_on
);
createDiscovery("number", //set Type
subjectSSD1306toMQTT, "SSD1306: Brightness", (char*)getUniqueId("brightness", "").c_str(), //set state_topic,name,uniqueId
will_Topic, "", "{{ value_json.brightness }}", //set availability_topic,device_class,value_template,
"{\"brightness\":{{value}},\"save\":true}", "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Gateway_AnnouncementMsg, will_Message, true, subjectMQTTtoSSD1306set, //set,payload_available,payload_not available,is a gateway entity, command topic
"", "", "", "", false, // device name, device manufacturer, device model, device ID, retain
stateClassNone //State Class
);
# endif
# ifndef ESP32_ETHERNET # ifndef ESP32_ETHERNET
createDiscovery("sensor", //set Type createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Rssi", (char*)getUniqueId("rssi", "").c_str(), //set state_topic,name,uniqueId subjectSYStoMQTT, "SYS: Rssi", (char*)getUniqueId("rssi", "").c_str(), //set state_topic,name,uniqueId