Skip to the content.

ESPHome Swift

A Swift-based replacement for ESPHome that generates Embedded Swift firmware for ESP32 microcontrollers from declarative YAML configuration files.

Features

Quick Start

Installation

From Source

git clone https://github.com/ryan-graves/esphome-swift.git
cd esphome-swift
swift build -c release
sudo cp .build/release/esphome-swift /usr/local/bin/

Create Your First Project

  1. Create a new project:
    esphome-swift new my-sensor
    
  2. Edit the configuration file: ```yaml esphome_swift: name: my-sensor friendly_name: “My Sensor”

esp32: board: esp32-c6-devkitc-1 framework: type: esp-idf

wifi: ssid: “MyWiFi” password: “MyPassword”

sensor:

  1. Build and flash:
    cd my-sensor
    esphome-swift build my-sensor.yaml
    esphome-swift flash build/my-sensor
    

Documentation

Supported Components

Sensors

Binary Sensors

Switches

Lights

Coming Soon

Example Projects

Temperature Monitor

sensor:
  - platform: dht
    pin:
      number: GPIO4
    model: DHT22
    temperature:
      name: "Room Temperature"
    humidity:
      name: "Room Humidity"
    update_interval: 60s

Smart Switch

switch:
  - platform: gpio
    pin:
      number: GPIO5
    name: "Living Room Light"
    restore_mode: ALWAYS_OFF

RGB Mood Light

light:
  - platform: rgb
    red_pin:
      number: GPIO6
    green_pin:
      number: GPIO7
    blue_pin:
      number: GPIO8
    name: "Mood Light"

License

ESPHome Swift is released under the MIT License. See LICENSE for details.