{"id":50771567,"url":"https://github.com/snabb/esp32-led-mqtt","last_synced_at":"2026-06-11T19:30:25.623Z","repository":{"id":361952474,"uuid":"1256316500","full_name":"snabb/esp32-led-mqtt","owner":"snabb","description":"Bare-metal Rust Embassy firmware for ESP32-C6 addressable LED strips with Wi-Fi and Home Assistant MQTT control.","archived":false,"fork":false,"pushed_at":"2026-06-02T00:41:26.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-02T01:19:52.474Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snabb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-01T16:58:59.000Z","updated_at":"2026-06-02T00:41:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/snabb/esp32-led-mqtt","commit_stats":null,"previous_names":["snabb/esp32-led-mqtt"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/snabb/esp32-led-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snabb%2Fesp32-led-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snabb%2Fesp32-led-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snabb%2Fesp32-led-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snabb%2Fesp32-led-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snabb","download_url":"https://codeload.github.com/snabb/esp32-led-mqtt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snabb%2Fesp32-led-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34215253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-11T19:30:21.791Z","updated_at":"2026-06-11T19:30:25.615Z","avatar_url":"https://github.com/snabb.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp32-led-mqtt\n\nBare-metal Rust Embassy firmware for ESP32-C6 boards driving WS281x- and\nSK68xx-compatible addressable RGB LED strips with ESP-HAL RMT output, Wi-Fi, and\nHome Assistant MQTT discovery/control. The default configuration works out of\nthe box with the [M5Stack NanoC6](https://docs.m5stack.com/en/core/M5NanoC6)\nand 60 LED [M5Stack RGB LED Strip](https://docs.m5stack.com/en/unit/rgb_led_strip).\n\n## Hardware\n\n- ESP32-C6 board [M5Stack NanoC6](https://docs.m5stack.com/en/core/M5NanoC6)\n- 60 LED SK6812 LED strip [M5Stack RGB LED Strip](https://docs.m5stack.com/en/unit/rgb_led_strip)\n- LED data on GPIO2\n- Common ground between the board and strip power supply\n\n## Configuration\n\nThe default LED hardware configuration is grouped near the top of\n`src/main.rs`:\n\n- The MQTT client ID, MQTT topics, Home Assistant discovery topics, unique IDs,\n  and device identifier are generated from the last three bytes of the ESP32\n  base MAC address, for example `esp32_led_mqtt_3ef8d0`.\n- `LED_COUNT` sets the number of LEDs.\n- The `LedStrip` type selects the controller timing and color order. The default\n  uses `Sk68xxTiming` with `color_order::Grb`.\n- The LED data pin is the direct `peripherals.GPIO2` argument passed to\n  `LedStrip::new_with_memsize`; replace that field with another ESP HAL GPIO\n  field for your board.\n- Optional strip power control is configured by `led_power_pin` in `main`.\n  The default is `None`. To drive an active-high power-enable GPIO, change it\n  to `Some(peripherals.GPIOx.into())`; change `LED_POWER_ACTIVE_LEVEL` to\n  `esp_hal::gpio::Level::Low` if the enable pin is active-low.\n- Optional active-low button input is configured by `button_pin` in `main`.\n  The default uses the M5Stack NanoC6 button on GPIO9. Set it to `None` if your\n  board has no button. A short press cycles effects, including `None`; a double\n  press changes the current RGB color; a long press toggles the light on or off.\n\nIf you do not have the separate LED strip available, the M5Stack NanoC6\ninternal LED can be used instead:\n\n- Set `LED_COUNT` to `1`.\n- In the `LedStrip` type, use `esp_hal_smartled::Ws2812Timing`.\n- Set `led_power_pin` to `Some(peripherals.GPIO19.into())`.\n- Pass `peripherals.GPIO20` to `LedStrip::new_with_memsize`.\n\n`esp-hal-smartled2` also provides these controller timing types:\n\n- `Sk68xxTiming`\n- `Ws2812bTiming`\n- `Ws2812Timing`\n- `Ws2811Timing`\n- `Ws2811LowSpeedTiming`\n\nOther RGB color-order options are:\n\n- `color_order::Rgb`\n- `color_order::Rbg`\n- `color_order::Grb`\n- `color_order::Gbr`\n- `color_order::Brg`\n- `color_order::Bgr`\n\nSet your Wi-Fi and MQTT details in `src/secrets.rs`, or copy the example\nsecrets file and adjust it for local ignored credentials:\n\n```sh\ncp secrets.example.yaml secrets.yaml\n```\n\nWhen `secrets.yaml` exists, it overrides `src/secrets.rs`. It is ignored by git\nand must not be committed. `wifi_ssid`, `wifi_password`, and `mqtt_broker` are\nrequired. `mqtt_broker` may be a bare IPv4 address or a DNS hostname.\n`mqtt_port` defaults to `1883` when omitted, and MQTT username/password may be\nomitted when the broker does not use authentication. Editing `src/secrets.rs`\nmodifies a tracked file; use `secrets.yaml` for private local credentials.\n\n## Flash\n\nConnect the ESP32-C6 over USB and run:\n\n```sh\ncargo run --release\n```\n\nCargo uses the configured runner:\n\n```sh\nespflash flash --monitor --chip esp32c6\n```\n\nIn non-interactive shells the flash can succeed even if the monitor cannot\nattach afterward.\n\n## Other ESP32 Chips\n\nThe firmware currently targets ESP32-C6. Other Wi-Fi ESP32 chips with RMT, such\nas ESP32-C3, ESP32-S3, and the original ESP32, should be possible by changing\nthe ESP crate chip features, Rust target, and `espflash --chip` setting, but\nthey are not tested by this repository.\n\n## Home Assistant\n\nThe firmware publishes MQTT discovery for one JSON-schema light and one sibling\nnumber entity on the same device. Home Assistant can control:\n\n- Power\n- RGB color\n- Brightness\n- Effect\n- Effect Speed\n\nThe `None` effect disables animations and uses the Home Assistant RGB color\ndirectly. `Effect Speed` is a 1-128 slider with finer adjustment at slow speeds;\nthe default is `64`. The default boot effect is `Rainbow` at the firmware\ndefault brightness.\n\n## Development\n\n### Build and Check\n\nThe repository pins the Rust target and ESP flash runner in `.cargo/config.toml`.\nThese commands are useful before submitting changes; they are not required\nbefore flashing a configured device.\n\n```sh\ncargo fmt --check\ncargo test --lib --target x86_64-unknown-linux-gnu\ncargo check\ncargo clippy --target riscv32imac-unknown-none-elf --lib --bin esp32-led-mqtt\n```\n\n### Adding Effects\n\nEffects live in `src/effects`, with one file per effect. To add one:\n\n1. Add `src/effects/my_effect.rs` with a `render` function.\n2. Add `mod my_effect;` and one dispatch arm in `src/effects/mod.rs`.\n3. Add the `EffectId` variant and `EffectDefinition` entry in `src/lib.rs`.\n4. Add the effect to the animation tests when it should change over time.\n\nHome Assistant discovery, name parsing, button cycling, and numeric effect\ncodes are derived from `EFFECT_DEFINITIONS`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnabb%2Fesp32-led-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnabb%2Fesp32-led-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnabb%2Fesp32-led-mqtt/lists"}