Skip to content

Commit

Permalink
Merge pull request #3750 from Moustachauve/product-data-0_15
Browse files Browse the repository at this point in the history
Allow product information to be specified at build time
  • Loading branch information
blazoncek committed Feb 7, 2024
2 parents 7eae8f6 + ed2950f commit eae1707
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions usermods/BH1750_v2/usermod_bh1750.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class Usermod_BH1750 : public Usermod
JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("identifiers")] = "wled-sensor-" + String(mqttClientID);
device[F("manufacturer")] = F("WLED");
device[F("model")] = F("FOSS");
device[F("manufacturer")] = F(WLED_BRAND);
device[F("model")] = F(WLED_PRODUCT_NAME);
device[F("sw_version")] = versionString;

String temp;
Expand Down
4 changes: 2 additions & 2 deletions usermods/BME280_v2/usermod_bme280.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class UsermodBME280 : public Usermod
JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("identifiers")] = "wled-sensor-" + String(mqttClientID);
device[F("manufacturer")] = F("WLED");
device[F("model")] = F("FOSS");
device[F("manufacturer")] = F(WLED_BRAND);
device[F("model")] = F(WLED_PRODUCT_NAME);
device[F("sw_version")] = versionString;

String temp;
Expand Down
4 changes: 2 additions & 2 deletions usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ void PIRsensorSwitch::publishHomeAssistantAutodiscovery()
JsonObject device = doc.createNestedObject(F("device")); // attach the sensor to the same device
device[F("name")] = serverDescription;
device[F("ids")] = String(F("wled-sensor-")) + mqttClientID;
device[F("mf")] = "WLED";
device[F("mdl")] = F("FOSS");
device[F("mf")] = F(WLED_BRAND);
device[F("mdl")] = F(WLED_PRODUCT_NAME);
device[F("sw")] = versionString;

sprintf_P(buf, PSTR("homeassistant/binary_sensor/%s/config"), uid);
Expand Down
4 changes: 2 additions & 2 deletions wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ void serializeInfo(JsonObject root)
#endif
root[F("opt")] = os;

root[F("brand")] = "WLED";
root[F("product")] = F("FOSS");
root[F("brand")] = F(WLED_BRAND);
root[F("product")] = F(WLED_PRODUCT_NAME);
root["mac"] = escapedMac;
char s[16] = "";
if (Network.isConnected())
Expand Down
18 changes: 18 additions & 0 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
// version code in format yymmddb (b = daily build)
#define VERSION 2402060

// You can define custom product info from build flags.
// This is useful to allow API consumer to identify what type of WLED version
// they are interacting with. Be aware that changing this might cause some third
// party API consumers to consider this as a non-WLED device since the values
// returned by the API and by MQTT will no longer be default. However, most
// third party only uses mDNS to validate, so this is generally fine to change.
// For example, Home Assistant will still work fine even with this value changed.
// Use like this:
// -D WLED_BRAND="\"Custom Brand\""
// -D WLED_PRODUCT_NAME="\"Custom Product\""
#ifndef WLED_BRAND
#define WLED_BRAND "WLED"
#endif
#ifndef WLED_PRODUCT_NAME
#define WLED_PRODUCT_NAME "FOSS"
#endif


//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG

Expand Down

0 comments on commit eae1707

Please sign in to comment.