Skip to content

Bug: Auto-discover breaks when switch name contains forward slash (/) #1

@macpit

Description

@macpit

Original issue: Sian-Lee-SA#400

Problem

Auto-discovery doesn't work if the switch/device name includes a forward slash (/), because MQTT uses / as the topic separator. A device named Location on/off generates a topic like zigbee2mqtt/Location on/off/action, which breaks topic.split('/') parsing.

Proposed Fix

Input validation in the frontend: device names containing / should be rejected or escaped. Alternatively, fix the topic parsing to handle this edge case.

Affected Files

  • custom_components/switch_manager/helpers.py (topic parsing)
  • frontend/src/dialogs/identifier-auto-discovery.ts

Effort

Low (1-2h)


Migrated from original repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions