Very simple ESPHome temperature sensor

Because I wanted a temperature sensor that reported the temperature way more often than most zigbee or zwave devices do I created my own, based on ESPHome.
The following is a step-by step guide (hopefully quite complete). If something is missing, use ChatGPT for help or simply ask me.

Parts-list:

  • Wemos D1 mini V4 (usb-c)
  • Wemos D1 housing
  • DS18B20 waterproof temperature sensor
  • 4,7K resistor
  • Short USB-C cable
  • 3-pin phoenix connector
  • USB-C power-thingy (DeLock Keystone Module USB Type-C)

Step 1
Solder some cables to the Wemos D1 according to the schema below.
Note: the Wemos D1 mini V4 pinning is a bit different from the schema.



Step 2
Solder the pull-up resistor to the signal line and the powerline.


Neatly covered with some Heat-shrinkable tubing and screwed in to the connector (top and bottomshot below).

Step 3
Connect the sensor to the contra-connector.

Step 4
Put it all together

Step 5
Install Python on your computer from www.python.org and install the Microsoft Build tools from Microsoft C++ Build Tools - Visual Studio

Step 6
Install the ESPHome packages

pip install esphome

Step 7
Create a yaml file to your likings, you can use my example at ESPHome-HeatSensor/main.yaml at main ¡ phgmhendrix/ESPHome-HeatSensor ¡ GitHub
It utilizes 2 sensors. Since the sensors use the one-wire protocol you can all connect them in parallel (that also counts for the yellow signal cable).
Please note that you do not know the ID of the sensor yet, you’ll find it in the next step.

Step 7
Connect everything to you computer via USB-C and start programming with the command

esphome run main.yaml


Hit 1 and
When it is running, find the proper sensor ID and put it in your yaml-file, overwriting the current one.

Step 8
Abort the running instance with CTRL+C and after you edited your yaml with the proper ID, reprogram the device and check if everything works.


You should see something like:

Write down the IP address the device got, it will come in handy later.

Step 9
Disconnect everything from your computer and hook the device up to some powersupply, in my case the DeLock-thingy. If all works well the device will connect to your wifi automatically.

Step 10
Install the ESPHome-app on your Homey and add your new device by adding a new ‘physical device’, add your virtual device and configure the sensor and it’s capability.

Step 11
Go get a beer and enjoy your newly created technical wonder :muscle:

And don’t forget to donate the developer of the Homey-app at ESPhome App voor Homey | Homey

7 Likes

Hi Peter,
In step 6 I encountered the next error message:
× Building wheel for unicodedata2 (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [7 lines of output]
C:\Users\frans\AppData\Local\Temp\pip-build-env-_hh9_nw5\overlay\Lib\site-packages\setuptools_distutils\dist.py:261: UserWarning: Unknown distribution option: ‘test_suite’
warnings.warn(msg)
running bdist_wheel
running build
running build_ext
building ‘unicodedata2’ extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for unicodedata2

Happy that I could compile correctly after installing the Microsoft C++ Build Tools. Maybe you can add this (optional?) step in the instructions?

I let you know if all works after I received the module and sensors from the shop…

Hi Peter,
My sensors are online! Thanks for letting me use your idea.

I seem to have a slightly other (newer?) implementation of ESPHome, so I had to define my sensors a little different from your example. Luckily the compiler helped me a lot in the error messages. The last part of my YAML-file looks like this now:

DS18B20 Temperature Sensor

one_wire:

  • platform: gpio
    pin: GPIO2

sensor:

  • platform: dallas_temp
    address: 0x4d0623b27995a528
    name: “Aanvoer”
    update_interval: 15s

  • platform: dallas_temp
    address: 0xc90b24419abac028
    name: “Retour”
    update_interval: 15s

Thanks again, I will certainly lean back and enjoy my drink! Cheers, Frans

1 Like