mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-09 16:25:36 +00:00
drivers define change
* Charts test for Ln882h and w800 * Update cmd_if.c Try fix for DRV_GetReading without ENABLE_DRIVER_BL0937 * Update obk_config.h * Update cmd_if.c next try to fix Drivers w/o OBK_DISABLE_ALL_DRIVERS * Update cmd_channels.c ... and another "DRV_GetReading" ... * Update hass.c ... next problem: DRV_GetEnergySensorNames * Update hass.c .. more disabling code w/o energy driver * Update http_fns.c ... and even more * Update json_interface.c ... and energy drivers in json_interface.c * Update user_main.c another use of BL09X * Update obk_config.h to remove define for charts driver
This commit is contained in:
@ -51,7 +51,7 @@ void hass_populate_unique_id(ENTITY_TYPE type, int index, char* uniq_id) {
|
||||
break;
|
||||
|
||||
case ENERGY_METER_SENSOR:
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
sprintf(uniq_id, "%s_sensor_%s", longDeviceName, DRV_GetEnergySensorNames(index)->hass_uniq_id_suffix);
|
||||
#endif
|
||||
break;
|
||||
@ -243,7 +243,7 @@ HassDeviceInfo* hass_init_device_info(ENTITY_TYPE type, int index, const char* p
|
||||
break;
|
||||
case ENERGY_METER_SENSOR:
|
||||
isSensor = true;
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
if (index <= OBK__LAST)
|
||||
sprintf(g_hassBuffer, "%s", DRV_GetEnergySensorNames(index)->name_friendly);
|
||||
else
|
||||
@ -455,7 +455,7 @@ HassDeviceInfo* hass_init_binary_sensor_device_info(int index, bool bInverse) {
|
||||
return info;
|
||||
}
|
||||
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
|
||||
/// @brief Initializes HomeAssistant power sensor device discovery storage.
|
||||
/// @param index Index corresponding to energySensor_t.
|
||||
|
||||
@ -1681,7 +1681,7 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
|
||||
topic = "homeassistant";
|
||||
}
|
||||
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
measuringPower = DRV_IsMeasuringPower();
|
||||
measuringBattery = DRV_IsMeasuringBattery();
|
||||
#endif
|
||||
@ -1786,7 +1786,7 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
if (measuringPower == true) {
|
||||
for (i = OBK__FIRST; i <= OBK__LAST; i++)
|
||||
{
|
||||
|
||||
@ -194,7 +194,7 @@ static int http_tasmota_json_power(void* request, jsonCb_t printer) {
|
||||
/*
|
||||
{"StatusSNS":{"Time":"2022-07-30T10:11:26","ENERGY":{"TotalStartTime":"2022-05-12T10:56:31","Total":0.003,"Yesterday":0.003,"Today":0.000,"Power": 0,"ApparentPower": 0,"ReactivePower": 0,"Factor":0.00,"Voltage":236,"Current":0.000}}}
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
// returns NaN values as 0
|
||||
static float _getReading_NanToZero(energySensor_t type) {
|
||||
float retval = DRV_GetReading(type);
|
||||
@ -231,7 +231,7 @@ static int http_tasmota_json_ENERGY(void* request, jsonCb_t printer) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // ENABLE_DRIVER_BL0937
|
||||
// Topic: tele/tasmota_48E7F3/SENSOR at 3:06 AM:
|
||||
// Sample:
|
||||
/*
|
||||
@ -352,7 +352,7 @@ static int http_tasmota_json_status_SNS(void* request, jsonCb_t printer, bool bA
|
||||
JSON_PrintKeyValue_String(request, printer, "Time", buff, false);
|
||||
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
|
||||
#ifdef ENABLE_DRIVER_BL0937
|
||||
if (DRV_IsMeasuringPower() || DRV_IsMeasuringBattery()) {
|
||||
|
||||
// begin ENERGY block
|
||||
@ -360,6 +360,7 @@ static int http_tasmota_json_status_SNS(void* request, jsonCb_t printer, bool bA
|
||||
printer(request, "\"ENERGY\":");
|
||||
http_tasmota_json_ENERGY(request, printer);
|
||||
}
|
||||
#endif // ENABLE_DRIVER_BL0937
|
||||
bool bHasAnyDHT = false;
|
||||
for (int i = 0; i < PLATFORM_GPIO_MAX; i++) {
|
||||
int role = PIN_GetPinRoleForPinIndex(i);
|
||||
|
||||
Reference in New Issue
Block a user