How to use platformio? I cannot find anything written for dummies

I am an old guy; why does everybody think switching to platformio is simple? I have been trying to decrypt it for 2 months now.
Openmqttgateway seems to be exactly what I want but it is impossible to compile on Arduino IDE.

1 Like

Hi @donbrew,

How exactly did you try with PlatformIO so far?

Do you require changes in the code for which you cannot install the prebuilt binaries from the Web Install page?

The way I found pretty easy myself when I started with OpenMQTTGateway was via Visual Studio Code.

https://docs.platformio.org/en/latest/integration/ide/vscode.html#installation

  1. Download and install Visual Studio Code

  2. In VSC search for the official platformio ide extension

  3. Install the PlatformIO IDE extension

  4. Download the OpenMQTTGateway zipped source code - at the end of the assets on the release page

  5. Unzipp the source code

  6. In VSC go to File - Open and open the OpenMQTTGateway Source directory.

Now you have the OpenMQTTGateway source in VSC and can make any required adjustments.

Building and Uploading then is as easy as selecting the appropriate environment on the left side from the PlatformIO icon, expanding the appropriate environment and selecting Build/Upload - shown for esp32dev-ble below

I removed VSC then re installed it with the platformio extension
downloaded the CODE from github (I want cc1101 and ir
unzipped it
modified user.config to include those modules (using Notepad++)
modified the 2 module configs for my pinouts (using Notepad++)
loaded the code into platformio
clicked on the check mark to build
It went on and on for 2 hours, I noted that in red it said there were 2 pubsubclient library and please specify which one near the point it started compiling again.

The reason I let it repeat is the number of found libraries kept changing.

Before that I tried to use a prebuilt cc1101 that had the same sort of problems and a web download that I could not make work after I( finally figured out the password is “your_password”., set it up with cell phone then no browser interface and nothing on the serial

No need to really do that directly in user.config and the module configs, that is what the environment definitions are for to simplify working with the source code.

BUT reading in your post that you would like to have

I want cc1101 and ir

CC1101 with rtl_433?? and IR in one single gateway, probably on an ESP32?

What you should do is look at the environment definitions for esp32dev-ir and esp32dev-rtl_433 and combine them in a new personal environment, also making it possible to define any custom pinouts in the environment.

Going though different environment definitions in the environments.ini file should make the possibilities of environments clearer.

ESP8266. using nodemcuv2 rf1 and nodemcuv2 ir
Today I tried again and got a couple of fatal errors about not found in windows. Didn’t get those last night. Nothing different. Just closed and reopened VSC.

Assuming with the first one you mean nodemcuv2-rf-cc1101 and then nodemcuv2-ir, looking at the two environment definitions

[env:nodemcuv2-rf-cc1101]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager8266}
  ${libraries.rc-switch}
  ${libraries.smartrc-cc1101-driver-lib}
  ${libraries.esp8266_mdns}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayRF="RF"'
  '-DZradioCC1101="CC1101"'
  '-DGateway_Name="OMG_ESP8266_RF-CC1101"'
board_build.flash_mode = dout
custom_description = RF gateway using RCSwitch library with CC1101

and

[env:nodemcuv2-ir]
platform = ${com.esp8266_platform}
board = nodemcuv2
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager8266}
  ${libraries.irremoteesp}
  ${libraries.esp8266_mdns}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayIR="IR"'
  '-DGateway_Name="OMG_ESP8266_IR"'
board_build.flash_mode = dout
custom_description = Infrared gateway using IRremoteESP8266

combining the two environments into a single one as your custom environment should do the trick, again with possible required additional pinout definitions depending on how you wired things up. Just make sure you rename it to something uniqu, like

[env:nodemcuv2-ir-rf-MINE]
…

and it will also show up for Bulding and Uploading in the environment list under the PlattformIO icon as shown above.

All modules modifications you have made in user.config should be reverted and restored to the source defaults.

Could you shows us how your added combined environment looks like, and also which pinout changes you made in the appropriate module configs?

Where in the docs does it say to do anything like that?
All I see is to uncomment the modules in user.config.
How does that solve the pubsubclient error?

The cc1101 is set to trans on D1 and rec on D2. Ir on D0.
I am very close to giving up, again.

Maybe the docs might need some simplifications somewhere, but also reading through other threads here in the forum you might see that by defining custom environments it really is the easiest and simplest method for creating and building your own custom builds, e.g.

Just out of curiosity, when changing all the modules in user.config and setting the pinouts in the two module configs, which environment did you then try to build? The same way I described above though the PlatformIO sidebar environment selection? It is more likely though that you then tried to build ALL environments with some CLI command, which keeps giving you errors and making you annoyed

It went on and on for 2 hours

If you just trust me and follow the simple instructions I gave above you will very likely quickly go “Oh, it’s that simple” and it builds in under a minute.

Easiest test would be to just Build and Upload one of the above predefined environments, which should show you how quick the building and uploading is, even though giving you just the one single gateway functionality.

It would be a shame if you gave up now, being so close, if you just spend a few minutes combining the above two environments (duplicate entries need not to exist twice) and telling us how you defined the pinouts so that they also can be included in the environment.

You can just change env:nodemcuv2-rf-cc1101 to include IR.

you need to check config_ files for rf and ir

It should work