Adding a sensor to my .yaml file

So far, I’m using ‘esphome’ from the CLI to prepare my ESP32. I’ve succesfully added a switch to turn on the on-board LED. But when I try to add a DHT11 sensor to the file:

Compiling & transferring this using the the command:
‘esphome run ~/config/huiswerk.yaml’ gives me - after 15 to 75s) - the following error:

collect2: error: ld returned 1 exit status
***** [.pioenvs/trs-80/firmware.elf] Error 1**
========================= [FAILED] Took 75.43 seconds =========================
(venv) jan@Latitude-E5550:~$

I don’t understand why just one extra sensor screws up the complete compilation/linking process. The error codes aren’t really ‘telling’.

I’m running Xubuntu on a i5-5th gen with 8 GB RAM. Isn’t that enough?

Kind regards an thanks in advance for any comments.
Jan

Maybe an extra info. When using the the dashboard of esphome, and import/edit/install that yaml file, I get the remark:

WARNING Cannot use icmplib because privileges are insufficient

Could that be the cause for the above error?

Gpio12is strapping pin, boot fails if pulled up (needed for dht ).
Try some pin 16-33 for example…

And that influences the compilation of the yaml-file?

Absolutely not, just a side note.
Perhaps you get better support for your problem here if you post your code and logs using code tags instead of tiny screenshot.

I already had ‘random’ errors at compiling; it’s always a good idea to clean the build files before starting over.

Hey man, just a couple things first. Please dont upload screenshots of your code/config! There are a couple of different ways to insert code so that it automatically uses the correcy syntax and alignment so people can actually see it and be able to help you!

Second thing is, is there a reason for why you created a “switch” entity for the onboard led light? Its common to be confused as hell at first with understanding the logic here and logically, ya you’d think you need a switch to toggle that light but, it works a little different than that.

In Esphome a Light(led) should actually be configured with the Light Component - ESPHome - Smart Home Made Simple

You’ll also need to use the Output Component - ESP Output Component - ESPHome - Smart Home Made Simple but, since you should be reading the documentation that your using here then you would have easily figured that out all by yourself, right?!?!

Doing it that way will allow you to have access to functionality like dimming led’s, changing colors, changing the temperature, using light/led effects, etc, etc, and having an On/Off function as well because all of that is included when you configure an LED as a Light instead of a Switch so, i would suggest you change that personally.