Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于无法在ui界面编辑名字的解决方法 #22

Open
wanghuangjie opened this issue May 21, 2024 · 5 comments
Open

关于无法在ui界面编辑名字的解决方法 #22

wanghuangjie opened this issue May 21, 2024 · 5 comments

Comments

@wanghuangjie
Copy link

需要增加 unique_id 到mqtt发现。

源码src/dc1.cpp

大概在180行左右的位置,参照下面改吧

        sprintf(topic, PSTR("%s/switch/%s_%d/config"), globalConfig.mqtt.discovery_prefix, UID, (ch + 1));
        if (isEnable)
        {
            cmndTopic[strlen(cmndTopic) - 1] = ch + 49;           // 48 + 1 + ch
            powerStatTopic[strlen(powerStatTopic) - 1] = ch + 49; // 48 + 1 + ch
            sprintf(message,
                    PSTR("{\"name\":\"%s_%d\","
                         "\"cmd_t\":\"%s\","
                         "\"stat_t\":\"%s\","
                         "\"pl_off\":\"off\","
                         "\"pl_on\":\"on\","
                         "\"avty_t\":\"%s\","
                         "\"pl_avail\":\"online\","
                         "\"unique_id\":\"%s_%d\","
                         "\"pl_not_avail\":\"offline\"}"),
                         
                    UID, (ch),
                    cmndTopic,
                    powerStatTopic,
                    availability.c_str(),
                    UID, (ch));
            Mqtt::publish(topic, message, true);
            //Debug::AddInfo(PSTR("discovery: %s - %s"), topic, message);
        }
        else
        {
            Mqtt::publish(topic, "", true);
        }
    }

have fun

@wanghuangjie
Copy link
Author

还有ch被我改了。
开关0是总开,依次1-2-3,更直观。

@desinho
Copy link

desinho commented Aug 11, 2024

还有ch被我改了。 开关0是总开,依次1-2-3,更直观。

这个改哪里可以实现?

@TongKwun
Copy link

感谢大佬~传感器我增加unique_id刷完固件就会进修复模式,大佬有解决的方法吗

@TongKwun
Copy link

感谢大佬~传感器我增加unique_id刷完固件就会进修复模式,大佬有解决的方法吗

已经通过编辑YAML文件解决传感器不能编辑名字

@wanghuangjie
Copy link
Author

dc1_fix_uniqid_firmware.bin.zip
今天重新编译了一个

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants