try remotevar
This commit is contained in:
parent
ab759ef08e
commit
6c8638319e
5 changed files with 60 additions and 18 deletions
15
src/main.cpp
15
src/main.cpp
|
|
@ -1,5 +1,6 @@
|
|||
#include <main.hpp>
|
||||
|
||||
RemoteVariable pm25_out = RemoteVariable();
|
||||
|
||||
const char *mode_names[] = {"off", "fan_only", "cool"};
|
||||
const char *fan_speed_names[] = {"auto", "high", "medium", "low"};
|
||||
|
|
@ -101,6 +102,12 @@ void setup()
|
|||
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
|
||||
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard);
|
||||
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
|
||||
|
||||
// placeholder
|
||||
// PM2.5 PPM Remote Variable
|
||||
// 12 bytes remote variable, 11 characters + null terminator
|
||||
// Enable value request at /iqair/pm25_request
|
||||
pm25_out.begin(12, "/iqair/pm25_ppm", espmega.iot, true, "/iqair/pm25_request");
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
|
@ -121,4 +128,12 @@ void loop()
|
|||
void on_pin_change(uint8_t pin, uint8_t value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint16_t get_pm25_out()
|
||||
{
|
||||
uint16_t pm25_out_value = 0;
|
||||
// Read PM2.5 PPM from sensor
|
||||
pm25_out_value = atoi(pm25_out.getValue());
|
||||
return pm25_out_value;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue