Free tools Windows power users keep installed
One-click scans. No signup required.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
A Raspberry Pi 5 usually hosts Home Assistant; it does not automatically become the sensor. Choose the method that matches your data source: a template sensor for values already in Home Assistant, REST for an HTTP endpoint, MQTT for pushed messages, and ESPHome or another networked device for most physical GPIO, I²C or SPI sensors.
What “custom sensor” means
Home Assistant has no single feature called a custom sensor. The term can mean a YAML-defined entity, a calculation from existing entities, an API value, an MQTT message, a script result, a custom integration, or hardware connected to a computer.
Before writing YAML, identify the source, data type, update frequency, offline behavior and whether the value needs long-term statistics. That decision determines the correct integration.
What you need for a Raspberry Pi 5 installation
- Raspberry Pi 5 (Home Assistant lists 2 GB as its minimum memory requirement).
- A suitable USB-C power supply. Raspberry Pi recommends a high-quality 5 V/5 A supply; ordinary phone chargers and computer USB ports may be inadequate.
- A microSD card of at least 32 GB, ideally A2-rated.
- An SD-card reader and Ethernet for the initial setup.
- Your API, script, MQTT publisher or sensor hardware.
- Active cooling for best sustained performance. The Pi 5 has a 40-pin header, USB, Wi-Fi, Bluetooth and Gigabit Ethernet, but those interfaces do not automatically expose every attached sensor to Home Assistant.
Home Assistant does not require a 16 GB Pi for ordinary custom sensors. More memory is useful for cameras, voice processing, many add-ons, large databases or other services. NVMe storage can suit heavier workloads, but requires an M.2 adapter or HAT and is not mandatory for a small sensor installation. See the Raspberry Pi 5 specifications.
#1 Best Overall
Install Home Assistant OS
- Install Raspberry Pi Imager on another computer.
- Insert the microSD card and open Raspberry Pi Imager.
- Choose OS, then Other specific-purpose OS → Home automation → Home Assistant.
- Select the current Home Assistant OS image for Raspberry Pi 5. The installation page displayed the 64-bit 18.2 image on August 18, 2026; select the current image rather than treating that version as permanent.
- Select the microSD card and write the image. Writing erases the card.
- Insert the card into the Pi, connect Ethernet and attach the appropriate power supply.
- After startup, open http://homeassistant.local:8123. If hostname discovery fails, use
http://PI_IP_ADDRESS:8123.
A Pi 4 or Pi 5 normally shows onboarding within about a minute. If it is still unavailable after five minutes, reflash the card and, if needed, inspect the console using an HDMI-connected display. Follow the official Raspberry Pi installation guide.
Choose the right sensor method
| Data source | Best method | Why |
|---|---|---|
| Existing Home Assistant entities | Template sensor | Calculates, converts or combines values already available. |
| HTTP or JSON endpoint | REST sensor | Home Assistant polls a web or local API. |
| Device or script publishes messages | MQTT sensor | Pushes readings and supports distributed devices and availability topics. |
| Local executable | Command-line sensor | Reads predictable output, when the command is available in the Home Assistant environment. |
| GPIO, I²C, SPI, USB or serial hardware | Usually ESPHome, MQTT or a supported integration | Separates hardware drivers and electrical concerns from the Home Assistant host. |
Method 1: Create a template sensor
Use a template when the raw values already exist as Home Assistant entities. State-based templates update when referenced entities change; trigger-based templates are preferable when updates should happen on a schedule, webhook or another explicit trigger. Test expressions in Developer Tools → Template.
template:
- sensor:
- name: "Average Indoor Temperature"
unique_id: average_indoor_temperature
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
state: >
{% set bedroom = states('sensor.bedroom_temperature') | float(0) %}
{% set kitchen = states('sensor.kitchen_temperature') | float(0) %}
{{ ((bedroom + kitchen) / 2) | round(1) }}
states() safely reads an entity state and float(0) supplies a fallback. A zero fallback can conceal an outage, so safety-critical automations should instead preserve an unavailable state when the source is missing. Keep the unit consistent and set device_class, state_class, precision and a unique_id that will remain stable.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Templates are suited to averages, differences, totals, unit conversions, thresholds and combining several entities. They are not a replacement for the integration that obtains a physical reading.
Rank #2
Method 2: Import an HTTP value with REST
Use a REST sensor when a local service or web API returns JSON or plain text. For example, an endpoint might return:
{"temperature":21.902,"humidity":44.1}
sensor:
- platform: rest
name: "Custom API Temperature"
unique_id: custom_api_temperature
resource: "http://192.168.1.50/api/status"
method: GET
scan_interval: 30
timeout: 10
value_template: "{{ value_json.temperature | float }}"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
Home Assistant documents a 30-second default polling interval and 10-second default timeout; these are defaults, not requirements. Increase the interval when an API is rate-limited or a device is slow. Use value_json for parsed JSON and value for plain text:
value_template: "{{ value | float(0) }}"
REST sensors also support request headers, query parameters, payloads, authentication, availability, SSL verification and resource_template. Prefer HTTPS, keep certificate verification enabled, and do not expose passwords or tokens in screenshots or public YAML. The RESTful sensor documentation lists the available options.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Method 3: Create an MQTT sensor
MQTT is useful when a device or script publishes readings, especially for distributed or battery-powered nodes. Home Assistant needs an MQTT 5-capable broker. On Home Assistant OS, the official Mosquitto broker app is the easiest recommended setup path.
For a retained JSON message on home/custom_sensor:
{"temperature":23.2,"humidity":43.7}
mqtt:
sensor:
- name: "Custom MQTT Temperature"
unique_id: custom_mqtt_temperature
state_topic: "home/custom_sensor"
value_template: "{{ value_json.temperature | float }}"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
availability_topic: "home/custom_sensor/status"
payload_available: "online"
payload_not_available: "offline"
If the publisher sends only a number, use {{ value | float }} instead. A retained message gives Home Assistant the last value immediately after reconnecting; without retention, the entity may have no state until the next publication. The availability topic explicitly represents online and offline status.
After configuring the broker and sensor, test publication from a machine with Mosquitto clients:
mosquitto_pub
-h HOME_ASSISTANT_IP
-t home/custom_sensor
-m '{"temperature":23.2,"humidity":43.7}'
You can also publish and listen through the MQTT integration’s frontend tools. See the MQTT integration guide and MQTT sensor documentation.
Recommended Free Tools
Command-line sensors and physical hardware
Command-line output
A command-line sensor can read one predictable value from a local executable. On Home Assistant OS, do not assume host-level Linux access or that a Raspberry Pi OS package, shell command or Python library is installed. An add-on, ESPHome device, MQTT publisher or supported integration is often more dependable. Ensure commands terminate, update at a sensible interval and never contain credentials directly in YAML.
Rank #4
GPIO, I²C, SPI, USB and serial devices
Direct wiring is an advanced project. Pi GPIO uses 3.3 V logic; incompatible voltage can damage hardware. Drivers, pull-up resistors, bus addresses, permissions, timing and software libraries can all be required. A Python script that works on Raspberry Pi OS may not work unchanged inside appliance-style Home Assistant OS.
For a maintainable design, put the sensor on an ESP32 or ESP8266 running ESPHome, or use a separate Linux host, MQTT node, supported USB/serial integration, Zigbee, Z-Wave, Bluetooth or Matter device. The Pi 5’s header makes experimentation possible, but it does not promise arbitrary GPIO entities.
Validate the entity and add it to a dashboard
- Save the YAML and run Home Assistant’s configuration check.
- Correct indentation, duplicate IDs and template errors before restarting when required.
- Open Settings → Devices & services and search the entity registry for the sensor name or entity ID.
- Open the entity’s details and confirm its state, unit, device class, state class and availability.
- Edit a dashboard, add an entity, tile or gauge card, select the sensor, and set display precision where appropriate.
- Open History and Statistics to verify that numeric values and consistent units are being recorded.
Fix common failures
The entity is unknown or unavailable
- Check the entity ID, URL, topic and JSON field character-for-character.
- Confirm the source exists and the REST endpoint is reachable from the Home Assistant host.
- Check broker connection, credentials and availability-topic payloads.
- Verify that an MQTT message is retained if an immediate startup state is required.
- Handle empty payloads and missing fields. For example:
{{ value_json.temperature | default(0) | float }}.
Defaults such as zero prevent template errors but can hide an outage. For safety-related automations, an explicit unavailable state is usually safer than silently reporting 0.
The value or metadata is wrong
Ensure a numeric sensor emits numbers consistently, not a mixture of numbers and strings such as offline. Keep one unit, select the appropriate device class and state class, and set suitable precision. Incorrect metadata can produce misleading icons, displays and long-term statistics.
Best Value
- SMART HOME LEARNING KIT--This kit combines the most common electronic components of smart home projects,developed specially for those beginners who are interested in Arduino and raspberry pi DIY.
- THE PROFESSIONAL SMART HOME KIT--This has 16 sensors modules and delicately selected sensors to detect temperature, humidity, sound, light, infrared, motion, flame,vibration,digital touch, air pressure and many other commonly-used sensors modules.
- THE MOST COMPLETE SMART HOME KIT--This universal kit are compatible for Arduino UNO R3 / Mega2560 / Mega328 /Nano / Raspberry Pi, it could DIY 16 projects according to your need.
- HIGH QUALITY GUARANTEE--We eliminate many old-fashioned sensors which have low reliability and duplicate function as other sensor in the kit, the kookye modules sensor kits are choosed carefully for our user.
- DETAILED TUTORIAL ON OUR WEBSITE--Our website provide step-by-step instruction, detailed circuit connection graph/video, verified sample code and library package which can save lot of user's research time and speed up the learning progress.
YAML changes do not appear
Save the file, run the configuration check, fix errors, restart when the integration requires it, then inspect Settings → Devices & services and logs. MQTT configuration changes require a restart according to its documentation. A duplicate name or ID may also cause Home Assistant to create or retain a differently named entity.
REST requests time out or are rate-limited
- Increase
scan_intervaland set a realistictimeout. - Use a local data source or proxy where possible.
- Poll one endpoint and derive multiple values when practical.
- Check DNS, firewall rules, authentication and HTTPS certificates.
The Pi reboots or runs hot
Check the USB-C supply, active cooling, microSD quality, database write load, add-ons, custom integrations and scripts. Raspberry Pi recommends a high-quality 5 V/5 A supply and says active cooling gives the best performance. A failing add-on, malformed MQTT traffic or an unbounded command can also destabilize the system.
Which setup should you choose?
| Need | Recommended architecture | Main trade-off |
|---|---|---|
| Combine existing HA readings | Template sensor | Cannot obtain data that is not already in Home Assistant. |
| Read a web API | REST sensor | Polling adds traffic and can encounter timeouts or rate limits. |
| Receive pushed readings | MQTT sensor | Requires a broker and topic design. |
| Attach new physical sensors | ESPHome or another networked node | Adds a separate device, but isolates drivers and wiring from the HA host. |
| Simple appliance with no DIY build | Home Assistant Green | Less hardware flexibility than a Pi 5; see Home Assistant Green. |
For most projects, run Home Assistant OS on the Pi 5, use ESPHome for new physical sensors, MQTT for distributed or script-generated data, REST for APIs, and templates for derived values. Choose storage and RAM for the whole workload rather than for the phrase “custom sensor” alone.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

