mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-07 22:25:53 +02:00
fix #416
This commit is contained in:
parent
0305c114cf
commit
c1eed6eef2
2 changed files with 10 additions and 4 deletions
|
@ -42,6 +42,7 @@ void app::setup(uint32_t timeout) {
|
||||||
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, mSys, &mUtcTimestamp, &mSunrise, &mSunset);
|
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, mSys, &mUtcTimestamp, &mSunrise, &mSunset);
|
||||||
mPayload.addListener(std::bind(&PubMqttType::payloadEventListener, &mMqtt, std::placeholders::_1));
|
mPayload.addListener(std::bind(&PubMqttType::payloadEventListener, &mMqtt, std::placeholders::_1));
|
||||||
addListener(EVERY_SEC, std::bind(&PubMqttType::tickerSecond, &mMqtt));
|
addListener(EVERY_SEC, std::bind(&PubMqttType::tickerSecond, &mMqtt));
|
||||||
|
addListener(EVERY_MIN, std::bind(&PubMqttType::tickerMinute, &mMqtt));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
setupLed();
|
setupLed();
|
||||||
|
|
|
@ -67,6 +67,14 @@ class PubMqtt {
|
||||||
sendIvData();
|
sendIvData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tickerMinute() {
|
||||||
|
if(mAddressSet) {
|
||||||
|
char val[40];
|
||||||
|
snprintf(val, 40, "%ld", millis() / 1000);
|
||||||
|
sendMsg("uptime", val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setCallback(MQTT_CALLBACK_SIGNATURE) {
|
void setCallback(MQTT_CALLBACK_SIGNATURE) {
|
||||||
mClient->setCallback(callback);
|
mClient->setCallback(callback);
|
||||||
}
|
}
|
||||||
|
@ -218,13 +226,10 @@ class PubMqtt {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isConnected(true); // really needed? See comment from HorstG-57 #176
|
isConnected(true); // really needed? See comment from HorstG-57 #176
|
||||||
char topic[32 + MAX_NAME_LENGTH], val[32];
|
char topic[32 + MAX_NAME_LENGTH], val[40];
|
||||||
float total[4];
|
float total[4];
|
||||||
bool sendTotal = false;
|
bool sendTotal = false;
|
||||||
bool totalIncomplete = false;
|
bool totalIncomplete = false;
|
||||||
snprintf(val, 40, "%ld", millis() / 1000);
|
|
||||||
|
|
||||||
sendMsg("uptime", val);
|
|
||||||
|
|
||||||
sendMsg("wifi_rssi", String(WiFi.RSSI()).c_str());
|
sendMsg("wifi_rssi", String(WiFi.RSSI()).c_str());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue