* attempt to fix homeassistant auto discovery #1066
This commit is contained in:
lumapu 2023-08-04 18:26:42 +02:00
parent 7afa9d1d1b
commit 47c4ca6551
3 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,8 @@
# Development Changes
## 0.7.22 - 2023-08-04
* attempt to fix homeassistant auto discovery #1066
## 0.7.21 - 2023-07-30
* fix MqTT YieldDay Total goes to 0 serveral times #1016

View file

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 21
#define VERSION_PATCH 22
//-------------------------------------
typedef struct {

View file

@ -391,9 +391,9 @@ class PubMqtt {
const char *devCls, *stateCls;
if (!total) {
if (rec->assign[mDiscovery.sub].ch == CH0)
snprintf(name, 32, "%s %s", iv->config->name, iv->getFieldName(mDiscovery.sub, rec));
snprintf(name, 32, "%s %s", iv->getFieldName(mDiscovery.sub, rec));
else
snprintf(name, 32, "%s CH%d %s", iv->config->name, rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(name, 32, "CH%d_%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(topic, 64, "/ch%d/%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));
snprintf(uniq_id, 32, "ch%d_%s", rec->assign[mDiscovery.sub].ch, iv->getFieldName(mDiscovery.sub, rec));