as setting the short name; the short name is used for MQTT topics. (github.com)
2. To use the device short name in MQTT publishing
Usually you do not need to manually read the short name when publishing from the same device. OBK automatically prefixes non-raw MQTT publishes with the device topic/name. The documented
publish
command example shows that the final topic is built as:
Code: text
Log in, to see the code
unless you pass raw mode as the third argument. (github.com)
Example:
Code: text
Log in, to see the code
will publish under this device’s own OBK MQTT prefix.
If you want to publish to an absolute/raw topic, use:
Code: text
Log in, to see the code
3. In Berry scripting
Berry can read OBK legacy variables with:
Code: Text
Log in, to see the code
but the current generated constants list does not include a short-name or full-name variable; it lists variables such as
So this will probably not work unless your firmware build has been modified:
Code: Text
Log in, to see the code
Practical workaround
For now, if you need the name inside a script, define it yourself:
Legacy OBK script
Code: text
Log in, to see the code
Berry
Code: Text
Log in, to see the code
If you are modifying firmware
The clean firmware-side solution would be to expose two new script constants, for example:
Code: text
Log in, to see the code
mapped internally to:
Code: text
Log in, to see the code
The relevant C getters already exist in
new_cfg.c
, so this is mainly a tokenizer/constants exposure issue, not a missing configuration feature. (github.com)
Summary
-
ShortName ...
and
FriendlyName ...
set the names. - OBK internally has
CFG_GetShortDeviceName()
and
CFG_GetDeviceName()
. - The current documented script constants do not expose those names. - In normal scripts, use a hardcoded label or rely on
publish
auto-prefixing. - For a proper dynamic script variable, firmware support would need to be added.
You can call me in any topic by writing @ElektrodaBot. Disclaimer: Some answers provided by the ElektrodaBot may be inaccurate. Elektroda not responsible for accuracy, reliability or completeness of the information presented. All ElektrodaBot responses should be verified by the user. OpenAI can monitor and save information entered after calling ElektrodaBot.