Repository navigation
Fix modbus reload without YAML config - #186554
Conversation
Reloading no longer logs an error when modbus has no YAML hubs, and detects a missing modbus: section by its key rather than an empty config, which raised KeyError in real configurations.
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes address the reported regression with targeted test coverage and no identified blocking issues; tests were not executed.
0 open findings
What changed in this PR
Fixes Modbus YAML reloads when the integration is loaded only as a dependency, addressing the regression introduced by #181845.
Changes:
- Allows reloads without existing YAML hubs.
- Handles newly added or removed Modbus configuration.
- Adds regression coverage for empty YAML and YAML without Modbus.
| File | Description |
|---|---|
| tests/components/modbus/test_services.py | Tests reloads with and without existing hubs across three YAML configurations. |
| tests/components/modbus/fixtures/configuration_no_modbus.yaml | Adds nonempty YAML without a Modbus section. |
| homeassistant/components/modbus/services.py | Handles absent hubs and missing Modbus configuration during reload. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
balloob
left a comment
There was a problem hiding this comment.
We should instead only set up the action when YAML is configured.
Reload only applies to the modbus: YAML section, so without one the action is no longer registered and "Reload all YAML" skips it.
I'm not sure I agree. Registering the action only when YAML is configured would bring back the behavior the |
epenet
left a comment
There was a problem hiding this comment.
There is a small nit in the test.
Please also update the PR description: mention that reload now also picks up a modbus: section added after startup.
epenet
left a comment
There was a problem hiding this comment.
Thanks for the update! Two suggestions for the failed-startup case raised by Copilot; with them, the full modbus test suite passes locally.
…2026.10.1 ➔ 2026.10.2) (#1247) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/home-operations/home-assistant](https://ghcr.io/home-operations/home-assistant) ([source](https://github.com/home-assistant/core)) | patch | `2026.10.1` → `2026.10.2` | --- ### Release Notes <details> <summary>home-assistant/core (ghcr.io/home-operations/home-assistant)</summary> ### [`v2026.10.2`](https://github.com/home-assistant/core/releases/tag/2026.10.2) [Compare Source](home-assistant/core@2026.10.1...2026.10.2) - Fix IndexError on out-of-range heater levels in Tesla Fleet ([@​sebr] - [#​178049]) ([tesla_fleet docs]) - Deduplicate sleepers within a single SleepIQ bed ([@​derekcentrico] - [#​181461]) ([sleepiq docs]) - Handle Enphase envoy Session is Closed in background tasks ([@​catsmanac] - [#​183172]) ([enphase_envoy docs]) - Treat MPD protocol errors as a connection failure ([@​mattias-arrelid] - [#​184481]) ([mpd docs]) - Bump py-opendisplay to 7.18.1 ([@​g4bri3lDev] - [#​184911]) ([opendisplay docs]) (dependency) - Bump aiotankerkoenig to 0.5.5 ([@​mib1185] - [#​185714]) ([tankerkoenig docs]) (dependency) - Tankerkoenig handle api errors config flow ([@​mib1185] - [#​185719]) ([tankerkoenig docs]) - Handle Gemini generation parameters and complete WAV TTS responses ([@​oohhddaanngg] - [#​185723]) ([google_generative_ai_conversation docs]) - Fix SmartTub error sensor reporting stale historical errors ([@​mdz] - [#​185726]) ([smarttub docs]) - Bump aiohttp to 3.14.5 ([@​bdraco] - [#​185746]) (dependency) - Mark Aquacell sensors unavailable when data is stale ([@​alexborro] - [#​185762]) ([aquacell docs]) - Bump aionanoleaf2 to 1.0.5 ([@​feixm1] - [#​185777]) ([nanoleaf docs]) (dependency) - Bump my-pv to 0.0.13 ([@​rrooggiieerr] - [#​185797]) ([my_pv docs]) (dependency) - Catch TimeoutError in the Nettigo Air Monitor integration ([@​bieniu] - [#​185812]) ([nam docs]) - Ignore devices without TR-064 support during FRITZ!Box Tools SSDP discovery ([@​mib1185] - [#​185816]) ([fritz docs]) - Bump arcam-fmj to 3.0.1 ([@​elupus] - [#​185887]) ([arcam_fmj docs]) (dependency) - Handle Alexa RequireRelink on cloud entity registry updates ([@​balloob] - [#​185894]) ([cloud docs]) - Redact schedule coordinates in Teslemetry and Tesla Fleet diagnostics ([@​Bre77] - [#​185905]) ([teslemetry docs]) ([tesla_fleet docs]) - Report a dedicated error when the Tedee bridge has no locks ([@​zweckj] - [#​185907]) ([tedee docs]) - Prevent WiiM browse failures from marking devices unavailable ([@​Linkplay2020] - [#​185926]) ([wiim docs]) - Fix group sensor crash when the group has no members ([@​joostlek] - [#​185931]) ([group docs]) - Do not cut off KNX SQLite telegram store initialization with a timeout ([@​farmio] - [#​185940]) ([knx docs]) - Bump nyt_games to 1.0.1 ([@​joostlek] - [#​185968]) ([nyt_games docs]) (dependency) - Gate Nanoleaf event listener on supports_events ([@​loebi-ch] - [#​185977]) ([nanoleaf docs]) - Fix MQTT device triggers and tags firing twice after reload ([@​klejejs] - [#​185998]) ([mqtt docs]) - Fix FRITZ!SmartHome SSDP host selection ([@​mib1185] - [#​186029]) ([fritzbox docs]) - switch Broadlink to broadlink-async (fixes [#​184800](home-assistant/core#184800), replaces [#​184806](home-assistant/core#184806)) ([@​DAB-LABS] - [#​186053]) ([broadlink docs]) - Fix weatherflow last_reset updating on every device report ([@​jeeftor] - [#​186141]) ([weatherflow docs]) - Bump weatherflow4py to 1.5.12 ([@​jeeftor] - [#​186142]) ([weatherflow_cloud docs]) (dependency) - Bump intellifire4py to 4.5.6 ([@​jeeftor] - [#​186143]) ([intellifire docs]) (dependency) - Fix scrape subentry reconfigure flow not finishing ([@​joostlek] - [#​186144]) ([scrape docs]) - pin pycares to 5.0.1 ([@​aclerici38] - [#​186164]) - Allow a list of states for state conditions with a duration ([@​emontnemery] - [#​186165]) - Bump airthings-ble to 1.3.1 ([@​LaStrada] - [#​186387]) ([airthings_ble docs]) (dependency) - Guard owner and existing credentials in auth provider create command ([@​zweckj] - [#​186398]) ([config docs]) - Fetch missing Renault vehicle details ([@​epenet] - [#​186402]) ([renault docs]) - Fix Discogs random record sensor when release has no format description ([@​cerealkiller57540] - [#​186405]) ([discogs docs]) - Fix permissions validation for ProxmoxVE ([@​CoMPaTech] - [#​186420]) ([proxmoxve docs]) - Hide MELCloud Home swing modes on units without vanes ([@​erwindouna] - [#​186468]) ([melcloud_home docs]) - Fix modbus reload without YAML config ([@​joyjit] - [#​186554]) ([modbus docs]) - Revoke refresh tokens when removing a user ([@​frenck] - [#​186558]) - Redact credentials and host in SFR Box diagnostics ([@​epenet] - [#​186668]) ([sfr_box docs]) - Fix SolarEdge module statistics sum resetting after a gap ([@​tronikos] - [#​186753]) ([solaredge docs]) - Bump deebot-client to 18.7.0 ([@​edenhaus] - [#​186779]) ([ecovacs docs]) (dependency) - Redact identifying data in NRGkick diagnostics ([@​andijakl] - [#​186781]) ([nrgkick docs]) - Persist Ecovacs account credentials to avoid device verification ([@​erwindouna] - [#​186796]) ([ecovacs docs]) - Update frontend to [`2026093`](https://github.com/home-assistant/core/commit/20260930).4 ([@​bramkragten] - [#​186813]) ([frontend docs]) (dependency) - Fix Fritz setup failing when UPnP info lacks NewEnable key ([@​mib1185] - [#​186896]) ([fritz docs]) - Bump aiomelcloudhome to 0.3.0 ([@​erwindouna] - [#​185769]) ([melcloud_home docs]) (dependency) - Pin pypasser below 1.0.0 ([@​erwindouna] - [#​186527]) [#​178049]: home-assistant/core#178049 [#​181461]: home-assistant/core#181461 [#​183172]: home-assistant/core#183172 [#​184481]: home-assistant/core#184481 [#​184707]: home-assistant/core#184707 [#​184911]: home-assistant/core#184911 [#​185554]: home-assistant/core#185554 [#​185714]: home-assistant/core#185714 [#​185719]: home-assistant/core#185719 [#​185723]: home-assistant/core#185723 [#​185726]: home-assistant/core#185726 [#​185746]: home-assistant/core#185746 [#​185762]: home-assistant/core#185762 [#​185769]: home-assistant/core#185769 [#​185777]: home-assistant/core#185777 [#​185797]: home-assistant/core#185797 [#​185812]: home-assistant/core#185812 [#​185816]: home-assistant/core#185816 [#​185887]: home-assistant/core#185887 [#​185894]: home-assistant/core#185894 [#​185905]: home-assistant/core#185905 [#​185907]: home-assistant/core#185907 [#​185926]: home-assistant/core#185926 [#​185931]: home-assistant/core#185931 [#​185940]: home-assistant/core#185940 [#​185968]: home-assistant/core#185968 [#​185977]: home-assistant/core#185977 [#​185998]: home-assistant/core#185998 [#​186029]: home-assistant/core#186029 [#​186053]: home-assistant/core#186053 [#​186141]: home-assistant/core#186141 [#​186142]: home-assistant/core#186142 [#​186143]: home-assistant/core#186143 [#​186144]: home-assistant/core#186144 [#​186164]: home-assistant/core#186164 [#​186165]: home-assistant/core#186165 [#​186387]: home-assistant/core#186387 [#​186398]: home-assistant/core#186398 [#​186402]: home-assistant/core#186402 [#​186405]: home-assistant/core#186405 [#​186420]: home-assistant/core#186420 [#​186468]: home-assistant/core#186468 [#​186527]: home-assistant/core#186527 [#​186554]: home-assistant/core#186554 [#​186558]: home-assistant/core#186558 [#​186668]: home-assistant/core#186668 [#​186753]: home-assistant/core#186753 [#​186779]: home-assistant/core#186779 [#​186781]: home-assistant/core#186781 [#​186796]: home-assistant/core#186796 [#​186813]: home-assistant/core#186813 [#​186896]: home-assistant/core#186896 [@​Bre77]: https://github.com/Bre77 [@​CoMPaTech]: https://github.com/CoMPaTech [@​DAB-LABS]: https://github.com/DAB-LABS [@​LaStrada]: https://github.com/LaStrada [@​Linkplay2020]: https://github.com/Linkplay2020 [@​aclerici38]: https://github.com/aclerici38 [@​alexborro]: https://github.com/alexborro [@​andijakl]: https://github.com/andijakl [@​balloob]: https://github.com/balloob [@​bdraco]: https://github.com/bdraco [@​bieniu]: https://github.com/bieniu [@​bramkragten]: https://github.com/bramkragten [@​catsmanac]: https://github.com/catsmanac [@​cerealkiller57540]: https://github.com/cerealkiller57540 [@​derekcentrico]: https://github.com/derekcentrico [@​edenhaus]: https://github.com/edenhaus [@​elupus]: https://github.com/elupus [@​emontnemery]: https://github.com/emontnemery [@​epenet]: https://github.com/epenet [@​erwindouna]: https://github.com/erwindouna [@​farmio]: https://github.com/farmio [@​feixm1]: https://github.com/feixm1 [@​frenck]: https://github.com/frenck [@​g4bri3lDev]: https://github.com/g4bri3lDev [@​jeeftor]: https://github.com/jeeftor [@​joostlek]: https://github.com/joostlek [@​joyjit]: https://github.com/joyjit [@​klejejs]: https://github.com/klejejs [@​loebi-ch]: https://github.com/loebi-ch [@​mattias-arrelid]: https://github.com/mattias-arrelid [@​mdz]: https://github.com/mdz [@​mib1185]: https://github.com/mib1185 [@​oohhddaanngg]: https://github.com/oohhddaanngg [@​rrooggiieerr]: https://github.com/rrooggiieerr [@​sebr]: https://github.com/sebr [@​tronikos]: https://github.com/tronikos [@​zweckj]: https://github.com/zweckj [airthings_ble docs]: https://www.home-assistant.io/integrations/airthings_ble/ [aquacell docs]: https://www.home-assistant.io/integrations/aquacell/ [arcam_fmj docs]: https://www.home-assistant.io/integrations/arcam_fmj/ [broadlink docs]: https://www.home-assistant.io/integrations/broadlink/ [cloud docs]: https://www.home-assistant.io/integrations/cloud/ [config docs]: https://www.home-assistant.io/integrations/config/ [discogs docs]: https://www.home-assistant.io/integrations/discogs/ [ecovacs docs]: https://www.home-assistant.io/integrations/ecovacs/ [enphase_envoy docs]: https://www.home-assistant.io/integrations/enphase_envoy/ [fritz docs]: https://www.home-assistant.io/integrations/fritz/ [fritzbox docs]: https://www.home-assistant.io/integrations/fritzbox/ [frontend docs]: https://www.home-assistant.io/integrations/frontend/ [google_generative_ai_conversation docs]: https://www.home-assistant.io/integrations/google_generative_ai_conversation/ [group docs]: https://www.home-assistant.io/integrations/group/ [intellifire docs]: https://www.home-assistant.io/integrations/intellifire/ [knx docs]: https://www.home-assistant.io/integrations/knx/ [melcloud_home docs]: https://www.home-assistant.io/integrations/melcloud_home/ [modbus docs]: https://www.home-assistant.io/integrations/modbus/ [mpd docs]: https://www.home-assistant.io/integrations/mpd/ [mqtt docs]: https://www.home-assistant.io/integrations/mqtt/ [my_pv docs]: https://www.home-assistant.io/integrations/my_pv/ [nam docs]: https://www.home-assistant.io/integrations/nam/ [nanoleaf docs]: https://www.home-assistant.io/integrations/nanoleaf/ [nrgkick docs]: https://www.home-assistant.io/integrations/nrgkick/ [nyt_games docs]: https://www.home-assistant.io/integrations/nyt_games/ [opendisplay docs]: https://www.home-assistant.io/integrations/opendisplay/ [proxmoxve docs]: https://www.home-assistant.io/integrations/proxmoxve/ [renault docs]: https://www.home-assistant.io/integrations/renault/ [scrape docs]: https://www.home-assistant.io/integrations/scrape/ [sfr_box docs]: https://www.home-assistant.io/integrations/sfr_box/ [sleepiq docs]: https://www.home-assistant.io/integrations/sleepiq/ [smarttub docs]: https://www.home-assistant.io/integrations/smarttub/ [solaredge docs]: https://www.home-assistant.io/integrations/solaredge/ [tankerkoenig docs]: https://www.home-assistant.io/integrations/tankerkoenig/ [tedee docs]: https://www.home-assistant.io/integrations/tedee/ [tesla_fleet docs]: https://www.home-assistant.io/integrations/tesla_fleet/ [teslemetry docs]: https://www.home-assistant.io/integrations/teslemetry/ [weatherflow docs]: https://www.home-assistant.io/integrations/weatherflow/ [weatherflow_cloud docs]: https://www.home-assistant.io/integrations/weatherflow_cloud/ [wiim docs]: https://www.home-assistant.io/integrations/wiim/ </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Berlin) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjUuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE2NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.xcd.dev/gabrielcosi/home-ops/pulls/1247


Proposed change
Without a
modbus:YAML section (e.g. when modbus is only a dependency of SolarEdge Modbus), "Reload all YAML" still callsmodbus.reload, which then logsModbus cannot reload, because it was never loadedevery time.modbus:section. It also now picks up amodbus:section added after startup, setting the hubs up without a restart.modbus:section is now detected by the missingmodbuskey, not an empty config. The loaded config includes other integrations, so a missing section led toKeyError: 'modbus'. This also fixes reloading after removingmodbus:.Tested on a live 2026.10.1 install with SolarEdge Modbus: reloads log nothing and the SolarEdge sensors keep updating.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests:
🤖 Generated with Claude Code