v1.6.6: Set MCP as default IoT Protocol (#690)

This commit is contained in:
Xiaoxia
2025-05-27 14:58:49 +08:00
committed by GitHub
parent 0c83263762
commit d80f94387a
46 changed files with 524 additions and 428 deletions

View File

@@ -1,29 +0,0 @@
#include "iot/thing.h"
#include "board.h"
#include <esp_log.h>
#define TAG "Temperature"
namespace iot {
class Temperature : public Thing {
private:
float esp32temp = 0.0f;
public:
Temperature() : Thing("Temperature", "芯片温度管理") {
// 定义设备的属性
properties_.AddNumberProperty("temp", "当前芯片温度", [this]() -> float {
auto& board = Board::GetInstance();
if (board.GetTemperature(esp32temp)) {
return esp32temp;
}
return 0;
});
}
};
} // namespace iot
DECLARE_THING(Temperature);

View File

@@ -180,10 +180,12 @@ private:
}
void InitializeIot() {
#if CONFIG_IOT_PROTOCOL_XIAOZHI
auto& thing_manager = iot::ThingManager::GetInstance();
thing_manager.AddThing(iot::CreateThing("Speaker"));
thing_manager.AddThing(iot::CreateThing("Screen"));
thing_manager.AddThing(iot::CreateThing("Battery"));
#endif
}
public: