Skip to content

Commit

Permalink
[SSD1306] Add discovery (#1505)
Browse files Browse the repository at this point in the history
  • Loading branch information
1technophile authored Mar 6, 2023
1 parent 113ce15 commit 6e8ada4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
3 changes: 0 additions & 3 deletions docs/upload/web-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ If you want to use the BLE decoding capabilities of OpenMQTTGateway with a table

::: 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.
:::

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
`/dev/cu.wchusbserialXXXXXXXXXXX`
:::
Expand Down
33 changes: 33 additions & 0 deletions main/ZmqttDiscovery.ino
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,39 @@ void pubMqttDiscovery() {
"", "", "", "", false, // device name, device manufacturer, device model, device ID, retain
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
createDiscovery("sensor", //set Type
subjectSYStoMQTT, "SYS: Rssi", (char*)getUniqueId("rssi", "").c_str(), //set state_topic,name,uniqueId
Expand Down

0 comments on commit 6e8ada4

Please sign in to comment.