forked from xiaozhi/xiaozhi-esp32
v1.6.6: Set MCP as default IoT Protocol (#690)
This commit is contained in:
@@ -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);
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user