esphome / esphome/feature-requests

Automated version tracking

Open
#2,229 1 comment 2 reactions 0 assignees View on GitHub
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**
I've been toying with *some* method of automatic version tracking of esphome config files.
There is the option already to add version information to `esphome -> project -> version`, but that's manual effort and may not be kept in sync with e.g. git commits.

Ideally we could run some script to generate a string containing the version information, formated as a user would want to use it. This could then be added to the `Application`, similar to the addition of [`comments`](https://esphome.io/components/esphome.html#configuration-variables). This information could then easilly be exposed as a template sensor. E.g.:
```yaml
text_sensor:
- platform: template
name: "Config Version"
lambda: |-
return App.get_version_string();
```

The user would then be able to use e.g. `git describe` or similar to produce a version string based on the config repository.

Potential issues:
- Allowing just any script is potentially unsafe and could seriously mess with a users system
- Files are copied pre-compilation, thus adding additional pre-processing scripts to e.g. the [*platformio*](https://docs.platformio.org/en/latest/scripting/actions.html#pre-post-actions) options would not be run in the configuration repo where the config is originally stored.

**Please describe your use case for this integration and alternatives you've tried:**
- Platformio pre-build actions, but these are not run in the config repo.
- Manual versioning, but as indicated *automated* versioning is the goal.

**Additional context**
I'm working on a minimal viable solution that adds limited `git describe` processing to the user application, but this makes the formatting options quite limited.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the existing esphome → project → version setting and the Application/version-string entry point described in the request. Compare the PlatformIO pre-build action limitation with the proposed git describe approach, then define how safe formatting would reach a template text_sensor; done requires an agreed design that handles copied files and script safety.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
build-system, embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.