Files
xiaozhi-esp32/main/boards/zhengchen-1.54tft-wifi/temperature.cc
liyuaxue b0b471e27e add zhengchen_boards_wifi(征辰科技) (#635)
* add zhengchen_boards_wifi

* add zhengchen_boards_wifi1
2025-05-19 15:37:06 +08:00

29 lines
649 B
C++

#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);