1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.51k stars 775 forks source link

GatewayRFM69 setup #133

Closed bkenobi closed 6 years ago

bkenobi commented 6 years ago

This seems like a silly question, but I am trying to perform my first compile of the code. For starters, I downloaded the whole package as well as the individual libraries. I extracted all libraries into the OpenMQTTGateway/libraries path. It appears that in Arduino 1.8.5 the libraries must be in the install path and not in the sketch path.

I've read through the wiki and don't see any guidance on how to set up each of the configurations. I want to use the code to create an ESP8266 + RFM69 to MQTT gateway. I read through the User_config.h and see that I need to comment out the Z... files that I don't need. I have the user_config.h file set as follows:

/*-------------DEFINE THE MODULES YOU WANT BELOW----------------*/
//Addons and module management, comment the Z line and the config file if you don't use
#ifdef ESP8266 // for nodemcu, weemos and esp8266
//  #define ZgatewayRF
//  #include "config_RF.h"
//  #define ZgatewayRF2
//  #define ZgatewayIR
//  #include "config_IR.h"
//  #define ZgatewayBT
//  #include "config_BT.h"
//  #define ZsensorHCSR501
//  #include "config_HCSR501.h"
//  #define ZsensorADC
//  #include "config_ADC.h"
//  #define ZsensorBH1750
//  #include "config_BH1750.h"
//  #define ZsensorBME280
//  #include "config_BME280.h"
  //#define ZsensorDHT // If you uncomment this you can't use I2C due to the fact that I2C use also D1
  //#include "config_DHT.h"
  #define ZgatewayRFM69 // If you uncomment this you can't use RF and BT due to the fact that RF use also D8 and BT use also D6/D7
  #include "config_RFM69.h"

I think this is as needed but I get errors during compile.

OpenMQTTGateway\OpenMQTTGateway.ino: In function 'boolean isAduplicate(long int)':

OpenMQTTGateway:345: error: 'time_avoid_duplicate' was not declared in this scope

       if (now - ReceivedSignal[i][1] < time_avoid_duplicate){ // change

                                        ^

exit status 1
'time_avoid_duplicate' was not declared in this scope

Perhaps I'm missing something obvious. I'm really just trying to get this to compile currently.

1technophile commented 6 years ago

No you are not, i reproduce it, i will publish a correction. By the time you can move the time_avoid_duplicate declaration from config_rf.h to user_config.h.

1technophile commented 6 years ago

master branch updated, please install it and close the issue if ok for you

bkenobi commented 6 years ago

I downloaded and compiled. All is ok.

That said, I'm still not clear on what configuration I should be using. I read through the wiki and know what the hardware config should be. I'm just not sure what needs changing in the User_config.h(or other files) to get the correct setup. I want to use ESP8266 (Wemos D1) + RFM69 to receive 433MHz and then broadcast on MQTT. I see in the hardware compatibility forum there are MANY people who have had no issue. I can't compile with the default configuration and slimming down to just ZgatewayRFM69 doesn't seem to work either. I only changed the #define and #include sections below. Any suggestions or locations where a guide has been posted would help immensely.

... /-------------DEFINE THE MODULES YOU WANT BELOW----------------/ //Addons and module management, comment the Z line and the config file if you don't use

ifdef ESP8266 // for nodemcu, weemos and esp8266

// #define ZgatewayRF // #include "config_RF.h" // #define ZgatewayRF2 // #define ZgatewayIR // #include "config_IR.h" // #define ZgatewayBT // #include "config_BT.h" // #define ZsensorHCSR501 // #include "config_HCSR501.h" // #define ZsensorADC // #include "config_ADC.h" // #define ZsensorBH1750 // #include "config_BH1750.h" // #define ZsensorBME280 // #include "config_BME280.h" //#define ZsensorDHT // If you uncomment this you can't use I2C due to the fact that I2C use also D1 //#include "config_DHT.h"

define ZgatewayRFM69 // If you uncomment this you can't use RF and BT due to the fact that RF use also D8 and BT use also D6/D7

include "config_RFM69.h"

...

1technophile commented 6 years ago

If compile is ok you now have to define your rfm69 parameters in config_RFM69.h

PS:I suppose that as you want to use RFM69 you have other RFM69 module available for sending and receiving data?

bkenobi commented 6 years ago

Sorry, I don't think I explained clearly.

I want to use the ESP8266 with RF to receive from 433MHz sensors (weather station, power meter, etc) and publish to MQTT for use in HA. I want to use the RFM69 due to superior range. I am not planning on using multiple OpenMQTTGateways to communicate with each other. I think if I used a simple 433MHz receiver, I'd configure with ZgatewayRF and ZgatewayRF2 only. But, in order to use RFM69 I have to enable ZgatewayRFM69. However, that appears designed for communication between devices. Maybe I should start off by just installing a 433MHz receiver module first?

1technophile commented 6 years ago

"Maybe I should start off by just installing a 433MHz receiver" Yes you should start with 433mhz receiver and emitter like STX882 & SRX882. Rfm69 is integrated in a way that it can talk only to other rfm69. ZgatewayRF is compatible with this list of devices : https://docs.google.com/spreadsheets/d/1DdtVtSsN25nwP6BZI5q6C9yDGz37tUWjw2SQ1RGwBxU/edit#gid=0 Note that weather stations are not supported

bkenobi commented 6 years ago

I understand that weather station protocols are not currently incorporated. I know the protocol and how to decode it, so I'm hoping inclusion won't be a problem.

If RFM69 is only included for gateway-to-gateway communication, is there any was to make it work as a standard receiver? It's range is supposed to be far superior over other rf modules. I know it can be done as I have an example for use with Arduinos. I don't know if it's easily accomplished for use with rcswitch.

1technophile commented 6 years ago

Yes there is a way by using another library instead of the current one. But this needs some research.

flangeslag commented 6 years ago

Hi, I'm getting a compiling error too:

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board:"Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

C:\Users\Fred_2\Documents\Arduino\OpenMQTTGateway\OpenMQTTGateway.ino: In function 'void setup()':

OpenMQTTGateway:138: error: 'SERIAL_BAUD' was not declared in this scope

 Serial.begin(SERIAL_BAUD, SERIAL_8N1, SERIAL_TX_ONLY);

              ^

exit status 1 'SERIAL_BAUD' was not declared in this scope

I would I preciate it if you provide a solution for this for I'm not a programmer, thanks in advance, Fred

1technophile commented 6 years ago

Hi,

you are trying to set up the RFM69 gateway?

flangeslag commented 6 years ago

Hi, thank you for the fast response, and Yes, I think it's officially called "openmqttgateway", I'm trying to set up the "RF" part.

Op 27 okt. 2017 2:13 p.m. schreef "Florian" notifications@github.com:

Hi,

you are trying to set up the RFM69 gateway?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/issues/133#issuecomment-339954631, or mute the thread https://github.com/notifications/unsubscribe-auth/AOi66URkPextS7LCac9dk-4bgXgQlC_Pks5swckDgaJpZM4QAIsO .

1technophile commented 6 years ago

Ok this issue is related to rfm69. You should better use ZgatewayRF. If you have questions , support needs please go to the gitter tchat on the readme page.

flangeslag commented 6 years ago

If you have to setup an environment like mine, don't bother you can use, mine. Regards Fred

Op 27 okt. 2017 2:13 p.m. schreef "Florian" notifications@github.com:

Hi,

you are trying to set up the RFM69 gateway?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/issues/133#issuecomment-339954631, or mute the thread https://github.com/notifications/unsubscribe-auth/AOi66URkPextS7LCac9dk-4bgXgQlC_Pks5swckDgaJpZM4QAIsO .

1technophile commented 6 years ago

Sorry i don't understand

flangeslag commented 6 years ago

Hi , what is it you don't understand, my request on " openMqttGateway" or using my environment?

Op 27 okt. 2017 3:13 p.m. schreef "Florian" notifications@github.com:

Sorry i don't understand

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/issues/133#issuecomment-339967611, or mute the thread https://github.com/notifications/unsubscribe-auth/AOi66RtJRKohOA-Pyv_MiRcYW_OQd97iks5swdb-gaJpZM4QAIsO .

1technophile commented 6 years ago

@bkenobi could we close this issue as it seems a little bit confusing with these different posts. If you want to include code for weather station you can open another issue with this specific need or submit a pull request

flangeslag commented 6 years ago

Sure we can close this issue Fred

Op 1 nov. 2017 7:20 p.m. schreef "Florian" notifications@github.com:

@bkenobi https://github.com/bkenobi could we close this issue as it seems a little bit confusing with these different posts. If you want to include code for weather station you can open another issue with this specific need or submit a pull request

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/issues/133#issuecomment-341194528, or mute the thread https://github.com/notifications/unsubscribe-auth/AOi66abRBNFV9DcCEV7u4i_q0qlwPMmsks5syLZ7gaJpZM4QAIsO .