For starters it’s best to stick to the first example above, and ignore the second one using the extends and using the default env lib_deps and build_flags, until you get more familiar with the whole process.
Initially you copy and paste a whole environment which is closest to what you want/need from platformio.ini (in your case this was '[env:heltec-wifi-lora-32-915]`) and give it a slightly different name to make it unique. Then you add any additional appropriate lib_deps and/or build_flags according to your additional needs, for you these were
'-DZsensorBME280="BME280"'
'-DZsensorTSL2561="TSL2561"'
and other extras like the OTA details etc.
That’s correct - the semicolon to comment out/
The first time you need to comment out all the OTA details
;upload_protocol = espota
;upload_port = OpenMQTTGateway_ESP32_LORA.local
;upload_flags =
; --auth=otapassword
; --port=8266
, but leave the build_flag
'-Dota_password="otapassword"'
so as to send the OTA password the first time to the heltec, so that future OTA connections will actually work
You possibly need an extra upload_port line with
upload_port = /dev/cu......
depending on which OS you are using and how the heltec ESP32 gets recognised by it.
Once the initial serial cable upload has succeeded you can comment out/delete the
upload_port = /dev/cu......
line again and uncomment all the OTA lines for all future OTA updates.
upload_protocol = espota
upload_port = OpenMQTTGateway_ESP32_LORA.local
upload_flags =
--auth=otapassword
--port=8266
Hope this makes things a bit clearer also this thread might give you possible future hints for your portable configuration setup.