mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Add recommended actions to NINA (#83775)
This commit is contained in:
parent
d4f69a3652
commit
5990bd7ca3
@ -57,6 +57,7 @@ class NinaWarningData:
|
|||||||
description: str
|
description: str
|
||||||
sender: str
|
sender: str
|
||||||
severity: str
|
severity: str
|
||||||
|
recommended_actions: str
|
||||||
sent: str
|
sent: str
|
||||||
start: str
|
start: str
|
||||||
expires: str
|
expires: str
|
||||||
@ -134,6 +135,7 @@ class NINADataUpdateCoordinator(
|
|||||||
raw_warn.description,
|
raw_warn.description,
|
||||||
raw_warn.sender,
|
raw_warn.sender,
|
||||||
raw_warn.severity,
|
raw_warn.severity,
|
||||||
|
" ".join([str(action) for action in raw_warn.recommended_actions]),
|
||||||
raw_warn.sent or "",
|
raw_warn.sent or "",
|
||||||
raw_warn.start or "",
|
raw_warn.start or "",
|
||||||
raw_warn.expires or "",
|
raw_warn.expires or "",
|
||||||
|
@ -18,6 +18,7 @@ from .const import (
|
|||||||
ATTR_EXPIRES,
|
ATTR_EXPIRES,
|
||||||
ATTR_HEADLINE,
|
ATTR_HEADLINE,
|
||||||
ATTR_ID,
|
ATTR_ID,
|
||||||
|
ATTR_RECOMMENDED_ACTIONS,
|
||||||
ATTR_SENDER,
|
ATTR_SENDER,
|
||||||
ATTR_SENT,
|
ATTR_SENT,
|
||||||
ATTR_SEVERITY,
|
ATTR_SEVERITY,
|
||||||
@ -92,6 +93,7 @@ class NINAMessage(CoordinatorEntity[NINADataUpdateCoordinator], BinarySensorEnti
|
|||||||
ATTR_DESCRIPTION: data.description,
|
ATTR_DESCRIPTION: data.description,
|
||||||
ATTR_SENDER: data.sender,
|
ATTR_SENDER: data.sender,
|
||||||
ATTR_SEVERITY: data.severity,
|
ATTR_SEVERITY: data.severity,
|
||||||
|
ATTR_RECOMMENDED_ACTIONS: data.recommended_actions,
|
||||||
ATTR_ID: data.id,
|
ATTR_ID: data.id,
|
||||||
ATTR_SENT: data.sent,
|
ATTR_SENT: data.sent,
|
||||||
ATTR_START: data.start,
|
ATTR_START: data.start,
|
||||||
|
@ -19,6 +19,7 @@ ATTR_HEADLINE: str = "headline"
|
|||||||
ATTR_DESCRIPTION: str = "description"
|
ATTR_DESCRIPTION: str = "description"
|
||||||
ATTR_SENDER: str = "sender"
|
ATTR_SENDER: str = "sender"
|
||||||
ATTR_SEVERITY: str = "severity"
|
ATTR_SEVERITY: str = "severity"
|
||||||
|
ATTR_RECOMMENDED_ACTIONS: str = "recommended_actions"
|
||||||
ATTR_ID: str = "id"
|
ATTR_ID: str = "id"
|
||||||
ATTR_SENT: str = "sent"
|
ATTR_SENT: str = "sent"
|
||||||
ATTR_START: str = "start"
|
ATTR_START: str = "start"
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"valueName": "instructionCode",
|
"valueName": "instructionCode",
|
||||||
"value": "BBK-ISC-132"
|
"value": "BBK-ISC-082"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"valueName": "sender_langname",
|
"valueName": "sender_langname",
|
||||||
|
@ -10,6 +10,7 @@ from homeassistant.components.nina.const import (
|
|||||||
ATTR_EXPIRES,
|
ATTR_EXPIRES,
|
||||||
ATTR_HEADLINE,
|
ATTR_HEADLINE,
|
||||||
ATTR_ID,
|
ATTR_ID,
|
||||||
|
ATTR_RECOMMENDED_ACTIONS,
|
||||||
ATTR_SENDER,
|
ATTR_SENDER,
|
||||||
ATTR_SENT,
|
ATTR_SENT,
|
||||||
ATTR_SEVERITY,
|
ATTR_SEVERITY,
|
||||||
@ -69,6 +70,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||||||
)
|
)
|
||||||
assert state_w1.attributes.get(ATTR_SENDER) == "Deutscher Wetterdienst"
|
assert state_w1.attributes.get(ATTR_SENDER) == "Deutscher Wetterdienst"
|
||||||
assert state_w1.attributes.get(ATTR_SEVERITY) == "Minor"
|
assert state_w1.attributes.get(ATTR_SEVERITY) == "Minor"
|
||||||
|
assert state_w1.attributes.get(ATTR_RECOMMENDED_ACTIONS) == ""
|
||||||
assert state_w1.attributes.get(ATTR_ID) == "mow.DE-NW-BN-SE030-20201014-30-000"
|
assert state_w1.attributes.get(ATTR_ID) == "mow.DE-NW-BN-SE030-20201014-30-000"
|
||||||
assert state_w1.attributes.get(ATTR_SENT) == "2021-10-11T05:20:00+01:00"
|
assert state_w1.attributes.get(ATTR_SENT) == "2021-10-11T05:20:00+01:00"
|
||||||
assert state_w1.attributes.get(ATTR_START) == "2021-11-01T05:20:00+01:00"
|
assert state_w1.attributes.get(ATTR_START) == "2021-11-01T05:20:00+01:00"
|
||||||
@ -85,6 +87,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||||||
assert state_w2.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w2.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w2.attributes.get(ATTR_SENDER) is None
|
assert state_w2.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w2.attributes.get(ATTR_SEVERITY) is None
|
assert state_w2.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w2.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w2.attributes.get(ATTR_ID) is None
|
assert state_w2.attributes.get(ATTR_ID) is None
|
||||||
assert state_w2.attributes.get(ATTR_SENT) is None
|
assert state_w2.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w2.attributes.get(ATTR_START) is None
|
assert state_w2.attributes.get(ATTR_START) is None
|
||||||
@ -101,6 +104,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||||||
assert state_w3.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w3.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w3.attributes.get(ATTR_SENDER) is None
|
assert state_w3.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w3.attributes.get(ATTR_SEVERITY) is None
|
assert state_w3.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w3.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w3.attributes.get(ATTR_ID) is None
|
assert state_w3.attributes.get(ATTR_ID) is None
|
||||||
assert state_w3.attributes.get(ATTR_SENT) is None
|
assert state_w3.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w3.attributes.get(ATTR_START) is None
|
assert state_w3.attributes.get(ATTR_START) is None
|
||||||
@ -117,6 +121,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||||||
assert state_w4.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w4.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w4.attributes.get(ATTR_SENDER) is None
|
assert state_w4.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w4.attributes.get(ATTR_SEVERITY) is None
|
assert state_w4.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w4.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w4.attributes.get(ATTR_ID) is None
|
assert state_w4.attributes.get(ATTR_ID) is None
|
||||||
assert state_w4.attributes.get(ATTR_SENT) is None
|
assert state_w4.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w4.attributes.get(ATTR_START) is None
|
assert state_w4.attributes.get(ATTR_START) is None
|
||||||
@ -133,6 +138,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
|||||||
assert state_w5.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w5.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w5.attributes.get(ATTR_SENDER) is None
|
assert state_w5.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w5.attributes.get(ATTR_SEVERITY) is None
|
assert state_w5.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w5.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w5.attributes.get(ATTR_ID) is None
|
assert state_w5.attributes.get(ATTR_ID) is None
|
||||||
assert state_w5.attributes.get(ATTR_SENT) is None
|
assert state_w5.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w5.attributes.get(ATTR_START) is None
|
assert state_w5.attributes.get(ATTR_START) is None
|
||||||
@ -176,6 +182,10 @@ async def test_sensors_without_corona_filter(hass: HomeAssistant) -> None:
|
|||||||
)
|
)
|
||||||
assert state_w1.attributes.get(ATTR_SENDER) == ""
|
assert state_w1.attributes.get(ATTR_SENDER) == ""
|
||||||
assert state_w1.attributes.get(ATTR_SEVERITY) == "Minor"
|
assert state_w1.attributes.get(ATTR_SEVERITY) == "Minor"
|
||||||
|
assert (
|
||||||
|
state_w1.attributes.get(ATTR_RECOMMENDED_ACTIONS)
|
||||||
|
== "Es besteht keine Gefahr."
|
||||||
|
)
|
||||||
assert state_w1.attributes.get(ATTR_ID) == "mow.DE-BW-S-SE018-20211102-18-001"
|
assert state_w1.attributes.get(ATTR_ID) == "mow.DE-BW-S-SE018-20211102-18-001"
|
||||||
assert state_w1.attributes.get(ATTR_SENT) == "2021-11-02T20:07:16+01:00"
|
assert state_w1.attributes.get(ATTR_SENT) == "2021-11-02T20:07:16+01:00"
|
||||||
assert state_w1.attributes.get(ATTR_START) == ""
|
assert state_w1.attributes.get(ATTR_START) == ""
|
||||||
@ -195,6 +205,7 @@ async def test_sensors_without_corona_filter(hass: HomeAssistant) -> None:
|
|||||||
)
|
)
|
||||||
assert state_w2.attributes.get(ATTR_SENDER) == "Deutscher Wetterdienst"
|
assert state_w2.attributes.get(ATTR_SENDER) == "Deutscher Wetterdienst"
|
||||||
assert state_w2.attributes.get(ATTR_SEVERITY) == "Minor"
|
assert state_w2.attributes.get(ATTR_SEVERITY) == "Minor"
|
||||||
|
assert state_w2.attributes.get(ATTR_RECOMMENDED_ACTIONS) == ""
|
||||||
assert state_w2.attributes.get(ATTR_ID) == "mow.DE-NW-BN-SE030-20201014-30-000"
|
assert state_w2.attributes.get(ATTR_ID) == "mow.DE-NW-BN-SE030-20201014-30-000"
|
||||||
assert state_w2.attributes.get(ATTR_SENT) == "2021-10-11T05:20:00+01:00"
|
assert state_w2.attributes.get(ATTR_SENT) == "2021-10-11T05:20:00+01:00"
|
||||||
assert state_w2.attributes.get(ATTR_START) == "2021-11-01T05:20:00+01:00"
|
assert state_w2.attributes.get(ATTR_START) == "2021-11-01T05:20:00+01:00"
|
||||||
@ -211,6 +222,7 @@ async def test_sensors_without_corona_filter(hass: HomeAssistant) -> None:
|
|||||||
assert state_w3.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w3.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w3.attributes.get(ATTR_SENDER) is None
|
assert state_w3.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w3.attributes.get(ATTR_SEVERITY) is None
|
assert state_w3.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w3.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w3.attributes.get(ATTR_ID) is None
|
assert state_w3.attributes.get(ATTR_ID) is None
|
||||||
assert state_w3.attributes.get(ATTR_SENT) is None
|
assert state_w3.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w3.attributes.get(ATTR_START) is None
|
assert state_w3.attributes.get(ATTR_START) is None
|
||||||
@ -227,6 +239,7 @@ async def test_sensors_without_corona_filter(hass: HomeAssistant) -> None:
|
|||||||
assert state_w4.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w4.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w4.attributes.get(ATTR_SENDER) is None
|
assert state_w4.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w4.attributes.get(ATTR_SEVERITY) is None
|
assert state_w4.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w4.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w4.attributes.get(ATTR_ID) is None
|
assert state_w4.attributes.get(ATTR_ID) is None
|
||||||
assert state_w4.attributes.get(ATTR_SENT) is None
|
assert state_w4.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w4.attributes.get(ATTR_START) is None
|
assert state_w4.attributes.get(ATTR_START) is None
|
||||||
@ -243,6 +256,7 @@ async def test_sensors_without_corona_filter(hass: HomeAssistant) -> None:
|
|||||||
assert state_w5.attributes.get(ATTR_DESCRIPTION) is None
|
assert state_w5.attributes.get(ATTR_DESCRIPTION) is None
|
||||||
assert state_w5.attributes.get(ATTR_SENDER) is None
|
assert state_w5.attributes.get(ATTR_SENDER) is None
|
||||||
assert state_w5.attributes.get(ATTR_SEVERITY) is None
|
assert state_w5.attributes.get(ATTR_SEVERITY) is None
|
||||||
|
assert state_w5.attributes.get(ATTR_RECOMMENDED_ACTIONS) is None
|
||||||
assert state_w5.attributes.get(ATTR_ID) is None
|
assert state_w5.attributes.get(ATTR_ID) is None
|
||||||
assert state_w5.attributes.get(ATTR_SENT) is None
|
assert state_w5.attributes.get(ATTR_SENT) is None
|
||||||
assert state_w5.attributes.get(ATTR_START) is None
|
assert state_w5.attributes.get(ATTR_START) is None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user