Newbie: how to set GPIO in portable config file

Hi,

I have some troubles creating a custom pinout with use of a portable config file…
This is what I understood from (Option 3) Upload your configurations | OpenMQTTGateway v1.4.0

I created a file, named

bearforce_rf_env.ini

with following contents

; ======================================================================================
; BEARFORCE
; ======================================================================================
; see 
; https://docs.openmqttgateway.com/upload/builds.html

[platformio]
default_envs = nodemcuv2-rf


[env:nodemcuv2-rf]
build_flags =
  '-DGateway_Name="OMG-004"'
  '-DRF_RECEIVER_GPIO=5'
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'

Seems that some of this config is accepted (MQTT settings) but other aren’t (RF_RECEIVER_GPIO)

Is there something wrong with this config?

PS
I also added my wificonfig, but this is not accepted either

I als tried:

[env:nodemcuv2-rf]
build_flags =
  '-DGateway_Name="OMG-003"'
  -DRF_RECEIVER_GPIO=5
  -DRF_EMITTER_GPIO=3
  -Dwifi_ssid=\"MY\\\-SSID\\\-2GHZ\"
  -Dwifi_password=\"Mypassword2023\"
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'

and

[env:nodemcuv2-rf]
build_flags =
  '-DGateway_Name="OMG-003"'
  '-DRF_RECEIVER_GPIO=5'
  '-DRF_EMITTER_GPIO=3'
  '-Dwifi_ssid="MY-SSID-2GHZ"'
  -Dwifi_password=\"Mypassword2023\"
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'

and

[env:nodemcuv2-rf]
build_flags =
  '-DGateway_Name="OMG-003"'
  '-DRF_RECEIVER_GPIO=5'
  '-DRF_EMITTER_GPIO=3'
  '-Dwifi_ssid="MY-SSID-2GHZ"'
  '-Dwifi_password="Mypassword2023"'
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'

But only the MQTT settings and gateway name are accepted. Wifi and GPIO settings are ignored.
Probably something wrong with syntax. Or my lack of knowledge…

Any help is appreciated!

Kind regards,
Bart

Hi @BartPlessers,

what happens when you rename your custom environment definition to something like

[env:nodemcuv2-rf-bart]

as it very likely currently clashes with the default [env:nodemcuv2-rf] when building and uploading.

aha! will give that a try.
And what to do if I don’t want my custom environment? I just want to define some stuff in the [env:nodemcuv2-rf].

Is this possible?

Sure, this is possible, but with each OMG update the default environment in environments.ini will be reset and you will have to reapply all the changes, while a custom bearforce_rf_env.ini you can just copy into the new OMG directory and you’re set.

still struggling with the syntax.

following seems not to work

[platformio]
default_envs = nodemcuv2-rf-bart

[env:nodemcuv2-rf-bart]
extends = nodemcuv2-rf
build_flags =
  '-DGateway_Name="OMG-005"'
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'
  '-DRF_RECEIVER_GPIO=5'

than I get an error

Error: Please specify platform for 'nodemcuv2-rf-bart' environment

also following doesn’t work

[platformio]
default_envs = nodemcuv2-rf

[env:nodemcuv2-rf-bart]
extends = nodemcuv2-rf
build_flags =
  '-DGateway_Name="OMG-005"'
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'
  '-DRF_RECEIVER_GPIO=5'

because my environment “nodemcuv2-rf-bart” is not adressed anywhere I suppose.

Can somebody provide me with a working example?
The only thing I want to achieve (for now) is

  • select RF
  • setting wifi SSID and passwd
  • setting custom GPIO

thanx in advance!
B

In the example

extends = env:nodemcuv2-pilight-bme280

missing env: :wink:

aaaaaaaaaaaaaaaaaaarghhhhhhhhhhhhhhhhhhh

learning curve…

And also in your custom env.ini you want your default_envs to have the name of your custom environment.

[platformio]
default_envs = nodemcuv2-rf-bart

depending on how you build and upload it.

jihaaaaaa! Eternal fame:

; ======================================================================================
; BEARFORCE
; ======================================================================================
; see 
; https://docs.openmqttgateway.com/upload/builds.html

[platformio]
default_envs = nodemcuv2-rf-bart

[env:nodemcuv2-rf-bart]
extends = env:nodemcuv2-rf
lib_deps =
  ${env:nodemcuv2-rf.lib_deps}
build_flags =
  ${env:nodemcuv2-rf.build_flags}
  '-DGateway_Name="OMG-007"'
  '-DMQTT_USER="your_username"'
  '-DMQTT_PASS="your_password"'
  '-DMQTT_SERVER="mqtt.bearforce.org"'
  '-DRF_RECEIVER_GPIO=5'

GPIO seems to work now

However, wifi settings seems not be be accepted.
Any tips?

I tried

  '-Dwifi_ssid="BEARFORCE-N01-2GHZ"'
  '-Dwifi_password="Password2023"'

and

  '-Dwifi_ssid="BEARFORCE-N01-2GHZ"'
  -Dwifi_password=\"Password2023\"

and

  -Dwifi_ssid=\"BEARFORCE\\\-N01\\\-2GHZ\"
  -Dwifi_password=\"Password2023\"

has this something todo with capitals, hyphen, numbers in my config?
Or is there something els wrong?

grtz
B

Manual WiFi credentials also need

'-DESPWifiManualSetup=true'

then your

'-DESPWifiManualSetup=true'
'-Dwifi_ssid="BEARFORCE-N01-2GHZ"'
'-Dwifi_password="Password2023"'

will work and you are all set with your custom portable env.ini :slight_smile:

Ofcourse! stupid me.
I was confused: if you define wifi_ssid and wifi_password, the wifimanager will NOT start, but the settings are also NOT applied…

anyway, thanx a lot for your patience!
have a good weekend,
bart

1 Like