More than just a temperature sensor, the Networked Temperature Sensor (NTS) integrates into your Home Assistant to regularly report temperature data and alert you of temperature events. I recently switched my home automation hub to Home Assistant and it is the one home automation hub to rule them all. It owes allegiances to no brand and yet accommodates every brand. Home Assistant's accommodating nature had me questioning if I could integrate my own home automation devices. The NTS is a resounding yes!
Materials:
Start by downloading the enclosure CAD files from Thingiverse. Print using your preferred 3d printer. I used a Prusa MK3S+. Recommended printer settings in the link.
Once the parts are finished printing, do whatever post processing you believe is necessary. There shouldn't be much as the parts are designed to be printed without any supports. Use a soldering iron and needle nose pliers to secure the threaded inserts in the enclosure base (Part_Studio_1_-_Part_1.stl). The Pico mounting gets x4 of the M3 H8. The lid mounting gets x4 of the M4 H10.
While the parts are printing, follow Installing CircuitPython to setup your Pico with the latest CircuitPython. With CircuitPython configured, add the following libraries to the lib folder on the Pico's CIRCUITPY drive. Libraries can be found in the Library Bundle.
Download the project code from the GitHub Repo. Configure your settings.toml by replacing your_wifi_ssid_here and your_wifi_password_here with your wifi info. For now, visit Webhook.site for a "Your unique URL". Leave the page open for later testing. Replace your_webhook_endpoint_url_here with this URL. We'll revisit settings.toml with a Home Assistant webhook endpoint URL once we configure Home Assistant. Copy code.py and settings.toml to the Pico's CIRCUITPY drive.
Mount the Pico in the PiCowbell being sure to orient the Pico such that the USB and STEMMA ports are on the same side. Prewire the Pico with USB cable, temperature sensor and rotary encoder according to the below schematic. Wire the rotary encoder by first soldering individual wires to each terminal. Heatshrink as necessary. Install the Prewired Pico in the enclosure base.
Prepare the enclosure lid. Reason I designed a separate TPU spacer for the OLED display is because I cracked the first OLED display when I went to install it. This is what a cracked OLED display looks like.
WARNING: Don't crack your OLED display. A cracked OLED display is not very useful.
Solder individual wires to the green push button terminals. On the negative terminal, solder the 470 Ohm resister. Heatshrink as necessary. Install the TPU spacer, OLED display and green push button in the enclosure lid.
Bring it all together. Mount the temperature sensor in the enclosure base front opening. Use the STEMMA cable to wire the sensor to the OLED display. Land the green push button on the PiCowbell according to the schematic. Install the rotary encoder in the enclosure lid. Lastly install the USB panel mount in the enclosure base and connect the USB cable.
At this point, there's probably not a lot of room left. Carefully tuck the cables inside and close the lid. Screw the lid down until snug. Don't forget to add the little rubber bumper feet.
Test that your NTS is functioning as intended.
{ "temperature_f": 74.9, "critical_alert": True, }
If all looks well, continue on to Step 7. Otherwise, rinse and repeat until clean, i.e. step through 1 through 6 again to make sure you didn't miss anything.
You've finished making a device that periodically reports the temperature via webhooks. Now, let's use that webhook data to display live temperature on Home Assistant and generate temperature alert notifications on your phone.
service: input_number.set_value metadata: {} data: entity_id: input_number.pico_temp_sensor value: "{{ trigger.json.temperature_f }}"
{{ trigger.json.critical_alert == True }}
Enjoy. Place the NTS on your prototype project to monitor temperature over long periods of time. Place on your 3d printer if you're worried about thermal run away events and filling your apartment with smoke. Place on your bonsai to know when it's too hot outside and time to bring the plant inside. Go wild.