Connecting 1-Wire

Having failed to get my 1-Wire network connected to HA in any direct way (e.g. by connecting the 1-Wire data wire to a GPIO on my Rasp Pi, or by plugging a DS2490R into my RPi), I am now trying to use an ESPhome to act as a gateway. I bought a D1 Mini Pro, and I think I have successfully flashed ESPhome onto it. Now I need to get my !-Wire connected. I see from Dallas Temperature Sensor — ESPHome that I need to add some code like this:

Example configuration entry

dallas:

  • pin: 23

Individual sensors

sensor:

  • platform: dallas
    address: 0x1c0000031edd2a28
    name: “Livingroom Temperature”

Questions:

  1. Where do I need to add this code? To one of the YAML files on the RPi? If so, which one? Or to somewhere on the D1 Mini? If so where, and how?
  2. What is the pin 23 referred to in the above example? In my case 1-Wire data is connected to pin D4 on the D1 Mini.

I hope someone can help me get this working…

Thank you - Rowan