Skip to content

[tuya] Document wifi_reset, on_wifi_reset and on_wifi_select#6711

Closed
dshcherb wants to merge 33 commits into
esphome:currentfrom
dshcherb:tuya-wifi-reset
Closed

[tuya] Document wifi_reset, on_wifi_reset and on_wifi_select#6711
dshcherb wants to merge 33 commits into
esphome:currentfrom
dshcherb:tuya-wifi-reset

Conversation

@dshcherb
Copy link
Copy Markdown

Description

Add documentation for the new wifi_reset, on_wifi_reset, and on_wifi_select configuration options added to the Tuya MCU component.

When a Tuya MCU device has a physical button, long-pressing it triggers the MCU to send WIFI_RESET (0x04, EZ pairing) or WIFI_SELECT (0x05, AP pairing) commands to the WiFi module. Previously, ESPHome only acknowledged these commands and sent a fake WIFI_STATE progression to satisfy the MCU - no actual reset or pairing occurred.

The new options allow:

  • wifi_reset: true - clear saved WiFi credentials and reboot when the MCU sends a reset command
  • on_wifi_reset / on_wifi_select - automation triggers for custom logic (e.g., reboot without clearing credentials, notify Home Assistant, turn off relays before reset)

Related issue (if applicable):

Pull request in esphome with YAML changes (if applicable):

Checklist

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /src/content/docs/components/index.mdx when creating new documents for new components or cookbook.

jesserockz and others added 24 commits May 14, 2026 12:33
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: luar123 <49960470+luar123@users.noreply.github.com>
…home#6656)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: tomaszduda23 <tomaszduda23@gmail.com>
esphome[bot]
esphome Bot previously requested changes May 30, 2026
Copy link
Copy Markdown

@esphome esphome Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@esphome
Copy link
Copy Markdown

esphome Bot commented May 30, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@esphome esphome Bot marked this pull request as draft May 30, 2026 23:32
@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit 436e838
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/6a1c1445f917c90008b6323d
😎 Deploy Preview https://deploy-preview-6711--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7fdb372f-21d0-449a-9a5d-affddbe44345

📥 Commits

Reviewing files that changed from the base of the PR and between f11488c and 436e838.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (37)
  • .claude/skills/pr-workflow/SKILL.md
  • .github/workflows/close-pr-from-fork-default-branch.yml
  • .gitignore
  • CONTRIBUTING.md
  • README.md
  • astro.config.mjs
  • data/version.yaml
  • package.json
  • src/content/docs/changelog/v1.10.0.mdx
  • src/content/docs/changelog/v1.11.0.mdx
  • src/content/docs/changelog/v1.12.0.mdx
  • src/content/docs/changelog/v1.13.0.mdx
  • src/content/docs/changelog/v1.14.0.mdx
  • src/content/docs/changelog/v1.15.0.mdx
  • src/content/docs/changelog/v1.16.0.mdx
  • src/content/docs/changelog/v1.17.0.mdx
  • src/content/docs/changelog/v1.18.0.mdx
  • src/content/docs/changelog/v1.9.0.mdx
  • src/content/docs/components/climate/mitsubishi_cn105.mdx
  • src/content/docs/components/display/nextion.mdx
  • src/content/docs/components/index.mdx
  • src/content/docs/components/light/index.mdx
  • src/content/docs/components/light/neopixelbus.mdx
  • src/content/docs/components/lvgl/index.mdx
  • src/content/docs/components/lvgl/widgets.mdx
  • src/content/docs/components/network.mdx
  • src/content/docs/components/output/ledc.mdx
  • src/content/docs/components/packages.mdx
  • src/content/docs/components/rp2040.mdx
  • src/content/docs/components/speaker/i2s_audio.mdx
  • src/content/docs/components/time/homeassistant.mdx
  • src/content/docs/components/time/index.mdx
  • src/content/docs/components/tuya.mdx
  • src/content/docs/components/web_server.mdx
  • src/content/docs/components/wifi.mdx
  • src/content/docs/guides/security_best_practices.mdx
  • src/content/docs/guides/setting_up_rmt_devices.mdx

Walkthrough

Documentation and site metadata are updated across the site: repository/package/workflow references switch to esphome.io; Starlight edit links and version.yaml adjusted; CONTRIBUTING/README updated; many changelog entries' PR links normalized to esphome.io; and multiple component docs (Tuya, light, NeoPixelBus, RP2040, time, web_server, speaker, LVGL, etc.) gain clarifications, new fields/options, or new automation/action documentation.

Changes

Repository & Site Metadata

Layer / File(s) Summary
Repo metadata, packaging, and workflow text
.claude/skills/pr-workflow/SKILL.md, .github/workflows/close-pr-from-fork-default-branch.yml, .gitignore, package.json, data/version.yaml, README.md
Replace esphome-docs references with esphome.io in workflow examples, close-job comments, package metadata, README title and project path, remove .gitignore esphome-docs entry, and bump site version/astro dependency.
Astro config and CONTRIBUTING
astro.config.mjs, CONTRIBUTING.md
Make editLink.baseUrl branch-aware, tweak embedded head script formatting, and add CONTRIBUTING guidance for reusable MDX components and submission formatting rules.

Changelogs

Layer / File(s) Summary
Changelog normalization (v1.9 → v1.12)
src/content/docs/changelog/v1.9.0.mdx, v1.10.0.mdx, v1.11.0.mdx, v1.12.0.mdx
Replace esphome-docs PR links with esphome.io equivalents and adjust/add docs bullets in release and “All changes” sections.
Changelog normalization (v1.13 → v1.16)
src/content/docs/changelog/v1.13.0.mdx, v1.14.0.mdx, v1.15.0.mdx, v1.16.0.mdx
Bulk-update documentation PR link targets to esphome.io and refresh “All changes” lists where present.
Changelog normalization (v1.17 → v1.18)
src/content/docs/changelog/v1.17.0.mdx, v1.18.0.mdx
Update docs PR URL targets to esphome.io across release and All changes items.

Component and Guide Documentation

Layer / File(s) Summary
Tuya Wi-Fi reset and light effect actions
src/content/docs/components/tuya.mdx, src/content/docs/components/light/index.mdx
Add wifi_reset boolean option and document on_wifi_reset/on_wifi_select automations with trigger descriptions and YAML examples; add light.effect.next/light.effect.previous action docs with examples and options.
Display, web_server, and LVGL
src/content/docs/components/display/nextion.mdx, src/content/docs/components/web_server.mdx, src/content/docs/components/lvgl/index.mdx, src/content/docs/components/lvgl/widgets.mdx
Remove Nextion dump_device_info variable, change web_server local-asset example paths, add LVGL verification note, and add rounded option to meter widget.
NeopixelBus, RP2040, network, LEDC
src/content/docs/components/light/neopixelbus.mdx, src/content/docs/components/rp2040.mdx, src/content/docs/components/network.mdx, src/content/docs/components/output/ledc.mdx
Mark NeoPixelBus ESP32 support deprecated with migration guidance, add RP2040 variant/board guidance and warnings, note nRF52 IPv6 always true, and require LEDC pin be output-capable.
Speaker SPDIF, time, security guides, RMT guide
src/content/docs/components/speaker/i2s_audio.mdx, src/content/docs/components/time/homeassistant.mdx, src/content/docs/components/time/index.mdx, src/content/docs/guides/security_best_practices.mdx, src/content/docs/guides/setting_up_rmt_devices.mdx
Adjust SPDIF constraints and example, document timezone inference/behavior with Home Assistant and empty-string semantics, unify min_auth_mode guidance to WPA2, and change remote_receiver tolerance default to 25%.
Misc component docs and index
src/content/docs/components/climate/mitsubishi_cn105.mdx, src/content/docs/components/packages.mdx, src/content/docs/components/index.mdx
Add supported_swing_modes for Mitsubishi CN105, list supported shorthand package hosts, and update components index PR link to esphome.io.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers:

  • guillempages
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: documenting three new Tuya component features (wifi_reset, on_wifi_reset, on_wifi_select).
Description check ✅ Passed The description is directly related to the changeset, providing clear context about the new configuration options being documented and their purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/content/docs/components/tuya.mdx (1)

159-165: ⚡ Quick win

Make wifi_reset: false explicit in this example.

The paragraph explicitly calls out wifi_reset: false, but the snippet currently relies on the default. Adding it explicitly will reduce ambiguity for readers copying this block.

Proposed doc tweak
 tuya:
+  wifi_reset: false
   on_wifi_reset:
     - lambda: App.safe_reboot();
   on_wifi_select:
     - lambda: App.safe_reboot();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/content/docs/components/tuya.mdx` around lines 159 - 165, The YAML
example under the tuya block currently shows on_wifi_reset and on_wifi_select
handlers but omits the explicit wifi_reset setting; update the snippet so it
includes wifi_reset: false at the tuya root (alongside the existing
on_wifi_reset and on_wifi_select keys) so readers see the explicit setting
instead of relying on the default.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/content/docs/components/tuya.mdx`:
- Around line 159-165: The YAML example under the tuya block currently shows
on_wifi_reset and on_wifi_select handlers but omits the explicit wifi_reset
setting; update the snippet so it includes wifi_reset: false at the tuya root
(alongside the existing on_wifi_reset and on_wifi_select keys) so readers see
the explicit setting instead of relying on the default.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ca825dbb-a646-47ec-be82-0280986eb984

📥 Commits

Reviewing files that changed from the base of the PR and between 274b528 and f11488c.

📒 Files selected for processing (1)
  • src/content/docs/components/tuya.mdx

Copy link
Copy Markdown

@esphome esphome Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@esphome esphome Bot marked this pull request as draft May 31, 2026 10:58
@dshcherb dshcherb closed this May 31, 2026
@dshcherb dshcherb deleted the tuya-wifi-reset branch May 31, 2026 11:03
@dshcherb
Copy link
Copy Markdown
Author

Closed in favor of #6712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.