Release home-assistant-integration 3.0.0

This commit is contained in:
2026-08-24 22:08:19 +10:00
parent d03766ffbc
commit 3ac7fc98be
13 changed files with 155 additions and 17 deletions
+23
View File
@@ -0,0 +1,23 @@
name: Build
on:
push:
pull_request:
permissions:
contents: read
jobs:
compile-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
environment: ["esp8266", "esp32"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --upgrade platformio==6.1.19
- run: pio test -e ${{ matrix.environment }} --without-uploading --without-testing
+23
View File
@@ -0,0 +1,23 @@
name: Publish release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install --upgrade platformio==6.1.19
- run: ./scripts/prepare-release.sh "$GITHUB_REF_NAME"
- run: gh release create "$GITHUB_REF_NAME" --generate-notes --title "$GITHUB_REF_NAME"
env:
GH_TOKEN: ${{ github.token }}
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 3.0.0
- Establish this maintained fork as the canonical ArduinoHA dependency for DeviceFramework.
- Prevent discovery serialization from writing past its entry allocation.
- Correct array deallocation in affected entity types.
# Changelog
## Unreleased
**New features:**
+7 -9
View File
@@ -1,7 +1,7 @@
{
"name": "home-assistant-integration",
"version": "2.1.0",
"description": "Home Assistant MQTT integration for Arduino (ArduinoHA): discovery, entities, and low resource use.",
"version": "3.0.0",
"description": "Maintained Home Assistant MQTT discovery and entity integration for Arduino and ESP devices.",
"keywords": [
"mqtt",
"home-assistant",
@@ -30,12 +30,9 @@
"url": "https://github.com/alexhopeoconnor/arduino-home-assistant.git"
},
"frameworks": "arduino",
"dependencies": [
{
"name": "knolleary/PubSubClient",
"version": "^2.8.0"
}
],
"dependencies": {
"knolleary/PubSubClient": "2.8.0"
},
"export": {
"include": [
"src",
@@ -47,5 +44,6 @@
"LICENSE",
"CHANGELOG.md"
]
}
},
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json"
}
+1 -1
View File
@@ -1,5 +1,5 @@
name=home-assistant-integration
version=2.1.0
version=3.0.0
author=Dawid Chyrzynski <dev@chyrzynski.pl>, Alex Hope-O'Connor <alex.hope.oconnor@pomonaqld.au>
maintainer=Alex Hope-O'Connor <alex.hope.oconnor@pomonaqld.au>
sentence=Home Assistant MQTT integration for Arduino
+2 -2
View File
@@ -23,7 +23,7 @@ test_framework = unity
test_build_src = yes
monitor_speed = 115200
build_flags = -DARDUINOHA_TEST
lib_deps = knolleary/PubSubClient@^2.8.0
lib_deps = knolleary/PubSubClient@2.8.0
[env:esp8266]
extends = common
@@ -32,7 +32,7 @@ board = d1_mini
[env:esp32]
extends = common
platform = espressif32
platform = espressif32@6.13.0
board = esp32dev
build_unflags = -std=gnu++11
build_flags = ${common.build_flags} -std=gnu++14
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 vMAJOR.MINOR.PATCH [--tag]"
exit 2
}
tag="${1:-}"
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || usage
[[ "${2:-}" == "" || "${2:-}" == "--tag" ]] || usage
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
version="${tag#v}"
manifest_version="$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' "$root/library.json" | head -n 1)"
if [[ "$manifest_version" != "$version" ]]; then
echo "library.json is $manifest_version; expected $version for $tag" >&2
exit 1
fi
if [[ -f "$root/library.properties" ]]; then
properties_version="$(sed -n 's/^version=//p' "$root/library.properties" | head -n 1)"
if [[ "$properties_version" != "$version" ]]; then
echo "library.properties is $properties_version; expected $version for $tag" >&2
exit 1
fi
fi
package_dir="$(mktemp -d)"
trap 'rm -rf "$package_dir"' EXIT
pio pkg pack "$root" --output "$package_dir/package.tar.gz" >/dev/null
echo "Validated PlatformIO package for $tag"
if [[ "${2:-}" == "--tag" ]]; then
git -C "$root" diff --quiet
git -C "$root" diff --cached --quiet
git -C "$root" tag -a "$tag" -m "Release $tag"
echo "Created $tag. Push the branch and tag; GitHub Actions will publish the release."
fi
+1 -1
View File
@@ -82,7 +82,7 @@ HADevice::~HADevice()
delete _serializer;
if (_availabilityTopic) {
delete _availabilityTopic;
delete[] _availabilityTopic;
}
if (_ownsUniqueId) {
+8
View File
@@ -582,6 +582,10 @@ void HABaseDeviceType::configureAvailabilityEntries(HASerializer* serializer) co
if (useList) {
auto* entry = serializer->addEntry();
if (!entry) {
return;
}
entry->type = HASerializer::AvailabilityArrayEntryType;
entry->subtype = 0;
entry->property = AHATOFSTR(HAAvailabilityListProperty);
@@ -590,6 +594,10 @@ void HABaseDeviceType::configureAvailabilityEntries(HASerializer* serializer) co
}
auto* e = serializer->addEntry();
if (!e) {
return;
}
e->type = HASerializer::TopicEntryType;
e->subtype = 0;
e->property = AHATOFSTR(HAAvailabilityTopic);
+1 -1
View File
@@ -47,7 +47,7 @@ HADeviceTrigger::HADeviceTrigger(TriggerType type, TriggerSubtype subtype) :
HADeviceTrigger::~HADeviceTrigger()
{
if (_uniqueId) {
delete _uniqueId;
delete[] _uniqueId;
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ HASelect::~HASelect()
if (optionsNb > 1) {
for (uint8_t i = 0; i < optionsNb; i++) {
delete options[i];
delete[] options[i];
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ HASensor::~HASensor()
if (optionsNb > 1) {
for (uint8_t i = 0; i < optionsNb; i++) {
delete options[i];
delete[] options[i];
}
}
+39 -1
View File
@@ -6,6 +6,7 @@
#endif
#include "HASerializer.h"
#include <new>
#include "../ArduinoHADefines.h"
#include "../HADevice.h"
#include "../HAMqtt.h"
@@ -182,6 +183,10 @@ void HASerializer::set(
}
SerializerEntry* entry = addEntry();
if (!entry) {
return;
}
entry->type = PropertyEntryType;
entry->subtype = static_cast<uint8_t>(valueType);
entry->property = property;
@@ -192,6 +197,10 @@ void HASerializer::set(const FlagType flag)
{
if (flag == WithDevice || flag == WithUniqueId) {
SerializerEntry* entry = addEntry();
if (!entry) {
return;
}
entry->type = FlagEntryType;
entry->subtype = static_cast<uint8_t>(flag);
entry->property = nullptr;
@@ -210,13 +219,42 @@ void HASerializer::topic(const __FlashStringHelper* topic)
}
SerializerEntry* entry = addEntry();
if (!entry) {
return;
}
entry->type = TopicEntryType;
entry->property = topic;
}
HASerializer::SerializerEntry* HASerializer::addEntry()
{
return &_entries[_entriesNb++]; // intentional lack of protection against overflow
if (_entriesNb >= _maxEntriesNb) {
if (_maxEntriesNb == UINT8_MAX) {
return nullptr;
}
uint16_t expandedCapacity = _maxEntriesNb == 0 ? 4 : _maxEntriesNb * 2;
if (expandedCapacity > UINT8_MAX) {
expandedCapacity = UINT8_MAX;
}
SerializerEntry* expandedEntries =
new (std::nothrow) SerializerEntry[expandedCapacity];
if (!expandedEntries) {
return nullptr;
}
for (uint8_t i = 0; i < _entriesNb; i++) {
expandedEntries[i] = _entries[i];
}
delete[] _entries;
_entries = expandedEntries;
_maxEntriesNb = static_cast<uint8_t>(expandedCapacity);
}
return &_entries[_entriesNb++];
}
uint16_t HASerializer::calculateSize() const