ESP !include question

Got a question:
ESPhome document explains the following which does work ok.

sensor:
  - <<: !include common/sensor/uptime.config.yaml
  - <<: !include common/sensor/wifi_signal.config.yaml
binary_sensor:
  - <<: !include common/binary_sensor/connection_status.config.yaml

switch:
  - !include common/switch/restart_switch.config.yaml

but how the hell could I !include a separated yaml into a text_sensor? TIA.

Not sure wherr you got that, but I think this is the syntax

switch:
  - !include common/switch/restart.yaml

It’s from here:

Was new to me too.

Documentation has nice examples, but the contents of the files are not shown on the page, unless I am missing something…? Where can I find the source files that the documentation speaks of? Those paths don’t exist by default in my installation.

common/sensor/uptime.config.yaml
common/sensor/wifi_signal.config.yaml
common/binary_sensor/connection_status.config.yaml
common/switch/restart_switch.config.yaml

They are just examples, you have to create the directories and the files yourself, based on your own requirements, and of course you can create more/less directory levels if you want. I have 1 config-yaml for all my ‘default’ sensors like status, wifi, IP-address, uptime etc, not differentiated in /sensor /binary_sensor etc as stated in the examples.