Skip to content

ESP32 with Home Assistant (WiFi/Zigbee), BLE sync with auto pairing, thunder and vibration - #3

Merged
42bios merged 6 commits into
masterfrom
esp32-home-assistant-sync
Sep 27, 2026
Merged

42bios merged 6 commits into
masterfrom
esp32-home-assistant-sync

Conversation

@42bios

@42bios 42bios commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #2, which was merged before these commits were pushed.

What changes

More natural lightning (shared lightning.h, also for the Arduino)

  • Colour follows the physics: white-blue channel; light scattered around it, distant flashes and the afterglow turn violet
  • Continuing current: some strokes keep glowing and flickering for up to 200 ms

ESP32 version (cloud-lightning-esp32/), connectivity chosen in config.h:

  • None: standalone random storm, controlled with the button
  • WiFi: MQTT with Home Assistant discovery (buttons Thunderstorm/Stop, switches Ambient storm/Thunder sound/Vibration)
  • Zigbee (ESP32-C6/H2): joins ZHA / Zigbee2MQTT as a router
  • Ambient mode, sound and vibration are remembered across restarts

One button with blink feedback while holding: click = thunderstorm, 2 s = ambient, 6 s = reset pairing, 10 s = leave Zigbee network. Followers: click = test flash, 6 s = forget the leader.

Several clouds over Bluetooth LE, in every mode and without Home Assistant:

  • Automatic pairing: switch a new cloud on right next to the main cloud (BLE signal strength); positions follow the pairing order
  • Clouds don't show the same thing: intra-cloud flashes, jumps to neighbours, side glow; each cloud flickers at its own spot, brightness and colour while keeping the rhythm of the flash

Thunder and vibration, optional, each with its own switch:

  • Sound (DFPlayer Mini, no extra library): real delay of sound, crack / rolling / rumble by distance, longer for distant strikes and more strokes, fades out
  • Vibration motor as a rare extra: only for strikes right above the cloud (< 3 km), about every second time, at most once per 20 s

Real lightning from Blitzortung.org via the Home Assistant Blitzortung integration (home-assistant/cloud_lightning.yaml).

Other

  • Arduino + BLE sketch: t toggles thunder sound, v vibration, b<km> shows a real strike
  • Particle Photon version removed (end of life)
  • README: button table, power over the hanging cord, building the cloud for natural light
  • Build workflow compiles 9 variants and checks that the shared headers are identical

Testing

  • CI green for all variants with --warnings all, no warnings from project code: Arduino Uno (± thunder + vibration), ESP32 standalone, ESP32 WiFi, ESP32 WiFi leader with everything, ESP32-C3 standalone leader with thunder, ESP32-C3 standalone follower with vibration, ESP32-C6 Zigbee, ESP32-C6 Zigbee leader with everything
  • ESP32 WiFi with everything uses 93 % of the default app partition (documented)
  • Not tested on hardware yet: pairing and sync timing, Zigbee pairing, BLE + Zigbee coexistence on the C6, DFPlayer, vibration, Home Assistant package

…ble sound

- Every flash now has a distance: close strikes bright with several strokes,
  distant ones faint sheet lightning
- New command b<km> shows a real strike at the given distance
- Thunder via DFPlayer Mini in shared thunder.h without extra library, with
  the real delay of sound and distance-dependent volume, for all versions;
  switchable at runtime with t
- New ESP32 version with MQTT and Home Assistant discovery; ambient mode and
  sound are remembered across restarts
- Home Assistant package that sends strikes from the Blitzortung integration
  to the cloud (MQTT for ESP32, REST for Photon)
- GitHub workflow compiles the Arduino and ESP32 versions and checks that
  the shared headers are identical
…length

- Several clouds share one storm over Bluetooth LE (leader broadcasts each
  flash, followers listen), without WiFi or Home Assistant. Flashes stay in
  one cloud, jump on to neighbours or light the others from the side; each
  cloud flickers differently while keeping the rhythm of the flash
- Connectivity chosen in config.h: none (standalone random storm, BOOT
  button), WiFi/MQTT or Zigbee (ESP32-C6/H2, router, ZHA/Zigbee2MQTT)
- Thunder picks crack, rolling or rumble sounds by distance and lasts longer
  for distant strikes and flashes with more strokes, then fades out
- Remove the Particle Photon version (end of life)
- Build workflow covers standalone, WiFi, Zigbee and multi-cloud variants
… colour

- Followers pair automatically when switched on next to the leader (BLE
  signal strength) and get their position in pairing order; no more cloud
  count/position/group settings
- One button for everything, with blink feedback while holding: storm,
  music mode, ambient, reset pairing (6 s), leave Zigbee network (10 s);
  followers: test flash and forget leader
- Vibration motor rumbles with close thunder (jolt for a crack, decaying
  uneven rumble), switched together with the thunder sound
- Music mode with an I2S microphone: quick flashes on the beat for all
  clouds, no thunder or vibration
- Colour follows the physics: white-blue channel, violet scattered light
  around it, for distant flashes and in the afterglow; continuing current
  makes some strokes glow and flicker longer
- README: button table, power over the hanging cord, building the cloud
  for natural light, music mode, vibration wiring
@42bios 42bios changed the title ESP32 with Home Assistant (WiFi/Zigbee), BLE sync of several clouds, thunder ESP32 with Home Assistant (WiFi/Zigbee), BLE sync with auto pairing, thunder, vibration, music mode Sep 23, 2026
- Remove music mode and microphone support
- Vibration gets its own switch (v command, Home Assistant switch, Zigbee
  endpoint) instead of following the thunder sound
- Vibration only for strikes right above the cloud (< 3 km), about every
  second time and at most once per 20 s, short jolt and rumble
- Button: click, hold 2/6/10 s (no double click any more)
@42bios 42bios changed the title ESP32 with Home Assistant (WiFi/Zigbee), BLE sync with auto pairing, thunder, vibration, music mode ESP32 with Home Assistant (WiFi/Zigbee), BLE sync with auto pairing, thunder and vibration Sep 23, 2026
@42bios
42bios merged commit a77ff6a into master Sep 27, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant