Feature Suggest: Customizeable Pins (e.g. for BME280)

Hi,
first of all, thanks for these brilliant piece of gatway :slight_smile:
I really love it and currently i’m using 3 devices with openmqttgateway in my setup.
1 NodeMCU with RF and BME280 and two ESP01 with BME280.

With the ESP01 i’ve struggles accross the problem, that the IO Pins needs to be changed… Maybe you can merge my changes into git to support some more boards “out-of-the-box”

Here is my changed prod_env.ini

[platformio]
default_envs = esp01_1m-OpenMediaGateway

[com-esp01]
lib_deps =
${env.lib_deps}
${libraries.wifimanager}
build_flags =
${env.build_flags}
-DMQTT_MAX_PACKET_SIZE=1024
‘-DsimpleReceiving=true’
‘-DTRACE=1’

[env:esp01_1m-OpenMediaGateway]
platform = ${com.esp8266_platform}
board = esp01_1m
lib_deps =
${com-esp01.lib_deps}
${libraries.bme280}
build_flags =
${com-esp01.build_flags}
‘-DZsensorBME280=“BME280”’
‘-DGateway_Name=“OpenMQTTGateway”’
‘-DI2CPIN1=0’
‘-DI2CPIN2=2’

further i changed ZsensorBME280.ino and added at line 103

#ifdef I2CPIN1
#ifdef I2CPIN2
Serial.println(“Change I2C Pins”);
Wire.begin(I2CPIN1, I2CPIN2);
#endif
#endif

Last change is in config_bme280.h

//If you need custom I2C Pins for BME280 you can change it here
//#define I2CPIN1 0
//#define I2CPIN2 2

By the way, i use FHEM as automation software and the openmediagateways reports here. Some days ago i talked about a feature with some guys there in the FHEM forum and he didn’t know OMGW before but he is responsible for the mqtt2 implementation for FHEM and he really loves OMGW and in future there hopefully will be a native support for OMGW in FHEM with predifined Templates. So everyone can easily connect OMGW-Sensors to FHEM…

1 Like

Hi,

Thanks for the idea, in the future I will include more possible definitions into PIO file.

Nice, don’t hesitate if you or he has questions. I will be happy to answer.

It work. Good idea @Dattel01. I have created a pull request with your code.
Thank’s