1 parent
c68714a434
commit
a7d61f0590
13 files changed
+52
-51
No files matched your search
+5
-4
@@ -38,10 +38,11 @@ char mqtt_user[20] = "your_username"; // not compulsory only if your broker need
|
||||
char mqtt_pass[20] = "your_password"; // not compulsory only if your broker needs authentication
|
||||
char mqtt_server[40] = "192.168.1.17";
|
||||
char mqtt_port[6] = "1883";
|
||||
#define Gateway_Name "OpenMQTTGateway"
|
||||
#define Gateway_Name "/OpenMQTTGateway"
|
||||
#define Base_Topic "home"
|
||||
#define WifiManager_password "your_password"
|
||||
#define version_Topic "home/" Gateway_Name "/version"
|
||||
#define will_Topic "home/" Gateway_Name "/LWT"
|
||||
#define version_Topic Base_Topic Gateway_Name "/version"
|
||||
#define will_Topic Base_Topic Gateway_Name "/LWT"
|
||||
#define will_QoS 0
|
||||
#define will_Retain true
|
||||
#define will_Message "Offline"
|
||||
@@ -169,7 +170,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
|
||||
#endif
|
||||
/*--------------MQTT general topics-----------------*/
|
||||
// global MQTT subject listened by the gateway to execute commands (send RF, IR or others)
|
||||
#define subjectMQTTtoX "home/commands/#"
|
||||
#define subjectMQTTtoX Base_Topic Gateway_Name "/commands/#"
|
||||
#define subjectMultiGTWKey "toMQTT"
|
||||
|
||||
//variables to avoid duplicates
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define ADC "home/ADCtoMQTT"
|
||||
#define ADC Base_Topic Gateway_Name "/ADCtoMQTT"
|
||||
#define TimeBetweenReadingADC 200 // time between 2 ADC readings, minimum 200 to let the time of the ESP to keep the connection
|
||||
#define ThresholdReadingADC 50 // following the comparison between the previous value and the current one +- the threshold the value will be published or not
|
||||
|
||||
|
||||
+3
-3
@@ -41,9 +41,9 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define LUX "home/LIGHTtoMQTT/lux"
|
||||
#define FTCD "home/LIGHTtoMQTT/ftcd"
|
||||
#define WATTSM2 "home/LIGHTtoMQTT/wattsm2"
|
||||
#define LUX Base_Topic Gateway_Name "/LIGHTtoMQTT/lux"
|
||||
#define FTCD Base_Topic Gateway_Name "/LIGHTtoMQTT/ftcd"
|
||||
#define WATTSM2 Base_Topic Gateway_Name "/LIGHTtoMQTT/wattsm2"
|
||||
|
||||
//Time used to wait for an interval before resending measured values
|
||||
unsigned long timebh1750 = 0;
|
||||
|
||||
+6
-6
@@ -41,12 +41,12 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define TEMPBMEC "home/CLIMAtoMQTT/bme/tempc"
|
||||
#define TEMPBMEF "home/CLIMAtoMQTT/bme/tempf"
|
||||
#define HUMBME "home/CLIMAtoMQTT/bme/hum"
|
||||
#define PRESSBME "home/CLIMAtoMQTT/bme/pa"
|
||||
#define ALTIBMEM "home/CLIMAtoMQTT/bme/altim"
|
||||
#define ALTIBMEFT "home/CLIMAtoMQTT/bme/altift"
|
||||
#define TEMPBMEC Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/tempc"
|
||||
#define TEMPBMEF Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/tempf"
|
||||
#define HUMBME Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/hum"
|
||||
#define PRESSBME Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/pa"
|
||||
#define ALTIBMEM Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/altim"
|
||||
#define ALTIBMEFT Base_Topic Gateway_Name "/CLIMAtoMQTT/bme/altift"
|
||||
|
||||
//Time used to wait for an interval before resending measured values
|
||||
unsigned long timebme280 = 0;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*----------------------BT topics & parameters-------------------------*/
|
||||
#define subjectBTtoMQTT "home/BTtoMQTT/"
|
||||
#define subjectBTtoMQTT Base_Topic Gateway_Name "/BTtoMQTT/"
|
||||
#define TimeBtw_Read 20000 //define the time between 2 scans
|
||||
#define Scan_duration 10 //define the time for a scan
|
||||
#define HM-10
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define HUM1 "home/DHTtoMQTT/dht1/hum"
|
||||
#define TEMP1 "home/DHTtoMQTT/dht1/temp"
|
||||
#define HUM1 Base_Topic Gateway_Name "/DHTtoMQTT/dht1/hum"
|
||||
#define TEMP1 Base_Topic Gateway_Name "/DHTtoMQTT/dht1/temp"
|
||||
#define dht_always true // if false when the current value for temp or hum is the same as previous one don't send it by MQTT
|
||||
#define TimeBetweenReadingDHT 30000 // time between 2 DHT readings
|
||||
/*-------------DHT SENSOR TYPE-------------*/
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define subjectHCSR501toMQTT "home/HCSR501toMQTT"
|
||||
#define subjectHCSR501toMQTT Base_Topic Gateway_Name "/HCSR501toMQTT"
|
||||
#define TimeBeforeStartHCSR501 60000 //define the time necessary for HC SR501 init
|
||||
|
||||
/*-------------------PIN DEFINITIONS----------------------*/
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@
|
||||
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define subjectVolttoMQTT "home/INA226toMQTT/Volt"
|
||||
#define subjectCurrenttoMQTT "home/INA226toMQTT/Current"
|
||||
#define subjectPowertoMQTT "home/INA226toMQTT/Power"
|
||||
#define subjectVolttoMQTT Base_Topic Gateway_Name "/INA226toMQTT/Volt"
|
||||
#define subjectCurrenttoMQTT Base_Topic Gateway_Name "/INA226toMQTT/Current"
|
||||
#define subjectPowertoMQTT Base_Topic Gateway_Name "/INA226toMQTT/Power"
|
||||
#define TimeBetweenReadingINA226 30000 // time between 2 INA226 readings
|
||||
|
||||
|
||||
+6
-6
@@ -26,12 +26,12 @@
|
||||
|
||||
/*-------------------IR topics & parameters----------------------*/
|
||||
//IR MQTT Subjects
|
||||
#define subjectGTWIRtoMQTT "home/IRtoMQTT"
|
||||
#define subjectIRtoMQTT "home/IRtoMQTT"
|
||||
#define subjectMQTTtoIR "home/commands/MQTTtoIR"
|
||||
#define subjectIRtoMQTTprotocol "home/IRtoMQTT/protocol"
|
||||
#define subjectIRtoMQTTbits "home/IRtoMQTT/bits"
|
||||
#define subjectIRtoMQTTRaw "home/IRtoMQTT/raw"
|
||||
#define subjectGTWIRtoMQTT Base_Topic Gateway_Name "/IRtoMQTT"
|
||||
#define subjectIRtoMQTT Base_Topic Gateway_Name "/IRtoMQTT"
|
||||
#define subjectMQTTtoIR Base_Topic Gateway_Name "/commands/MQTTtoIR"
|
||||
#define subjectIRtoMQTTprotocol Base_Topic Gateway_Name "/IRtoMQTT/protocol"
|
||||
#define subjectIRtoMQTTbits Base_Topic Gateway_Name "/IRtoMQTT/bits"
|
||||
#define subjectIRtoMQTTRaw Base_Topic Gateway_Name "/IRtoMQTT/raw"
|
||||
// subject monitored to listen traffic processed by other gateways to store data and avoid ntuple
|
||||
#define subjectMultiGTWIR "+/IRtoMQTT"
|
||||
#define IRbitsKey "IRBITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits
|
||||
|
||||
+8
-8
@@ -26,12 +26,12 @@
|
||||
|
||||
/*-------------------RF topics & parameters----------------------*/
|
||||
//433Mhz MQTT Subjects and keys
|
||||
#define subjectMQTTtoRF "home/commands/MQTTto433"
|
||||
#define subjectRFtoMQTT "home/433toMQTT"
|
||||
#define subjectGTWRFtoMQTT "home/433toMQTT"
|
||||
#define subjectRFtoMQTTprotocol "home/433toMQTT/protocol"
|
||||
#define subjectRFtoMQTTbits "home/433toMQTT/bits"
|
||||
#define subjectRFtoMQTTlength "home/433toMQTT/length"
|
||||
#define subjectMQTTtoRF Base_Topic Gateway_Name "/commands/MQTTto433"
|
||||
#define subjectRFtoMQTT Base_Topic Gateway_Name "/433toMQTT"
|
||||
#define subjectGTWRFtoMQTT Base_Topic Gateway_Name "/433toMQTT"
|
||||
#define subjectRFtoMQTTprotocol Base_Topic Gateway_Name "/433toMQTT/protocol"
|
||||
#define subjectRFtoMQTTbits Base_Topic Gateway_Name "/433toMQTT/bits"
|
||||
#define subjectRFtoMQTTlength Base_Topic Gateway_Name "/433toMQTT/length"
|
||||
#define RFprotocolKey "433_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit
|
||||
#define RFbitsKey "RFBITS_" // bits will be defined if a subject contains RFbitsKey followed by a value of 2 digits
|
||||
#define repeatRFwMQTT false // do we repeat a received signal by using mqtt
|
||||
@@ -52,8 +52,8 @@ RF supported protocols
|
||||
|
||||
/*-------------------RF2 topics & parameters----------------------*/
|
||||
//433Mhz newremoteswitch MQTT Subjects and keys
|
||||
#define subjectMQTTtoRF2 "home/commands/MQTTtoRF2"
|
||||
#define subjectRF2toMQTT "home/RF2toMQTT"
|
||||
#define subjectMQTTtoRF2 Base_Topic Gateway_Name "/commands/MQTTtoRF2"
|
||||
#define subjectRF2toMQTT Base_Topic Gateway_Name "/RF2toMQTT"
|
||||
#define RF2codeKey "CODE_" // code will be defined if a subject contains RF2codeKey followed by a value of 7 digits
|
||||
#define RF2periodKey "PERIOD_" // period will be defined if a subject contains RF2periodKey followed by a value of 3 digits
|
||||
#define RF2unitKey "UNIT_" // number of your unit value will be defined if a subject contains RF2unitKey followed by a value of 1-2 digits
|
||||
|
||||
+5
-5
@@ -27,16 +27,16 @@
|
||||
/*----------------------RFM69 topics & parameters -------------------------*/
|
||||
// Topic where the message from RFM69 will be published by the gateway,
|
||||
// appended with the nodeID of the sender
|
||||
#define subjectRFM69toMQTT "home/RFM69toMQTT"
|
||||
#define subjectRFM69toMQTT Base_Topic Gateway_Name "/RFM69toMQTT"
|
||||
// Upon reception of a packed, the RSSI of that packet will be publish to this topic,
|
||||
// appended with the nodeID of the sender
|
||||
#define subjectRFM69toMQTTrssi "home/RFM69toMQTT/rssi" // Comment this if you don't want the RSSI to be published.
|
||||
#define subjectRFM69toMQTTsender "home/RFM69toMQTT/sender"
|
||||
#define subjectRFM69toMQTTrssi Base_Topic Gateway_Name "/RFM69toMQTT/rssi" // Comment this if you don't want the RSSI to be published.
|
||||
#define subjectRFM69toMQTTsender Base_Topic Gateway_Name "/RFM69toMQTT/sender"
|
||||
// Topic subscribed by the gateway. Messages received will be sent to RFM69
|
||||
#define subjectMQTTtoRFM69 "home/commands/MQTTtoRFM69"
|
||||
#define subjectMQTTtoRFM69 Base_Topic Gateway_Name "/commands/MQTTtoRFM69"
|
||||
#define RFM69receiverKey "RCV_" // receiver id will be defined if a subject contains RFM69receiverKey followed by a value of 3 digits
|
||||
// On reception of an ack from RFM69, the message that has been sent is published here
|
||||
#define subjectGTWRFM69toMQTT "home/RFM69toMQTT/acked"
|
||||
#define subjectGTWRFM69toMQTT Base_Topic Gateway_Name "/RFM69toMQTT/acked"
|
||||
#define defaultRFM69ReceiverId 99
|
||||
|
||||
// Default values
|
||||
|
||||
+8
-8
@@ -27,14 +27,14 @@
|
||||
|
||||
/*-------------------RF topics & parameters----------------------*/
|
||||
//433Mhz MQTT Subjects and keys
|
||||
#define subjectMQTTtoSRFB "home/commands/MQTTtoSRFB"
|
||||
#define subjectMQTTtoSRFBRaw "home/commands/MQTTtoSRFB/Raw"
|
||||
#define subjectSRFBtoMQTTTsyn "home/SRFBtoMQTT/Tsyn"
|
||||
#define subjectSRFBtoMQTTTlow "home/SRFBtoMQTT/Tlow"
|
||||
#define subjectSRFBtoMQTTThigh "home/SRFBtoMQTT/Thigh"
|
||||
#define subjectSRFBtoMQTT "home/SRFBtoMQTT"
|
||||
#define subjectGTWSRFBtoMQTT "home/SRFBtoMQTT"
|
||||
#define subjectSRFBtoMQTTRaw "home/SRFBtoMQTT/Raw"
|
||||
#define subjectMQTTtoSRFB Base_Topic Gateway_Name "/commands/MQTTtoSRFB"
|
||||
#define subjectMQTTtoSRFBRaw Base_Topic Gateway_Name "/commands/MQTTtoSRFB/Raw"
|
||||
#define subjectSRFBtoMQTTTsyn Base_Topic Gateway_Name "/SRFBtoMQTT/Tsyn"
|
||||
#define subjectSRFBtoMQTTTlow Base_Topic Gateway_Name "/SRFBtoMQTT/Tlow"
|
||||
#define subjectSRFBtoMQTTThigh Base_Topic Gateway_Name "/SRFBtoMQTT/Thigh"
|
||||
#define subjectSRFBtoMQTT Base_Topic Gateway_Name "/SRFBtoMQTT"
|
||||
#define subjectGTWSRFBtoMQTT Base_Topic Gateway_Name "/SRFBtoMQTT"
|
||||
#define subjectSRFBtoMQTTRaw Base_Topic Gateway_Name "/SRFBtoMQTT/Raw"
|
||||
#define SRFBRptKey "RPT_"
|
||||
#define SRFBmaxipulselengthKey "Thigh_"
|
||||
#define SRFBminipulselengthKey "Tlow_"
|
||||
|
||||
+3
-3
@@ -40,9 +40,9 @@
|
||||
#define TimeBetweenReadingtsl2561 30000
|
||||
/*----------------------------USER PARAMETERS-----------------------------*/
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define LUX "home/LIGHTtoMQTT/lux"
|
||||
#define FTCD "home/LIGHTtoMQTT/ftcd"
|
||||
#define WATTSM2 "home/LIGHTtoMQTT/wattsm2"
|
||||
#define LUX Base_Topic Gateway_Name "/LIGHTtoMQTT/lux"
|
||||
#define FTCD Base_Topic Gateway_Name "/LIGHTtoMQTT/ftcd"
|
||||
#define WATTSM2 Base_Topic Gateway_Name "/LIGHTtoMQTT/wattsm2"
|
||||
|
||||
//Time used to wait for an interval before resending measured values
|
||||
unsigned long timetsl2561 = 0;
|
||||
|
||||
Reference in new issue
Block a user