Correct issue with discovery (#721)

* Correct issue with discovery

* Forget declaration for bl0602
This commit is contained in:
Dheenhasty
2023-03-11 18:03:54 +01:00
committed by GitHub
parent ac263958dd
commit 78965377a2
4 changed files with 14 additions and 8 deletions

View File

@ -446,7 +446,7 @@ int http_fn_index(http_request_t* request) {
poststr(request, "</td></tr>");
}
else if (channelType == ChType_OffLowMidHigh || channelType == ChType_OffLowestLowMidHighHighest
else if (channelType == ChType_OffLowMidHigh || channelType == ChType_OffLowestLowMidHighHighest
|| channelType == ChType_LowestLowMidHighHighest || channelType == ChType_LowMidHighHighest
|| channelType == ChType_OffLowMidHighHighest) {
const char** types;
@ -456,7 +456,7 @@ int http_fn_index(http_request_t* request) {
const char* types6[] = { "Off", "Lowest", "Low", "Mid", "High", "Highest" };
const char* types5NoOff[] = { "Lowest", "Low", "Mid", "High", "Highest" };
int numTypes;
if (channelType == ChType_OffLowMidHigh) {
types = types4;
numTypes = 4;
@ -1641,9 +1641,7 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
#ifndef OBK_DISABLE_ALL_DRIVERS
measuringPower = DRV_IsMeasuringPower();
#endif
#if defined(PLATFORM_BEKEN) || defined(WINDOWS)
measuringBattery = DRV_IsRunning("Battery");
measuringBattery = DRV_IsMeasuringBattery();
#endif
get_Relay_PWM_Count(&relayCount, &pwmCount, &dInputCount);

View File

@ -179,7 +179,7 @@ static int http_tasmota_json_ENERGY(void* request, jsonCb_t printer) {
energy = DRV_GetReading(OBK_CONSUMPTION_TOTAL);
energy_hour = DRV_GetReading(OBK_CONSUMPTION_LAST_HOUR);
if (DRV_IsRunning("Battery")) {
if (DRV_IsMeasuringBattery()) {
#if defined(PLATFORM_BEKEN)
voltage = Battery_lastreading(OBK_BATT_VOLTAGE) / 1000.00;
batterypercentage = Battery_lastreading(OBK_BATT_LEVEL);
@ -261,7 +261,7 @@ static int http_tasmota_json_SENSOR(void* request, jsonCb_t printer) {
humidity = CHANNEL_GetFloat(channel_2);
// writer header
printer(request, "\"SHT3X\":");
printer(request, "\"CHT8305\":");
// following check will clear NaN values
printer(request, "{");
printer(request, "\"Temperature\": %.1f,", temperature);
@ -286,7 +286,7 @@ static int http_tasmota_json_status_SNS(void* request, jsonCb_t printer, bool bA
#ifndef OBK_DISABLE_ALL_DRIVERS
if (DRV_IsMeasuringPower()) {
if (DRV_IsMeasuringPower() || DRV_IsMeasuringBattery()) {
// begin ENERGY block
printer(request, ",");