esphome / esphome/feature-requests

Convert substitution to mDNS friendly name

Open
#1,367 0 comments 0 reactions 0 assignees View on GitHub
Core Project: Dashboard
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

It would be nice if there would be a function to convert a substitution to a mDNS friendly name.

**Please describe your use case for this integration and alternatives you've tried:**

I have a substitution for my device name which I use for my sensor names.
To keep the code clean I want to use this substitution also for the device name.
This is not possible because it contains spaces and/or underscores which is not permitted for a mDNS name.
It would be nice if all illegal characters would be automatically replaced with "-" for the mDNS name.

An alternative may be to use the file name and replace all mDNS illegal characters with "-".

**Additional context**

```
substitutions:
device_name: "Wemos D1 mini 1"

esphome:
name: $device_name
platform: ESP8266
board: d1_mini

...

binary_sensor:
- platform: status
name: "${device_name} Status"
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named in feature request #1367. Start by identifying where substitutions and the ESPHome device name are processed, then determine how mDNS-invalid characters should be handled and what configuration or test coverage would demonstrate completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
embedded-iot, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.