ESPhome only shows sensors, no switches

I have an esp32 running esphome with 4 things: Humidity sensor, IR Receiver, IR Transmitter, GPIO output.

For some reason only the sensors (Humidity, IR Receiver) but NOT the switches (IR Transmitter, GPIO) show up in home assistant. Why are they not visible?

Thanks in advance!

ESP Config:

sensor:
  - platform: dht
    pin: 14
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 30s
    model: DHT11
    
remote_receiver:
  pin: 12
  dump: all
remote_transmitter:
  pin: 13
  # Infrared remotes use a 50% carrier signal
  carrier_duty_percent: 50%
  


switch:
  - platform: template
    name: Raw Code Power Button
    turn_on_action:
      - remote_transmitter.transmit_raw:
          carrier_frequency: 38kHz
          code: [4088, -1542, 1019, -510, 513, -1019, 510, -509, 511, -510, 1020,
                 -1020, 1022, -1019, 510, -509, 511, -510, 511, -509, 511, -510,
                 1020, -1019, 510, -511, 1020, -510, 512, -508, 510, -1020, 1022]
  - platform: gpio
    name: "Sheesh_Switch"
    pin:
      number: 18
      mode: INPUT_PULLUP

Log Output:

INFO Reading configuration /var/db/esphome/gavino.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /var/db/esphome/gavino
Processing gavino (board: esp-wrover-kit; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.210126 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
Library Manager: Installing Hash
Warning! Could not find the package with 'Hash' requirements for your system 'freebsd_amd64'
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.7
|   |-- <AsyncTCP-esphome> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size .pioenvs/gavino/firmware.elf
Checking size .pioenvs/gavino/firmware.elf
RAM:   [=         ]  13.1% (used 42944 bytes from 327680 bytes)
Flash: [=====     ]  50.3% (used 923470 bytes from 1835008 bytes)
========================= [SUCCESS] Took 3.05 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of gavino.local
INFO  -> 192.168.178.XXX
INFO Uploading /var/db/esphome/gavino/.pioenvs/gavino/firmware.bin (923584 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from gavino.local using esphome API
WARNING Error resolving IP address of gavino.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno 8] Name does not resolve). Re-Trying in 1 seconds
INFO Connecting to gavino.local:6053 (192.168.178.XXX)
INFO Successfully connected to gavino.local
[09:57:30][I][app:105]: ESPHome version 1.16.2 compiled on Sep 12 2021, 21:54:55
[09:57:30][C][wifi:443]: WiFi:
[09:57:30][C][wifi:303]:   SSID: [redacted]
[09:57:30][C][wifi:304]:   IP Address: 192.168.178.XXX
[09:57:30][C][wifi:306]:   BSSID: [redacted]
[09:57:30][C][wifi:307]:   Hostname: 'gavino'
[09:57:30][C][wifi:311]:   Signal strength: -50 dB ā–‚ā–„ā–†ā–ˆ
[09:57:30][C][wifi:315]:   Channel: 8
[09:57:30][C][wifi:316]:   Subnet: 255.255.255.0
[09:57:30][C][wifi:317]:   Gateway: 192.168.178.1
[09:57:30][C][wifi:318]:   DNS1: 192.168.178.1
[09:57:30][C][wifi:319]:   DNS2: 0.0.0.0
[09:57:30][C][logger:185]: Logger:
[09:57:30][C][logger:186]:   Level: DEBUG
[09:57:30][C][logger:187]:   Log Baud Rate: 115200
[09:57:30][C][logger:188]:   Hardware UART: UART0
[09:57:30][C][dht:017]: DHT:
[09:57:30][C][dht:018]:   Pin: GPIO14 (Mode: INPUT)
[09:57:30][C][dht:022]:   Model: DHT11
[09:57:30][C][dht:027]:   Update Interval: 30.0s
[09:57:30][C][dht:029]:   Temperature 'Living Room Temperature'
[09:57:30][C][dht:029]:     Unit of Measurement: 'Ā°C'
[09:57:30][C][dht:029]:     Accuracy Decimals: 1
[09:57:30][C][dht:029]:     Icon: 'mdi:thermometer'
[09:57:30][C][dht:030]:   Humidity 'Living Room Humidity'
[09:57:30][C][dht:030]:     Unit of Measurement: '%'
[09:57:30][C][dht:030]:     Accuracy Decimals: 0
[09:57:30][C][dht:030]:     Icon: 'mdi:water-percent'
[09:57:30][C][remote_receiver.esp32:054]: Remote Receiver:
[09:57:30][C][remote_receiver.esp32:055]:   Pin: GPIO12 (Mode: INPUT)
[09:57:30][W][remote_receiver.esp32:058]: Remote Receiver Signal starts with a HIGH value. Usually this means you have to invert the signal using 'inverted: True' in the pin schema!
[09:57:30][C][remote_receiver.esp32:060]:   Channel: 0
[09:57:30][C][remote_receiver.esp32:061]:   RMT memory blocks: 3
[09:57:30][C][remote_receiver.esp32:062]:   Clock divider: 80
[09:57:30][C][remote_receiver.esp32:063]:   Tolerance: 25%
[09:57:30][C][remote_receiver.esp32:064]:   Filter out pulses shorter than: 50 us
[09:57:30][C][remote_receiver.esp32:065]:   Signal is done after 10000 us of no changes
[09:57:30][C][captive_portal:169]: Captive Portal:
[09:57:30][C][ota:029]: Over-The-Air Updates:
[09:57:30][C][ota:030]:   Address: gavino.local:3232
[09:57:30][C][ota:032]:   Using Password.
[09:57:30][C][api:095]: API Server:
[09:57:30][C][api:096]:   Address: gavino.local:6053
[09:57:39][D][remote.raw:041]: Received Raw: -203
[09:57:39][D][remote.raw:041]: Received Raw: -342
[09:57:39][D][remote.raw:041]: Received Raw: -264
[09:57:40][D][remote.raw:041]: Received Raw: -304
[09:57:41][D][remote.raw:041]: Received Raw: -489
[09:57:41][D][remote.raw:041]: Received Raw: -336
[09:57:41][D][remote.raw:041]: Received Raw: -256
[09:57:45][D][dht:048]: Got Temperature=24.4Ā°C Humidity=52.0%
[09:57:45][D][sensor:092]: 'Living Room Temperature': Sending state 24.40000 Ā°C with 1 decimals of accuracy
[09:57:45][D][sensor:092]: 'Living Room Humidity': Sending state 52.00000 % with 0 decimals of accuracy
[09:57:48][D][remote.raw:041]: Received Raw: -270

HomeAssistant screenshots:
image

A switch is an output. INPUT_PULLUP is not valid (and not needed).

Iā€™ve had situations where certain sensors didnā€™t show up in HA if i didnā€™t set idā€™s to them. Setting ā€œinternal: falseā€ didnā€™t help, only defining ā€œidā€ did. Canā€™t exactly remember which sensors was the problem, but try if this is also your problem.

They should show up in home assistant if they have a name. Having an id shouldnā€™t make any difference, only name and the internal options.

Untitled

If this is not the case you need to open an issue.

1 Like

Hmā€¦ now, that you pointed out, it might be the other way, yesā€¦ maybe i didnā€™t define a name, only idā€¦
Iā€™ll have to test outā€¦ thanks for the tip!

I found the fix for my issue:

  • Internal Pullup was useless but didnā€™t cause the issue
  • ESPhome failed to update after I added the sensors
    As it turns out, having the sensors connected to the pins, glitches the ESP32, so that the flash is corrupted (esphomeflasher claimed that flash was corrupted) and the update fails. After I disconnected the esp32 from the breadboard so it was bare and powercycled it once, the update went perfectly!

If you look here it states that pin 12 will cause a boot fail