Version 1.2.0 in library.json, library.properties and the discovery attributes

After 8ea7778 the readme described the behaviour as 1.2.0 while the package still said 1.1.0: PlatformIO listed "Alex2ESP @ 1.1.0" in the dependency graph, and the devices reported softwareVersion and firmwareVersion 1.1.0 to Alexa.

The choice made here: the number changes now, with the first commits of the 1.2.0 work, and not in the commit that closes the checkpoint. From this commit on the readme, the package files and the code agree at every commit of the branch, and nothing has to be remembered before the tag. The branch is not a release until it is tagged.

The code had the number twice, as the softwareVersion member of AlexaDevice and as a literal for firmwareVersion. Both now use ALEX2ESP_VERSION from the new src/AlexaVersion.h, so a release changes three places: that header, library.json and library.properties. The readme's hint for pinning a release keeps v1.1.0, the newest tag that exists.

For a sketch: getSoftwareVersion() and the discovery attributes say 1.2.0.

examples/basicLight.cpp for d1_mini, static RAM / flash in bytes: 34,452 / 337,461 -> 34,452 / 337,461, no warnings; the dependency graph of the build says "Alex2ESP @ 1.2.0".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
David 2026-09-28 16:02:52 +00:00
parent d7d0e903a6
commit cb5c9876fe
7 changed files with 16 additions and 4 deletions

View file

@ -110,7 +110,7 @@ JsonDocument AlexaDevice::getDeviceJSON() const {
additionalAttributes["manufacturer"] = manufacturer;
additionalAttributes["model"] = model;
additionalAttributes["serialNumber"] = "ESP2Alex";
additionalAttributes["firmwareVersion"] = "1.1.0";
additionalAttributes["firmwareVersion"] = ALEX2ESP_VERSION;
additionalAttributes["softwareVersion"] = softwareVersion;
additionalAttributes["customIdentifier"] = "ESP2Alex";

View file

@ -11,6 +11,7 @@
#include <deque>
#include "AlexaStatusMessage.h"
#include "AlexaTransport.h"
#include "AlexaVersion.h"
#define MAX_EVENTS 10
@ -205,7 +206,7 @@ private:
String manufacturerName = "Alexa2MQTT";
String manufacturer = "Alexa2MQTT";
String model = "Alexa2MQTT";
const String softwareVersion = "1.1.0";
const String softwareVersion = ALEX2ESP_VERSION;
std::deque<AlexaInterface> capabilities; // deque: pointers handed out by addCapability stay valid

8
src/AlexaVersion.h Normal file
View file

@ -0,0 +1,8 @@
// The version of the library, the same as in library.json and library.properties. The devices report it to Alexa
// as softwareVersion and firmwareVersion.
#ifndef ALEXA_VERSION_H
#define ALEXA_VERSION_H
#define ALEX2ESP_VERSION "1.2.0"
#endif // ALEXA_VERSION_H