made avty disable global

This commit is contained in:
Tester23
2024-09-05 18:19:26 +02:00
parent beec3ac072
commit d491a71a93
5 changed files with 45 additions and 4 deletions

View File

@ -324,13 +324,13 @@ HassDeviceInfo* hass_init_device_info(ENTITY_TYPE type, int index, const char* p
cJSON_AddStringToObject(info->root, "~", CFG_GetMQTTClientId()); //base topic
// remove availability information for sensor to keep last value visible on Home Assistant
bool flagavty = false;
flagavty = CFG_HasFlag(OBK_FLAG_NOT_PUBLISH_AVAILABILITY_SENSOR);
flagavty = CFG_HasFlag(OBK_FLAG_NOT_PUBLISH_AVAILABILITY);
// if door sensor is running, then deep sleep will be invoked mostly, then we dont want availability
#ifndef OBK_DISABLE_ALL_DRIVERS
if (DRV_IsRunning("DoorSensor") == false && DRV_IsRunning("tmSensor") == false)
#endif
{
if (!isSensor || !flagavty) {
if (!isSensor && !flagavty) {
cJSON_AddStringToObject(info->root, "avty_t", "~/connected"); //availability_topic, `online` value is broadcasted
}
}

View File

@ -2641,7 +2641,7 @@ const char* g_obk_flagNames[] = {
"[LED] Use old linear brightness mode, ignore gamma ramp",
"[MQTT] Apply channel type multiplier on (if any) on channel value before publishing it",
"[MQTT] In HA discovery, add relays as lights",
"[HASS] Deactivate avty_t flag for sensor when publishing to HASS (permit to keep value). You must restart HASS discovery for change to take effect.",
"[HASS] Deactivate avty_t flag when publishing to HASS (permit to keep value). You must restart HASS discovery for change to take effect.",
"[DRV] Deactivate Autostart of all drivers",
"[WiFi] Quick connect to WiFi on reboot (TODO: check if it works for you and report on github)",
"[Power] Set power and current to zero if all relays are open",