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:
@@ -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,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -88,3 +88,8 @@ publish:
|
||||
type: url
|
||||
autocomplete: url
|
||||
example: https://example.org/logo.png
|
||||
sequence_id:
|
||||
required: false
|
||||
selector:
|
||||
text:
|
||||
example: "Mc3otamDNcpJ"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
'id': 'h6Y2hKA5sy0U',
|
||||
'message': 'Hello',
|
||||
'priority': 3,
|
||||
'sequence_id': 'Mc3otamDNcpJ',
|
||||
'tags': list([
|
||||
'octopus',
|
||||
]),
|
||||
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user