Skip to content

Instantly share code, notes, and snippets.

4. Concept Specifications
Our specification language is mostly informal, except for the definition of state components and action signatures. Here, for example, is a specification for a Password authentication concept.
concept Password [U]
purpose
to securely store and validate user credentials
state
password: U -> string
salt: U -> string
  1. first decision is to stick with yaml or go to toml or ron or another format.
  2. second is which bits to knick from esphome format.
  3. use matter terminology for abstractions.
  4. espforge, pins, peripherals(gpio, i2c, spi, uart), abstractions, devices

Template Configuration System

Overview

This document describes the type-safe template configuration system for espforge. The system enables templates to declare their configuration requirements through Rust structs, ensuring compile-time type safety and preventing runtime errors.

Key Benefits

  • Type Safety: Template-specific configuration in the example section validated against Rust structs at compile time
  • Zero Runtime Overhead: Template discovery happens during build, not execution

Of course. Based on the Rust code you're working with, the parser expects a specific structure for the binary_sensor configuration.

Here is the minimal, well-formed YAML file that will work with the Rust parsing example from our previous conversation.

binary_sensor:
  - platform: gpio
    name: "Desk Button"
    id: desk_button
    pin:
Config {
binary_sensor: [
BinarySensorComponent {
name: "Desk Button",
id: "desk_button",
platform: Gpio(
GpioPlatformConfig {
pin: PinConfig {
number: 23,
mode: InputPullup,
crate: esp-hal
options:
- name: place-spi-master-driver-in-ram
description: Places the SPI master driver in RAM for better performance
default:
- value: false
- name: place-switch-tables-in-ram
description: "Places switch-tables, some lookup tables and constants related to
rule! {
name: "door_alert",
on: rising(door_sensor),
if: wake_hours,
then:
buzzer = on,
wait: 5s,
buzzer = off;
}