Allow pins/settings to be defined in INI file (#597)
* Allow pins/settings to be defined in INI file * Open to make publishing ManufacturerData optional
This commit is contained in:
1 parent
470790b42e
commit
9fc5ba99f5
9 files changed
+43
-9
No files matched your search
@@ -341,8 +341,10 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
|
|||||||
{ //if not black listed mac we go AND if we have no white mac or this mac is white we go out
|
{ //if not black listed mac we go AND if we have no white mac or this mac is white we go out
|
||||||
if (advertisedDevice.haveName())
|
if (advertisedDevice.haveName())
|
||||||
BLEdata.set("name", (char *)advertisedDevice.getName().c_str());
|
BLEdata.set("name", (char *)advertisedDevice.getName().c_str());
|
||||||
|
#if pubBLEManufacturerData
|
||||||
if (advertisedDevice.haveManufacturerData())
|
if (advertisedDevice.haveManufacturerData())
|
||||||
BLEdata.set("manufacturerdata", (char *)advertisedDevice.getManufacturerData().c_str());
|
BLEdata.set("manufacturerdata", (char *)advertisedDevice.getManufacturerData().c_str());
|
||||||
|
#endif
|
||||||
if (advertisedDevice.haveRSSI())
|
if (advertisedDevice.haveRSSI())
|
||||||
BLEdata.set("rssi", (int)advertisedDevice.getRSSI());
|
BLEdata.set("rssi", (int)advertisedDevice.getRSSI());
|
||||||
if (advertisedDevice.haveTXPower())
|
if (advertisedDevice.haveTXPower())
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ extern void MQTTto2G(char *topicOri, JsonObject &SMSdata);
|
|||||||
#define _2G_MAX_SIGNAL 1000
|
#define _2G_MAX_SIGNAL 1000
|
||||||
|
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
#if !defined(_2G_TX_PIN) || !defined(_2G_RX_PIN) || !defined(_2G_PWR_PIN)
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#define _2G_TX_PIN D6 //D6 to A6 RX,
|
#define _2G_TX_PIN D6 //D6 to A6 RX,
|
||||||
#define _2G_RX_PIN D7 //D7 to A6 TX
|
#define _2G_RX_PIN D7 //D7 to A6 TX
|
||||||
@@ -55,5 +56,6 @@ extern void MQTTto2G(char *topicOri, JsonObject &SMSdata);
|
|||||||
#define _2G_RX_PIN 7 //D7 to A6 TX
|
#define _2G_RX_PIN 7 //D7 to A6 TX
|
||||||
#define _2G_PWR_PIN 5 // connect a MOSFET to power on and off your A6/7 module
|
#define _2G_PWR_PIN 5 // connect a MOSFET to power on and off your A6/7 module
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -31,10 +31,18 @@ extern void ADCtoMQTT();
|
|||||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||||
#define ADCTOPIC "/ADCtoMQTT"
|
#define ADCTOPIC "/ADCtoMQTT"
|
||||||
|
|
||||||
|
#if !defined(TimeBetweenReadingADC) || (TimeBetweenReadingADC < 200)
|
||||||
#define TimeBetweenReadingADC 500 // time between 2 ADC readings, minimum 200 to let the time of the ESP to keep the connection
|
#define TimeBetweenReadingADC 500 // time between 2 ADC readings, minimum 200 to let the time of the ESP to keep the connection
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ThresholdReadingADC
|
||||||
#define ThresholdReadingADC 50 // following the comparison between the previous value and the current one +- the threshold the value will be published or not
|
#define ThresholdReadingADC 50 // following the comparison between the previous value and the current one +- the threshold the value will be published or not
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
#if defined(ESP8266) || !defined(ADC_PIN)
|
||||||
#define ADC_PIN A0 //on nodeMCU this is D3 GPIO0
|
#define ADC_PIN A0 //on nodeMCU this is D3 GPIO0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+13
-1
@@ -32,14 +32,24 @@ extern void MQTTtoBT(char * topicOri, JsonObject& RFdata);
|
|||||||
/*----------------------BT topics & parameters-------------------------*/
|
/*----------------------BT topics & parameters-------------------------*/
|
||||||
#define subjectBTtoMQTT "/BTtoMQTT"
|
#define subjectBTtoMQTT "/BTtoMQTT"
|
||||||
#define subjectMQTTtoBTset "/commands/MQTTtoBT/config"
|
#define subjectMQTTtoBTset "/commands/MQTTtoBT/config"
|
||||||
#define TimeBtw_Read 55555 //define default time between 2 scans
|
|
||||||
#define MinimumRSSI -100 //default minimum rssi value, all the devices below -90 will not be reported
|
#define MinimumRSSI -100 //default minimum rssi value, all the devices below -90 will not be reported
|
||||||
#define Scan_duration 10 //define the time for a scan --WARNING-- changing this value can lead to instability on ESP32
|
#define Scan_duration 10 //define the time for a scan --WARNING-- changing this value can lead to instability on ESP32
|
||||||
#define HM-10
|
#define HM-10
|
||||||
//#define HM-11 // uncomment this line if you use HM-11 and comment the line above
|
//#define HM-11 // uncomment this line if you use HM-11 and comment the line above
|
||||||
//#define HM_BLUE_LED_STOP true //uncomment to stop the blue led light of HM1X
|
//#define HM_BLUE_LED_STOP true //uncomment to stop the blue led light of HM1X
|
||||||
#define BLEdelimiter "4f4b2b444953413a"
|
#define BLEdelimiter "4f4b2b444953413a"
|
||||||
|
|
||||||
|
#ifndef TimeBtw_Read
|
||||||
|
#define TimeBtw_Read 55555 //define default time between 2 scans
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef pubBLEServiceData
|
||||||
#define pubBLEServiceData true // comment if you don't want to publish service data (in case you are having too heavy service data) https://github.com/1technophile/OpenMQTTGateway/issues/318#issuecomment-446064707
|
#define pubBLEServiceData true // comment if you don't want to publish service data (in case you are having too heavy service data) https://github.com/1technophile/OpenMQTTGateway/issues/318#issuecomment-446064707
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef pubBLEManufacturerData
|
||||||
|
#define pubBLEManufacturerData false // define true if you want to publish the manufacturer's data (sometimes contains characters that aren't valid with receiving client)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-------------------HOME ASSISTANT ROOM PRESENCE ----------------------*/
|
/*-------------------HOME ASSISTANT ROOM PRESENCE ----------------------*/
|
||||||
// if not commented Home presence integration with HOME ASSISTANT is activated
|
// if not commented Home presence integration with HOME ASSISTANT is activated
|
||||||
@@ -68,6 +78,7 @@ struct decompose{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
#if !defined(BT_RX) || !defined(BT_TX)
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#define BT_RX 13 //D7 ESP8266 RX connect HM-10 or 11 TX
|
#define BT_RX 13 //D7 ESP8266 RX connect HM-10 or 11 TX
|
||||||
#define BT_TX 12 //D6 ESP8266 TX connect HM-10 or 11 RX
|
#define BT_TX 12 //D6 ESP8266 TX connect HM-10 or 11 RX
|
||||||
@@ -78,5 +89,6 @@ struct decompose{
|
|||||||
#define BT_RX 5 //arduino RX connect HM-10 or 11 TX
|
#define BT_RX 5 //arduino RX connect HM-10 or 11 TX
|
||||||
#define BT_TX 6 //arduino TX connect HM-10 or 11 RX
|
#define BT_TX 6 //arduino TX connect HM-10 or 11 RX
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -38,6 +38,7 @@ extern void DHTtoMQTT();
|
|||||||
//#define DHT_SENSOR_TYPE DHT21 //uncomment for DHT21 Sensor
|
//#define DHT_SENSOR_TYPE DHT21 //uncomment for DHT21 Sensor
|
||||||
#define DHT_SENSOR_TYPE DHT22 //uncomment for DHT22 Sensor (default for backwards compatibility)
|
#define DHT_SENSOR_TYPE DHT22 //uncomment for DHT22 Sensor (default for backwards compatibility)
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
#ifndef DHT_RECEIVER_PIN
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#define DHT_RECEIVER_PIN 5 //5 = D1 you can put 14 = D5 if you don't use HCSR501 sensor and the RFM69
|
#define DHT_RECEIVER_PIN 5 //5 = D1 you can put 14 = D5 if you don't use HCSR501 sensor and the RFM69
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
@@ -45,5 +46,6 @@ extern void DHTtoMQTT();
|
|||||||
#else
|
#else
|
||||||
#define DHT_RECEIVER_PIN 8
|
#define DHT_RECEIVER_PIN 8
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -35,10 +35,14 @@ extern void DS1820toMQTT();
|
|||||||
#define DS1820_ALWAYS true // if false only published current temperature if has changed from previous reading
|
#define DS1820_ALWAYS true // if false only published current temperature if has changed from previous reading
|
||||||
#define DS1820_INTERVAL_SEC 60 // time between DS1820 readings (seconds)
|
#define DS1820_INTERVAL_SEC 60 // time between DS1820 readings (seconds)
|
||||||
#define DS1820_RESOLUTION 10 // conversion times: 9 bit (93.75 ms), 10 bit (187.5 ms), 11 bit (375 ms), 12 bit (750 ms)
|
#define DS1820_RESOLUTION 10 // conversion times: 9 bit (93.75 ms), 10 bit (187.5 ms), 11 bit (375 ms), 12 bit (750 ms)
|
||||||
|
#ifndef DS1820_FAHRENHEIT
|
||||||
#define DS1820_FAHRENHEIT false // defaults to Celcius
|
#define DS1820_FAHRENHEIT false // defaults to Celcius
|
||||||
|
#endif
|
||||||
#define DS1820_DETAILS true // publish extented info for each sensor (resolution, address, type)
|
#define DS1820_DETAILS true // publish extented info for each sensor (resolution, address, type)
|
||||||
#define DS1820_CONV_TIME 2000 // trigger conversion before requesting temperature readings (ms)
|
#define DS1820_CONV_TIME 2000 // trigger conversion before requesting temperature readings (ms)
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
|
||||||
|
#ifndef DS1820_OWBUS_PIN
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#define DS1820_OWBUS_PIN 2
|
#define DS1820_OWBUS_PIN 2
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
@@ -46,5 +50,6 @@ extern void DS1820toMQTT();
|
|||||||
#else
|
#else
|
||||||
#define DS1820_OWBUS_PIN 2
|
#define DS1820_OWBUS_PIN 2
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -21,6 +21,9 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef config_FASTLED_h
|
||||||
|
#define config_FASTLED_h
|
||||||
|
|
||||||
/*-------------------FASTLED topics & parameters----------------------*/
|
/*-------------------FASTLED topics & parameters----------------------*/
|
||||||
//FASTLED MQTT Subjects
|
//FASTLED MQTT Subjects
|
||||||
#define subjectMQTTtoFASTLED "/commands/MQTTtoFASTLED"
|
#define subjectMQTTtoFASTLED "/commands/MQTTtoFASTLED"
|
||||||
@@ -66,14 +69,6 @@
|
|||||||
//#define DATA_PIN 3
|
//#define DATA_PIN 3
|
||||||
//#define CLOCK_PIN 13
|
//#define CLOCK_PIN 13
|
||||||
|
|
||||||
#ifdef ESP8266
|
|
||||||
|
|
||||||
#elif ESP32
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//#define FASTLED_ESP8266_RAW_PIN_ORDER
|
//#define FASTLED_ESP8266_RAW_PIN_ORDER
|
||||||
//#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
|
//#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
|
||||||
@@ -87,3 +82,5 @@
|
|||||||
#define FASTLED_DATA_PIN 10
|
#define FASTLED_DATA_PIN 10
|
||||||
#define FASTLED_CLOCK_PIN 13
|
#define FASTLED_CLOCK_PIN 13
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -32,9 +32,12 @@ extern void HCSR501toMQTT();
|
|||||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||||
#define subjectHCSR501toMQTT "/HCSR501toMQTT"
|
#define subjectHCSR501toMQTT "/HCSR501toMQTT"
|
||||||
|
|
||||||
|
#ifndef TimeBeforeStartHCSR501
|
||||||
#define TimeBeforeStartHCSR501 60000 //define the time necessary for HC SR501 init
|
#define TimeBeforeStartHCSR501 60000 //define the time necessary for HC SR501 init
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-------------------PIN DEFINITIONS----------------------*/
|
/*-------------------PIN DEFINITIONS----------------------*/
|
||||||
|
#ifndef HCSR501_PIN
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#define HCSR501_PIN D5
|
#define HCSR501_PIN D5
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
@@ -42,5 +45,6 @@ extern void HCSR501toMQTT();
|
|||||||
#else
|
#else
|
||||||
#define HCSR501_PIN 7
|
#define HCSR501_PIN 7
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -49,8 +49,10 @@ extern void HTU21toMQTT();
|
|||||||
#define HTUTOPIC "/CLIMAtoMQTT/htu"
|
#define HTUTOPIC "/CLIMAtoMQTT/htu"
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
|
#if !defined(I2C_SDA) || !defined(I2C_SCL)
|
||||||
#define I2C_SDA 16
|
#define I2C_SDA 16
|
||||||
#define I2C_SCL 0
|
#define I2C_SCL 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user