mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 20:56:37 +00:00
Change USE_PAHE to HASP_USE_PAHO
This commit is contained in:
parent
cf6817304b
commit
eccfc6c7a2
@ -274,7 +274,7 @@ static WiFiSpiClass WiFi;
|
|||||||
#include "mqtt/hasp_mqtt.h"
|
#include "mqtt/hasp_mqtt.h"
|
||||||
|
|
||||||
#if defined(WINDOWS) || defined(POSIX)
|
#if defined(WINDOWS) || defined(POSIX)
|
||||||
#define USE_PAHO
|
#define HASP_USE_PAHO
|
||||||
#else
|
#else
|
||||||
#define HASP_USE_ESP_MQTT
|
#define HASP_USE_ESP_MQTT
|
||||||
//#define HASP_USE_PUBSUBCLIENT
|
//#define HASP_USE_PUBSUBCLIENT
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if HASP_USE_MQTT_ASYNC > 0
|
#if HASP_USE_MQTT_ASYNC > 0
|
||||||
#ifdef USE_PAHO
|
#ifdef HASP_USE_PAHO
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012, 2020 IBM Corp.
|
* Copyright (c) 2012, 2020 IBM Corp.
|
||||||
@ -403,5 +403,5 @@ IRAM_ATTR void mqttLoop(){};
|
|||||||
|
|
||||||
void mqttEvery5Seconds(bool wifiIsConnected){};
|
void mqttEvery5Seconds(bool wifiIsConnected){};
|
||||||
|
|
||||||
#endif // USE_PAHO
|
#endif // HASP_USE_PAHO
|
||||||
#endif // USE_MQTT
|
#endif // USE_MQTT
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
|
|
||||||
#if HASP_USE_MQTT > 0
|
#if HASP_USE_MQTT > 0
|
||||||
#ifdef USE_PAHO
|
#ifdef HASP_USE_PAHO
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012, 2020 IBM Corp.
|
* Copyright (c) 2012, 2020 IBM Corp.
|
||||||
@ -127,7 +127,7 @@ static void mqtt_message_cb(char* topic, char* payload, size_t length)
|
|||||||
#ifdef HASP_USE_HA
|
#ifdef HASP_USE_HA
|
||||||
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
|
} else if(topic == strstr_P(topic, PSTR("homeassistant/status"))) { // HA discovery topic
|
||||||
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
|
if(mqttHAautodiscover && !strcasecmp_P((char*)payload, PSTR("online"))) {
|
||||||
dispatch_current_state( TAG_MQTT);
|
dispatch_current_state(TAG_MQTT);
|
||||||
mqtt_ha_register_auto_discovery();
|
mqtt_ha_register_auto_discovery();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -232,7 +232,9 @@ int mqtt_send_state(const __FlashStringHelper* subtopic, const char* payload)
|
|||||||
int mqtt_send_discovery(const char* payload, size_t len)
|
int mqtt_send_discovery(const char* payload, size_t len)
|
||||||
{
|
{
|
||||||
char tmp_topic[128];
|
char tmp_topic[128];
|
||||||
snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR(MQTT_PREFIX "/" MQTT_TOPIC_DISCOVERY "/%s"),haspDevice.get_hardware_id());
|
// snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR(MQTT_PREFIX "/" MQTT_TOPIC_DISCOVERY
|
||||||
|
// "/%s"),haspDevice.get_hardware_id());
|
||||||
|
snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR(MQTT_PREFIX "/" MQTT_TOPIC_DISCOVERY));
|
||||||
return mqttPublish(tmp_topic, payload, len, false);
|
return mqttPublish(tmp_topic, payload, len, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,5 +434,5 @@ void mqtt_get_info(JsonDocument& doc)
|
|||||||
info[F(D_INFO_FAILED)] = mqttFailedCount;
|
info[F(D_INFO_FAILED)] = mqttFailedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_PAHO
|
#endif // HASP_USE_PAHO
|
||||||
#endif // USE_MQTT
|
#endif // USE_MQTT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user