1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Add support for sequence ID to publish action in ntfy integration (#161342)

This commit is contained in:
Manu
2026-01-21 18:41:46 +01:00
committed by GitHub
parent 493319894b
commit a6e7546142
7 changed files with 22 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ ATTR_ICON = "icon"
ATTR_MARKDOWN = "markdown"
ATTR_PRIORITY = "priority"
ATTR_TAGS = "tags"
ATTR_SEQUENCE_ID = "sequence_id"
SERVICE_PUBLISH_SCHEMA = cv.make_entity_service_schema(
{
@@ -60,6 +61,7 @@ SERVICE_PUBLISH_SCHEMA = cv.make_entity_service_schema(
vol.Optional(ATTR_EMAIL): vol.Email(),
vol.Optional(ATTR_CALL): cv.string,
vol.Optional(ATTR_ICON): vol.All(vol.Url(), vol.Coerce(URL)),
vol.Optional(ATTR_SEQUENCE_ID): cv.string,
}
)

View File

@@ -88,3 +88,8 @@ publish:
type: url
autocomplete: url
example: https://example.org/logo.png
sequence_id:
required: false
selector:
text:
example: "Mc3otamDNcpJ"

View File

@@ -1,6 +1,7 @@
{
"common": {
"add_topic_description": "Set up a topic for notifications.",
"sequence_id": "Sequence ID",
"topic": "Topic"
},
"config": {
@@ -171,6 +172,9 @@
"icon": { "name": "Icon" },
"message": { "name": "Message" },
"priority": { "name": "Priority" },
"sequence_id": {
"name": "[%key:component::ntfy::common::sequence_id%]"
},
"tags": { "name": "Tags" },
"time": { "name": "Time" },
"title": { "name": "Title" },
@@ -356,6 +360,10 @@
"description": "All messages have a priority that defines how urgently your phone notifies you, depending on the configured vibration patterns, notification sounds, and visibility in the notification drawer or pop-over.",
"name": "Message priority"
},
"sequence_id": {
"description": "Enter a message or sequence ID to update an existing notification, or specify a sequence ID to reference later when updating, clearing (mark as read and dismiss), or deleting a notification.",
"name": "[%key:component::ntfy::common::sequence_id%]"
},
"tags": {
"description": "Add tags or emojis to the notification. Emojis (using shortcodes like smile) will appear in the notification title or message. Other tags will be displayed below the notification content.",
"name": "Tags/Emojis"

View File

@@ -57,6 +57,7 @@ def mock_aiontfy() -> Generator[AsyncMock]:
actions=[],
attachment=None,
content_type=None,
sequence_id="Mc3otamDNcpJ",
)
resp.to_dict.return_value = {
@@ -74,6 +75,7 @@ def mock_aiontfy() -> Generator[AsyncMock]:
"actions": [],
"attachment": None,
"content_type": None,
"sequence_id": "Mc3otamDNcpJ",
}
async def mock_ws(

View File

@@ -59,6 +59,7 @@
'id': 'h6Y2hKA5sy0U',
'message': 'Hello',
'priority': 3,
'sequence_id': 'Mc3otamDNcpJ',
'tags': list([
'octopus',
]),

View File

@@ -101,6 +101,7 @@ async def test_event(
"time": datetime(2025, 3, 28, 17, 58, 46, tzinfo=UTC),
"title": "Title",
"topic": "mytopic",
"sequence_id": "Mc3otamDNcpJ",
}

View File

@@ -22,6 +22,7 @@ from homeassistant.components.ntfy.notify import (
ATTR_ICON,
ATTR_MARKDOWN,
ATTR_PRIORITY,
ATTR_SEQUENCE_ID,
ATTR_TAGS,
SERVICE_PUBLISH,
)
@@ -60,6 +61,7 @@ async def test_ntfy_publish(
ATTR_MARKDOWN: True,
ATTR_PRIORITY: "5",
ATTR_TAGS: ["partying_face", "grin"],
ATTR_SEQUENCE_ID: "Mc3otamDNcpJ",
},
blocking=True,
)
@@ -76,6 +78,7 @@ async def test_ntfy_publish(
markdown=True,
icon=URL("https://example.org/logo.png"),
delay="86430.0s",
sequence_id="Mc3otamDNcpJ",
)
)