# Temperature and Humidity Sensing in Home Assistant with CircuitPython

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/099/211/medium800/temperature___humidity_Main_Image.jpg?1612372649)

This guide will cover how to add a temperature/humidity sensor to Home Assistant using MQTT and Circuit Python. It is assumed that you already have a Home Assistant server up and running and that you have already installed the Mosquitto broker Add-on.

**No soldering is required for this project** , its plug-and-play thanks to the Metro ESP32-S2's [STEMMA QT](https://www.adafruit.com/category/1018) port and [the many QT-friendly sensors we've got](https://www.adafruit.com/category/620). Simply plug in the sensor and run the code to make customizable projects with sensing and Home Assistant!

![](https://cdn-learn.adafruit.com/assets/assets/000/099/214/medium800/temperature___humidity_PlugnPlay.jpg?1612373395)

This guide shows you how to configure the [SHTC3 Humidity and Temperature sensor](https://www.adafruit.com/product/4636) for Home Assistant, though other sensors can be used with just a little modification. This particular sensor has a wide range of temperatures, excellent accuracy, has low power consumption and has a Stemma QT port for plug and play without soldering. You can read more about this sensor in our [Adafruit Sensirion SHTC3 - Temperature & Humidity Sensor Breakout](https://learn.adafruit.com/adafruit-sensirion-shtc3-temperature-humidity-sensor) guide.

For the main board, an ESP32-S2 is used because of the great combination of the built-in WiFi and the StemmaQT, but if you have another board that can connect to WiFi, runs CircuitPython, and can have your sensor wired up to it, that will work as well.

![](https://cdn-learn.adafruit.com/assets/assets/000/099/134/medium800/temperature___humidity_Main_Image.jpg?1611964287)

## Parts List
### Adafruit Metro ESP32-S2

[Adafruit Metro ESP32-S2](https://www.adafruit.com/product/4775)
What's Metro shaped and has an ESP32-S2 WiFi module? What has a STEMMA QT connector for I2C devices, and a Lipoly charger circuit? What has your favorite Espressif WiFi microcontroller and lots of memory for your next IoT project?

That's right - its the new Adafruit Metro...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4775)
[Related Guides to the Product](https://learn.adafruit.com/products/4775/guides)
![Angled shot of Adafruit Metro esp32-s2 ](https://cdn-shop.adafruit.com/640x480/4775-06.jpg)

### Adafruit Sensirion SHTC3 Temperature & Humidity Sensor

[Adafruit Sensirion SHTC3 Temperature & Humidity Sensor](https://www.adafruit.com/product/4636)
Sensirion Temperature/Humidity sensors are some of the finest & highest-accuracy devices you can get. And&nbsp;finally, we have some that have a true I2C interface for easy reading. The&nbsp; **SHTC3** &nbsp;sensor has an excellent ±2% relative humidity and ±0.2...

In Stock
[Buy Now](https://www.adafruit.com/product/4636)
[Related Guides to the Product](https://learn.adafruit.com/products/4636/guides)
![Angled shot of small, black, rectangular humidity and temperature sensor breakout.](https://cdn-shop.adafruit.com/640x480/4636-05.jpg)

### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
![Angled shot of STEMMA QT / Qwiic JST SH 4-pin Cable.](https://cdn-shop.adafruit.com/640x480/4210-00.jpg)

Optionally add a battery for mobility or backup protection.

### Lithium Ion Polymer Battery - 3.7v 1200mAh

[Lithium Ion Polymer Battery - 3.7v 1200mAh](https://www.adafruit.com/product/258)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 1200mAh for a total of about 4.5 Wh. If you need a larger battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/258)
[Related Guides to the Product](https://learn.adafruit.com/products/258/guides)
![Lithium Ion Polymer Battery 3.7v 1200mAh with JST 2-PH connector](https://cdn-shop.adafruit.com/640x480/258-02.jpg)

# Temperature and Humidity Sensing in Home Assistant with CircuitPython

## Sensor Setup

## Wiring
- **ESP32-S2 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **ESP32-S2 GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **ESP32-S2 SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **ESP32-S2 SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![temperature___humidity_SHTC3_Sensor_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/099/035/medium640/temperature___humidity_SHTC3_Sensor_bb.jpg?1611864735)

## CircuitPython Installation

You will need to have CircuitPython installed and running. If you haven't set up CircuitPython on a board with an ESP32-S2 processor, the process is a little bit different than other boards.

The first step involves installing the Bootloader. We recommend starting with the [Install UF2 Bootloader](https://learn.adafruit.com/adafruit-metro-esp32-s2/install-uf2-bootloader) page of the ESP32-S2 Metro guide. After you have the bootloader installed, the other step is [installing CircuitPython](https://learn.adafruit.com/adafruit-metro-esp32-s2/circuitpython) itself.&nbsp;

## Library Installation

To use the internet-connectivity built into your ESP32-S2 with CircuitPython, you must first install a number of libraries.

### Adafruit CircuitPython Library Bundle

Download the Adafruit CircuitPython Bundle. You can find the latest release here:

[Download latest CircuitPython Library Bundle](https://circuitpython.org/libraries)
Download the&nbsp; **adafruit-circuitpython-bundle-version-mpy-\*.zip** &nbsp;bundle zip file, and unzip a folder of the same name. Inside you'll find a&nbsp; **lib** &nbsp;folder. The entire collection of libraries is too large to fit on the&nbsp; **CIRCUITPY&nbsp;** drive. Instead, add each library as you need it, this will reduce the space usage but you'll need to put in a little more effort.

Warning: 

At a minimum we recommend the following libraries, in fact we more than recommend. They're basically required. So grab them and install them into&nbsp; **CIRCUITPY/lib** &nbsp;now!

- **adafruit\_minimqtt** - MQTT library required for communicating with the MQTT Server
- **adafruit\_shtc3.py** - Temperature/Humidity Sensor library

![](https://cdn-learn.adafruit.com/assets/assets/000/099/203/medium800/temperature___humidity_Libraries.png?1612369591)

# Temperature and Humidity Sensing in Home Assistant with CircuitPython

## CircuitPython Internet Test

One of the great things about most Espressif microcontrollers are their built-in WiFi capabilities. This page covers the basics of getting connected using CircuitPython.

The first thing you need to do is update your **code.py** to the following (it will error until WiFi details are added). Click the **Download Project Bundle** button to download the necessary libraries and the&nbsp; **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire**  **lib**  **folder** and the **code.py** file to your **CIRCUITPY** drive.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ESP32_S2_WiFi_Tests/CPy_Native_WiFi_Test/code.py

Your **CIRCUITPY** drive should resemble the following.

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/ESP32_S2_WiFi_Tests_CPy_Native_WiFi_Test.png )

To get connected, the next thing you need to do is update the **settings.toml** file.

## The settings.toml File

We expect people to share tons of projects as they build CircuitPython WiFi widgets. What we want to avoid is people accidentally sharing their passwords or secret tokens and API keys. So, we designed all our examples to use a **settings.toml** file, that is on your&nbsp; **CIRCUITPY** &nbsp;drive, to hold secret/private/custom data. That way you can share your main project without worrying about accidentally sharing private stuff.

If you have a fresh install of CircuitPython on your board, the initial **settings.toml** file on your **CIRCUITPY** drive is empty.

To get started, you can update the **settings.toml** on your **CIRCUITPY** drive to contain the following code.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ESP32_S2_WiFi_Tests/CPy_Native_WiFi_Test/settings.toml

This file should contain a series of Python variables, each assigned to a string. Each variable should describe what it represents (say&nbsp;`wifi_ssid`), followed by an **=&nbsp;** (equals sign), followed by the data in the form of a Python string (such as `"my-wifi-password"` including the quote marks).

**At a minimum you'll need to add/update your WiFi SSID and WiFi password, so do that now!**

As you make projects you may need more tokens and keys, just add them one line at a time. See for example other tokens such as one for accessing GitHub or the Hackaday API. Other non-secret data like your timezone can also go here.

For the correct time zone string, look at&nbsp;[http://worldtimeapi.org/timezones](http://worldtimeapi.org/timezones)&nbsp;and remember that if your city is not listed, look for a city in the same time zone, for example Boston, New York, Philadelphia, Washington DC, and Miami are all on the same time as New York.

Of course, don't share your **settings.toml** - keep that out of GitHub, Discord or other project-sharing sites.

Warning: 

If you connect to the serial console, you should see something like the following:

![](https://cdn-learn.adafruit.com/assets/assets/000/097/014/medium800/adafruit_products_1__screen__Users_brentrubell__screen_.png?1605218222)

In order, the example code...

Checks the ESP32's MAC address.

```python
print(f"My MAC address: {[hex(i) for i in wifi.radio.mac_address]}")
```

Performs a scan of all access points and prints out the access point's name (SSID), signal strength (RSSI), and channel.

```python
print("Available WiFi networks:")
for network in wifi.radio.start_scanning_networks():
    print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
                                             network.rssi, network.channel))
wifi.radio.stop_scanning_networks()
```

Connects to the access point you defined in the **settings.toml** file, and prints out its local IP address.

```python
print(f"Connecting to {os.getenv('WIFI_SSID')}")
wifi.radio.connect(os.getenv("WIFI_SSID"), os.getenv("WIFI_PASSWORD"))
print(f"Connected to {os.getenv('WIFI_SSID')}")
print(f"My IP address: {wifi.radio.ipv4_address}")
```

Attempts to ping a Google DNS server to test connectivity. If a ping fails, it returns `None`. Initial pings can sometimes fail for various reasons. So, if the initial ping is successful (`is not None`), it will print the echo speed in ms. If the initial ping fails, it will try one more time to ping, and then print the returned value. If the second ping fails, it will result in `"Ping google.com: None ms"` being printed to the serial console. Failure to ping does not always indicate a lack of connectivity, so the code will continue to run.

```python
ping_ip = ipaddress.IPv4Address("8.8.8.8")
ping = wifi.radio.ping(ip=ping_ip) * 1000
if ping is not None:
    print(f"Ping google.com: {ping} ms")
else:
    ping = wifi.radio.ping(ip=ping_ip)
    print(f"Ping google.com: {ping} ms")
```

The code creates a socketpool using the wifi radio's available sockets. This is performed so we don't need to re-use sockets. Then, it initializes a a new instance of the [requests](http://docs.python-requests.org/en/master/) interface - which makes getting data from the internet _really really easy._

```python
pool = socketpool.SocketPool(wifi.radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
```

To read in plain-text from a web URL, call `requests.get` - you may pass in either a http, or a http **s** url for SSL connectivity.&nbsp;

```python
print(f"Fetching text from {TEXT_URL}")
response = requests.get(TEXT_URL)
print("-" * 40)
print(response.text)
print("-" * 40)
```

Requests can also display a JSON-formatted response from a web URL using a call to `requests.get`.&nbsp;

```python
print(f"Fetching json from {JSON_QUOTES_URL}")
response = requests.get(JSON_QUOTES_URL)
print("-" * 40)
print(response.json())
print("-" * 40)
```

Finally, you can fetch and parse a JSON URL using `requests.get`. This code snippet obtains the `stargazers_count` field from a call to the GitHub API.

```python
print(f"Fetching and parsing json from {JSON_STARS_URL}")
response = requests.get(JSON_STARS_URL)
print("-" * 40)
print(f"CircuitPython GitHub Stars: {response.json()['stargazers_count']}")
print("-" * 40)
```

OK you now have your ESP32 board set up with a proper **settings.toml** file and can connect over the Internet. If not, check that your **settings.toml** file has the right SSID and password and retrace your steps until you get the Internet connectivity working!

## IPv6 Networking

Starting in CircuitPython 9.2, IPv6 networking is available on most Espressif wifi boards. Socket-using libraries like **adafruit\_requests** and **adafruit\_ntp** will need to be updated to use the new APIs and for now can only connect to services on IPv4.

### IPv6 connectivity & privacy

IPv6 addresses are divided into many special kinds, and many of those kinds (like those starting with&nbsp; **FC** , **FD** , **FE** ) are private or local; Addresses starting with other prefixes like&nbsp; **2002:** and **2001:** are globally routable. In 2024, far from all ISPs and home networks support IPv6 internet connectivity. For more info consult resources like [Wikipedia](https://en.wikipedia.org/wiki/IPv6_address#Local_addresses). If you're interested in global IPv6 connectivity you can use services like [Hurricane Electric](https://www.he.net/) to create an "IPv6 tunnel" (free as of 2024, but requires expertise and a compatible router or host computer to set up)

It's also important to be aware that, as currently implemented by Espressif, there are privacy concerns especially when these devices operate on the global IPv6 network: The device's unique identifier (its EUI-64 or MAC address) is used by default as part of its IPv6 address. This means that the device identity can be tracked across multiple networks by any service it connects to.

### Enable IPv6 networking

Due to the privacy consideration, IPv6 networking is not automatically enabled. Instead, it must be explicitly enabled by a call to `start_dhcp_client` with the `ipv6=True` argument specified:

```python
wifi.start_dhcp_client(ipv6=True)
```

### Check IP addresses

The read-only&nbsp;`addresses` property of the `wifi.radio` object holds all addresses, including IPv4 and IPv6 addresses:

```python
&gt;&gt;&gt; wifi.radio.addresses
('FE80::7EDF:A1FF:FE00:518C', 'FD5F:3F5C:FE50:0:7EDF:A1FF:FE00:518C', '10.0.3.96')
```

The `wifi.radio.dns` servers can be IPv4 or IPv6:

```python
&gt;&gt;&gt; wifi.radio.dns
('FD5F:3F5C:FE50::1',)
&gt;&gt;&gt; wifi.radio.dns = ("1.1.1.1",)
&gt;&gt;&gt; wifi.radio.dns
('1.1.1.1',)
```

### Ping v6 networks

`wifi.radio.ping` accepts v6 addresses and names:

```python
&gt;&gt;&gt; wifi.radio.ping("google.com")
0.043
&gt;&gt;&gt; wifi.radio.ping("ipv6.google.com")
0.048
```

### Create & use IPv6 sockets

Use the address family `socket.AF_INET6`. After the socket is created, use methods like `connect`, `send`, `recfrom_into`, etc just like for IPv4 sockets. This code snippet shows communicating with a private-network NTP server; this IPv6 address will not work on your network:

```python
&gt;&gt;&gt; ntp_addr = ("fd5f:3f5c:fe50::20e", 123)
&gt;&gt;&gt; PACKET_SIZE = 48
&gt;&gt;&gt; 
&gt;&gt;&gt; buf = bytearray(PACKET_SIZE)
&gt;&gt;&gt; with socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) as s:
...     s.settimeout(1)
...     buf[0] = 0b0010_0011
...     s.sendto(buf, ntp_addr)
...     print(s.recvfrom_into(buf))
...     print(buf)
... 
48
(48, ('fd5f:3f5c:fe50::20e', 123))
bytearray(b'$\x01\x03\xeb\x00\x00\x00\x00\x00\x00\x00GGPS\x00\xeaA0h\x07s;\xc0\x00\x00\x00\x00\x00\x00\x00\x00\xeaA0n\xeb4\x82-\xeaA0n\xebAU\xb1')
```

# Temperature and Humidity Sensing in Home Assistant with CircuitPython

## Code the Sensor

Now let's go over the code that runs on the sensor. The code checks the temperature and humidity, formats it, then publishes directly to the MQTT server.

## MQTT Secrets Settings

Since the code publishes directly to the MQTT server, there are a few more secret settings that the code expects to find. If your MQTT server has no username and password, you can change the value to `None`, however in general, the Home Assistant MQTT broker is setup to be password protected by default.

```python
MQTT_BROKER = "192.168.1.1"
MQTT_PORT = 1883
MQTT_USERNAME = "myusername"
MQTT_PASSWORD = "mypassword"
```

## Full Code Listing
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Home_Assistant_Sensor/code.py

## How the Code Works

First we start with our imports. Many of the imports are ESP32-S2 specific because of the built Wi-Fi functionality, but this list also includes `json`, `adafruit_minimqtt`, and `adafruit_shtc3`, which we'll go over later.

```python
import os
import time
import ssl
import json
import alarm
import board
import socketpool
import wifi
import adafruit_minimqtt.adafruit_minimqtt as MQTT
import adafruit_shtc3
```

In the next section, there are a few settings that you can adjust.

First, the `PUBLISH_DELAY` setting is the amount of time in seconds to wait before updating the temperature and humidity.

The `MQTT_TOPIC` is the topic that is published on the MQTT server. To read more about MQTT Topics, you can check out [the MQTT Topics section of our All the Internet of Things Protocols](https://learn.adafruit.com/alltheiot-protocols/mqtt-topics) guide.

The `USE_DEEP_SLEEP` setting defines how we want to wait until we publish. If the setting is `True`, it uses Deep Sleep to stop execution, put the board into a low power mode, and then restart the script after a certain amount of time, so it will need a little additional time to reconnect to WiFi. If the setting is `False`, it will just wait the amount of time in `PUBLISH_DELAY` and the publish again. You can read more about the Deep Sleep feature in our [Deep Sleep with CircuitPython](https://learn.adafruit.com/deep-sleep-with-circuitpython) guide.

If you plan to modify the code to respond to MQTT requests, you will want to have `USE_DEEP_SLEEP` set to false. However, setting up an MQTT subscription will not be covered in this guide because Home Assistant won't be polling for the Temperature/Humidity sensor.

```python
PUBLISH_DELAY = 60
MQTT_TOPIC = "state/temp-sensor"
USE_DEEP_SLEEP = True
```

The next line, we initialize to the sensor by passing in the I2C bus.&nbsp;

```python
# Connect to the Sensor
sht = adafruit_shtc3.SHTC3(board.I2C())
```

Now that the code has secrets, it uses that to connect to the WiFi access point and create a socket pool. Sockets are how CircuitPython establishes communication over the internet.

```python
wifi.radio.connect(secrets["ssid"], secrets["password"])
print("Connected to %s!" % secrets["ssid"])

# Create a socket pool
pool = socketpool.SocketPool(wifi.radio)
```

The MQTT library is initialized next using the settings in the secrets file and the socket pool. Once it is initialized, the code attempts to connect to the MQTT server.

```python
# Set up a MiniMQTT Client
mqtt_client = MQTT.MQTT(
    broker=os.getenv("MQTT_BROKER"),
    port=os.getenv("MQTT_PORT"),
    username=os.getenv("MQTT_USERNAME"),
    password=os.getenv("MQTT_PASSWORD"),
    socket_pool=pool,
    ssl_context=ssl.create_default_context(),
)

print("Attempting to connect to %s" % mqtt_client.broker)
mqtt_client.connect()
```

Now we get to the main loop. The loop will really only come into play if `USE_DEEP_SLEEP` is **False** which we'll explain in the next section.

First we grab our temperature and humidity from the sensor. Then we create a dict that will hold the structure for our JSON output. We are adding a temperature and humidity settings to the dict. Finally we use the `json.dumps()` function to convert the dict structure to a JSON string.

```python
temperature, relative_humidity = sht.measurements

output = {
    "temperature": temperature,
    "humidity": relative_humidity,
}

print("Publishing to %s" % MQTT_TOPIC)
mqtt_client.publish(MQTT_TOPIC, json.dumps(output))
```

This last section is all about waiting until it is time to publish the temperature and humidity again.

If `USE_DEEP_SLEEP` is `True`, then we create an alarm to tell the program to stop running and restart from the beginning after a certain amount of time.

Otherwise, we'll make use of the loop. The `last_update` is set to `time.monotonic()`, which is a running counter that keeps the relative time and is useful for measuring elapsed time. Then a simple `while` loop is used to wait until it is time to publish again. Inside this loop, the `mqtt_client.loop()` function is called which is useful if you plan on having the code respond to a subscription.

```python
if USE_DEEP_SLEEP:
    mqtt_client.disconnect()
    pause = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + PUBLISH_DELAY)
    alarm.exit_and_deep_sleep_until_alarms(pause)
else:
    last_update = time.monotonic()
    while time.monotonic() &lt; last_update + PUBLISH_DELAY:
        mqtt_client.loop()
```

## Debugging the Sensor

If you would like to monitor what the sensor is doing, you can look at our guide on [Connecting to the Serial Console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) with CircuitPython. Once you are connected, it can help with any troubleshooting.

## Using Other Sensors
If you would like to use other [Temperature and Humidity sensors](https://www.adafruit.com/?q=Temperature+Humidity), then you can modify the code to do so. You'll need to change the import line to your sensor and a simple test example is usually included with each library for the sensor that allows you to get the values that you need.

Once you have the values, you can just plug them into the dict and the rest should just work.

# Temperature and Humidity Sensing in Home Assistant with CircuitPython

## Home Assistant Configuration

This guide assumes you already have a working and running Home Assistant server. If you don't, be sure to visit our [Set up Home Assistant with a Raspberry Pi](https://learn.adafruit.com/set-up-home-assistant-with-a-raspberry-pi) guide first.

Start out by logging in and opening up your Home Assistant dashboard and checking that the File editor is installed.&nbsp;

As part of the setup, you should have an add-on either called **configurator** or **File editor** with a wrench icon next to it. Go ahead and select it.

![temperature___humidity_File_editor.png](https://cdn-learn.adafruit.com/assets/assets/000/099/122/medium640/temperature___humidity_File_editor.png?1611960615)

If you don't see it, it may not be installed. You can find it under **Settings**  **→ Add-ons**  **→**  **Add-on Store**  **→**  **File editor** &nbsp;and go through the installation procedure.

![temperature___humidity_Add_On_Store.png](https://cdn-learn.adafruit.com/assets/assets/000/099/123/medium640/temperature___humidity_Add_On_Store.png?1611960560)

If you already have it, but it's just not showing up, be sure it is started and the option to show in the sidebar is selected.

![temperature___humidity_File_Editor_Addon.png](https://cdn-learn.adafruit.com/assets/assets/000/099/124/medium640/temperature___humidity_File_Editor_Addon.png?1611960653)

Click on the Folder Icon at the top and select **configuration.yaml** , then click on an area to the right of the file list to close it.

![temperature___humidity_FE_Open.png](https://cdn-learn.adafruit.com/assets/assets/000/099/125/medium640/temperature___humidity_FE_Open.png?1611960899)

![temperature___humidity_FE_Config.png](https://cdn-learn.adafruit.com/assets/assets/000/099/126/medium640/temperature___humidity_FE_Config.png?1611960916)

Add the following code to the bottom of the configuration file. Make sure the `state_topic` values match the value you used in the sensor code.

```auto
mqtt:
  sensor:
    - name: "Temperature"
      state_topic: "state/temp-sensor"
      unit_of_measurement: '°C'
      value_template: "{{ value_json.temperature }}"
    - name: "Humidity"
      state_topic: "state/temp-sensor"
      unit_of_measurement: '%'
      value_template: "{{ value_json.humidity }}"
```

Click the save button at the top.

![temperature___humidity_FE_Save.png](https://cdn-learn.adafruit.com/assets/assets/000/099/128/medium640/temperature___humidity_FE_Save.png?1611961553)

From the&nbsp; **Developer Tools** &nbsp;menu,&nbsp;you can check that the configuration is valid and click on&nbsp; **Restart** &nbsp;to load the configuration changes you made. You can just click&nbsp; **Quick reload** &nbsp;to reload any changes you made.

![temperature___humidity_Check_Configuration.png](https://cdn-learn.adafruit.com/assets/assets/000/124/194/medium640/temperature___humidity_Check_Configuration.png?1693598348)

![temperature___humidity_Quick_Reload.png](https://cdn-learn.adafruit.com/assets/assets/000/124/195/medium640/temperature___humidity_Quick_Reload.png?1693598364)

## Testing the Sensor
Click Overview at the top of the sidebar and you should see some icons at the top. Within those icons, there should be a temperature and humidity icon.

![temperature___humidity_Overview_Icons.png](https://cdn-learn.adafruit.com/assets/assets/000/099/131/medium640/temperature___humidity_Overview_Icons.png?1611963183)

If you click on one of the icons, you can see a graph of how the value has changed over time. It will also show you how long it has been since the last update.

![temperature___humidity_Temp_Graph.png](https://cdn-learn.adafruit.com/assets/assets/000/099/132/medium640/temperature___humidity_Temp_Graph.png?1611963199)

## Troubleshooting

If you see the icons, but there is no data, it is easiest to start by checking the MQTT messages. We have a guide on how to use [Desktop MQTT Client for Adafruit.io](https://learn.adafruit.com/desktop-mqtt-client-for-adafruit-io), which can be used for the Home Assistant MQTT server as well.

Go ahead and configure a username and password to match your MQTT server and connect. Under **subscribe** , you can subscribe to the `#` topic to get all messages.

If you are seeing messages from the sensor, you may want to double check your Home Assistant configuration.

If you don't see any messages, you will want to follow the debugging section on the **Code the Sensor** page.

## Going Further

You can easily modify the scripts to show additional information such as the battery level of the sensor or even change it to use other sensors. You can also hook up additional sensor and display that information as well.


## Featured Products

### Adafruit Metro ESP32-S2

[Adafruit Metro ESP32-S2](https://www.adafruit.com/product/4775)
What's Metro shaped and has an ESP32-S2 WiFi module? What has a STEMMA QT connector for I2C devices, and a Lipoly charger circuit? What has your favorite Espressif WiFi microcontroller and lots of memory for your next IoT project?

That's right - its the new Adafruit Metro...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4775)
[Related Guides to the Product](https://learn.adafruit.com/products/4775/guides)
### Adafruit Sensirion SHTC3 Temperature & Humidity Sensor

[Adafruit Sensirion SHTC3 Temperature & Humidity Sensor](https://www.adafruit.com/product/4636)
Sensirion Temperature/Humidity sensors are some of the finest & highest-accuracy devices you can get. And&nbsp;finally, we have some that have a true I2C interface for easy reading. The&nbsp; **SHTC3** &nbsp;sensor has an excellent ±2% relative humidity and ±0.2...

In Stock
[Buy Now](https://www.adafruit.com/product/4636)
[Related Guides to the Product](https://learn.adafruit.com/products/4636/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)
### Lithium Ion Polymer Battery - 3.7v 1200mAh

[Lithium Ion Polymer Battery - 3.7v 1200mAh](https://www.adafruit.com/product/258)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 1200mAh for a total of about 4.5 Wh. If you need a larger battery, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/258)
[Related Guides to the Product](https://learn.adafruit.com/products/258/guides)

## Related Guides

- [Adafruit Sensirion SHTC3 - Temperature & Humidity Sensor Breakout](https://learn.adafruit.com/adafruit-sensirion-shtc3-temperature-humidity-sensor.md)
- [Adafruit Metro ESP32-S2](https://learn.adafruit.com/adafruit-metro-esp32-s2.md)
- [No-Code WipperSnapper Summoning Horn](https://learn.adafruit.com/adafruit-io-wippersnapper-summoning-horn.md)
- [Animating Animatronics](https://learn.adafruit.com/animating-animatronics.md)
- [Networking in CircuitPython](https://learn.adafruit.com/networking-in-circuitpython.md)
- [CAN Bus with CircuitPython: Using the canio module](https://learn.adafruit.com/using-canio-circuitpython.md)
- [MP3 Playback with CircuitPython](https://learn.adafruit.com/mp3-playback-with-circuitpython.md)
- [Plotting Offline Data - JSONL to CSV files, filters and graphs](https://learn.adafruit.com/plotting-offline-data-jsonl-to-csv-files-filters-and-graphs.md)
- [WiFi-Controlled NeoPixel Matrix LED Sign](https://learn.adafruit.com/iot-led-sign.md)
- [CircuitPython BLE Morse Code Chat](https://learn.adafruit.com/circuitpython-ble-wireless-morse-code-chat.md)
- [Kitty's Flowers - Bluetooth Wearable Brooches - Art by Physicist](https://learn.adafruit.com/flowers-bluetooth-wearable-brooches-art-by-physicist.md)
- [Soundboard Speaker for Bikes & Scooters](https://learn.adafruit.com/soundboard-speaker-for-bikes-scooters.md)
- [IoT Temperature Logger with Analog Devices ADT7410, Raspberry Pi, and Adafruit IO](https://learn.adafruit.com/iot-temperature-logger-with-python-and-adafruit-io.md)
- [CircuitPython Connected Weather Cloud Lamp](https://learn.adafruit.com/circuitpython-connected-weather-cloud.md)
- [CircuitPython LED Animations](https://learn.adafruit.com/circuitpython-led-animations.md)
