Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DT24 - Update messages to support temp #991

Merged
merged 1 commit into from Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions main/ZgatewayBLEConnect.ino
Expand Up @@ -126,6 +126,8 @@ void DT24_connect::notifyCB(NimBLERemoteCharacteristic* pChar, uint8_t* pData, s
BLEdata.set("power", (float)(((m_data[10] * 256 * 256) + (m_data[11] * 256) + m_data[12]) / 10.0));
BLEdata.set("energy", (float)(((m_data[13] * 256 * 256 * 256) + (m_data[14] * 256 * 256) + (m_data[15] * 256) + m_data[16]) / 100.0));
BLEdata.set("price", (float)(((m_data[17] * 256 * 256) + (m_data[18] * 256) + m_data[19]) / 100.0));
BLEdata.set("tempc", (float)(m_data[24] * 256) + m_data[25]);
BLEdata.set("tempf", (float)(convertTemp_CtoF((m_data[24] * 256) + m_data[25])));

pubBT(BLEdata);
} else {
Expand Down
5 changes: 3 additions & 2 deletions main/ZgatewayBT.ino
Expand Up @@ -541,14 +541,15 @@ void WS02Discovery(const char* mac, const char* sensorModel) {
}

void DT24Discovery(const char* mac, const char* sensorModel) {
# define DT24parametersCount 5
# define DT24parametersCount 6
Log.trace(F("DT24Discovery" CR));
const char* DT24sensor[DT24parametersCount][8] = {
{"sensor", "DT24-volt", mac, "power", jsonVolt, "", "", "V"},
{"sensor", "DT24-amp", mac, "power", jsonCurrent, "", "", "A"},
{"sensor", "DT24-watt", mac, "power", jsonPower, "", "", "W"},
{"sensor", "DT24-watt-hour", mac, "power", jsonEnergy, "", "", "kWh"},
{"sensor", "DT24-price", mac, "", jsonMsg, "", "", ""}
{"sensor", "DT24-price", mac, "", jsonMsg, "", "", ""},
{"sensor", "DT24-temp", mac, "temperature", jsonTempc, "", "", "°C"}
//component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement
};

Expand Down