Running Home Assistant on a Raspberry Pi 4 keeps your home-automation data on your own network. No subscription, no vendor cloud dependency, no data leaving the building. This walkthrough covers the hardware shopping list, the image-flashing steps, wired and wireless network configuration, and adding the first physical device — a Shelly 1 relay available in Romanian electronics retailers.

Hardware required

For a stable Home Assistant installation, the minimum viable hardware is a Raspberry Pi 4 with 2 GB RAM, though the 4 GB model is worth the extra cost if you plan to run more than a dozen integrations simultaneously. A 32 GB A2-class microSD card is faster than the commonly bundled A1 cards because of its higher random-write IOPS, which matter for the SQLite database that stores sensor history.

  • Raspberry Pi 4 Model B (2 GB or 4 GB) — available at Robofun, price at time of writing: 220–260 RON
  • Samsung Pro Endurance 32 GB microSD (or equivalent A2 card) — about 65 RON at emag.ro
  • Official Raspberry Pi 15 W USB-C power supply — 55 RON at Robofun; avoid generic chargers that drop voltage under load
  • A short Ethernet cable if you prefer wired networking over Wi-Fi during the initial setup
  • Shelly 1 relay module — about 75 RON at Altex or Dedeman, or directly from the Shelly webshop

Flashing Home Assistant OS

Download the Raspberry Pi Imager from the Home Assistant documentation page and install it on your computer. Open the imager, select Choose OS → Other specific-purpose OS → Home Assistants and home automation → Home Assistant, then select your microSD as the target and write the image.

Flashing takes two to four minutes on a USB 3 card reader. Do not eject the card until the verification step completes — an incomplete write is the most common cause of a Pi that refuses to boot.

First boot and onboarding

Insert the microSD, connect the Pi to your router via Ethernet and apply power. Home Assistant OS takes three to five minutes to expand the filesystem and download the latest stable release on the first boot. The web interface becomes available at http://homeassistant.local:8123 on networks that support mDNS. If mDNS does not resolve, check your router's DHCP lease table for the IP address assigned to the Pi.

The onboarding wizard asks for a username, password and home location. Set the location accurately — it is used for sunrise/sunset automations. Skip all optional integrations for now; they can be added through Settings → Integrations later.

Configuring static IP and Wi-Fi (optional)

A static IP prevents the hub's address from changing after a router restart. In Home Assistant OS, go to Settings → System → Network and assign a static IPv4 address in your router's range but outside the DHCP pool — for example, 192.168.1.200 if your router uses 192.168.1.1–192.168.1.150 for DHCP.

Wi-Fi configuration is available in the same network panel. Enter the SSID and passphrase; the change takes effect immediately. Avoid 5 GHz-only networks if the Shelly 1 relay you plan to add only supports 2.4 GHz — Home Assistant and the Shelly need to share the same network segment for local-only control.

Adding the Shelly 1 relay

The Shelly 1 is a compact Wi-Fi relay that fits inside a standard electrical box behind a light switch. It replaces the existing switch wiring and bridges the L-out terminal through the relay coil. In Romania, the Shelly 1 uses the standard European wiring colour code: brown (L), blue (N), yellow-green (PE). Always disconnect the mains circuit breaker before opening the switch box.

After wiring and restoring power, the Shelly 1 broadcasts its own Wi-Fi access point (shellyXX-XXXXXX). Connect to it from a laptop or phone and open 192.168.33.1 in a browser. Under Internet & Security → Wi-Fi Mode (Client), enter your home network credentials and save. The device reboots and joins your LAN.

Back in Home Assistant, go to Settings → Integrations → Add Integration and search for Shelly. Home Assistant usually auto-discovers the device and presents it for confirmation. After adding it, the relay appears as a switch entity named something like switch.shelly1_XXXXXX. Rename it in the entity settings to something descriptive, such as switch.hallway_light.

A basic automation — turn off the light at midnight

Go to Settings → Automations & Scenes → Create Automation and use the visual editor:

  • Trigger: Time → 00:00
  • Condition: State → switch.hallway_light → on
  • Action: Call service → switch.turn_offswitch.hallway_light

Save the automation. The light will switch off at midnight only if it was left on. Conditions prevent unnecessary state-change events from cluttering the logbook.

Long-term reliability notes

microSD cards wear out under constant SQLite writes. The Home Assistant OS Recorder integration keeps 10 days of history by default, which generates roughly 50–80 MB of writes per day on a moderately busy installation. The A2 Samsung Pro Endurance card has an endurance rating of 43,800 hours of continuous video recording, which translates to years of Home Assistant usage. Cheaper cards have shown failure modes as early as 6–12 months under the same load.

Taking a periodic snapshot (Settings → System → Backups → Create Backup) and copying it to a NAS or cloud storage gives a recovery path if the card fails. The snapshot is a single .tar file containing the full configuration and all installed add-ons.

Further reading

The Home Assistant documentation covers every integration in detail. The community forum has active threads on Shelly devices, Romanian-market sensors and Pi hardware issues. For the network side, the Shelly API documentation describes local REST endpoints that allow direct control without Home Assistant if needed.

Related on this resource: building an ESP8266 sensor mesh that feeds into this same MQTT broker and reading GPIO sensors with Arduino Nano for direct-wired inputs.