Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Gene Liverman
Gene Liverman

Posted on • Originally published atbeanbag.technicalissues.us on

Temperature sensing for Jupiter Garage

The other day I was listening toLinux Unplugged 441 and heard Chris mention how he wished he had a way to track the temperature in the garage where the server is.

I decided that this was something I could help with, so I hit him up on Twitter:

Hey@ChrisLAS - I was listening to LUP today and heard you might need to monitor temperatures in your garage… DM me if you want a cloudless WiFi monitor based on ESPHome.

— Technical Issues (@technicalissues)January 19, 2022

We chatted a tad via direct messages and then I built this:

Photo of the device I made

It’s modeled after one I have in my own garage with a couple of small modifications to suite his use case better. The setup is made up of:

  • a 1/2 size prototyping board
  • a D1 Mini (aka a small ESP8266) microcontroller
  • a BME280 temperature, pressure, and humidity sensor
  • a 3 port spring terminal block
  • a Dallas 1-wire temperature sensor in a waterproof housing with a cable attached

The idea is thatChris will be able to mount this on, or near, the new server cabinet with the microcontroller at the top so that the heat it generates rises above the onboard sensor. The onboard sensor (the purple part) will allow him to monitor the temperature, barometric pressure, and humidity in the garage while the corded sensor will allow for monitoring the temperature inside the server rack.

Accessing the data directly

The microcontroller is configured to present it’s data locally in two ways: via a web page and via a Prometheus endpoint.

The local web page

This page is presented atjupiter-garage-data.local:

Screenshot of device web page

The Prometheus endpoint

This data is presented atjupiter-garage-data.local/metrics:

#TYPE esphome_sensor_value GAUGEesphome_sensor_value{id="jupiter_garage_data_wifi_signal",name="Jupiter Garage Data WiFi Signal",unit="dBm"} -69esphome_sensor_value{id="jupiter_garage_data_server_rack_temperature",name="Jupiter Garage Data Server Rack Temperature",unit="°C"} 20.9esphome_sensor_value{id="jupiter_garage_data_garage_temperature",name="Jupiter Garage Data Garage Temperature",unit="°C"} 20.9esphome_sensor_value{id="jupiter_garage_data_garage_pressure",name="Jupiter Garage Data Garage Pressure",unit="hPa"} 980.3esphome_sensor_value{id="jupiter_garage_data_garage_humidity",name="Jupiter Garage Data Garage Humidity",unit="%"} 31.1#TYPE esphome_sensor_failed GAUGEesphome_sensor_failed{id="jupiter_garage_data_wifi_signal",name="Jupiter Garage Data WiFi Signal"} 0esphome_sensor_failed{id="jupiter_garage_data_server_rack_temperature",name="Jupiter Garage Data Server Rack Temperature"} 0esphome_sensor_failed{id="jupiter_garage_data_garage_temperature",name="Jupiter Garage Data Garage Temperature"} 0esphome_sensor_failed{id="jupiter_garage_data_garage_pressure",name="Jupiter Garage Data Garage Pressure"} 0esphome_sensor_failed{id="jupiter_garage_data_garage_humidity",name="Jupiter Garage Data Garage Humidity"} 0
Enter fullscreen modeExit fullscreen mode

A better way: Home Assistant

Accessing the data locally is all fine and dandy when debugging or doing casual checks, but for everyday usage it is way more helpful to have the data inHome Assistant.ESPHome supports this out of the box and that’s exactly what the code for the microcontroller is built in. Speaking of which, here is the code:

jupiter-garage-data.yaml

substitutions:  name: jupiter-garage-data  friendly_name: Jupiter Garage Data  on_board_sensor_name: Garage  corded_sensor_name: Server Rackesphome:  name: "${name}"esp8266:  board: d1_mini# Enable Home Assistant APIapi:  password: "self-hosted"  # encryption:  # key: !secret enc_key# Used by fallback Access Point (ap)captive_portal:# Enable logginglogger:ota:  # only use one of the two lines below  password: "self-hosted"  # password: !secret ota_passwordprometheus:web_server:  port: 80  # auth:  # username: admin  # password: !secret ota_passwordwifi:  # the two secret names here are now the ones used by default in ESPHome  ssid: !secret wifi_ssid  password: !secret wifi_password  # Enable fallback hotspot (captive portal) in case wifi connection fails  ap:    ssid: "${name}-setup"    password: "self-hosted"# Set device time to match that of Home Assistanttime:  - platform: homeassistant    id: esptime# Use the onboard LED to indicate system statusstatus_led:  pin:    number: D0    inverted: true# Wired sensordallas:  - pin: D4# The bme280 sensor on the board uses i2ci2c:  sda: D2  scl: D1sensor:  - platform: wifi_signal    name: "${friendly_name} WiFi Signal"    update_interval: 60s  - platform: dallas    address: 0x680000066e92ad28    name: "${friendly_name} ${corded_sensor_name} Temperature"  - platform: bme280    temperature:      name: "${friendly_name} ${on_board_sensor_name} Temperature"      oversampling: 16x    pressure:      name: "${friendly_name} ${on_board_sensor_name} Pressure"    humidity:      name: "${friendly_name} ${on_board_sensor_name} Humidity"    address: 0x76    update_interval: 60s
Enter fullscreen modeExit fullscreen mode

Once this device is connected with Home Assistant all the sensors will be availabe for alerts and automations. For example, an automation could be setup to cut on an exhast fan or portable air conditioner if the temperature gets too high. Additionally, if the temperature doesn’t come down fast enough an alert could be sent to one or more members of the JB team so that someone can manually intervene before the hardware is damaged.

Diagrams

Here are a couple of diagrams to help explain things further.

D1 Mini

In the code above the pinsD0,D1,D2, andD4 are referenced. You can see exactly what those correlate to here:

diagram of d1 mini microcontroller pinout

The image above was copied fromhttps://escapequotes.net/esp8266-wemos-d1-mini-pins-and-diagram/

jupiter-garage-data

This diagram shows how I assembled everything:

diagram of jupiter-garage-data

This diagram was created withFritzing

Wrap up

Here’s hoping Chris likes this device hand finds it useful.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
andypiper profile image
Andy Piper
Creative Technologist.Freelance #DevRel at #Mastodon.Friendly DEV moderator. LEGO fan. IoT hacker. MicroPython tinkerer.
  • Location
    Kingston upon Thames, London, UK
  • Education
    Modern History, Brasenose College, Oxford
  • Pronouns
    he/they
  • Work
    Freelance consultant; DevRel at Mastodon gGmbH; open to opportunities.
  • Joined

I love the D1 Mini, it is such a useful board. This is a great story - you heard about a problem / challenge, dug into it a bit more, and came up with a solution. Thanks for sharing!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I am an all-around geek dev'ing on the ops
  • Location
    Georgia, USA
  • Pronouns
    he/him
  • Work
    Site Reliability Engineer at LTN Global
  • Joined

More fromGene Liverman

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp