Set default name for KNX outgoing telegram source (#124439)

This commit is contained in:
Matthias Alphart 2024-08-28 12:31:30 +02:00 committed by GitHub
parent 10b3119b4a
commit 41e66edd14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from xknx import XKNX
from xknx.dpt import DPTArray, DPTBase, DPTBinary
from xknx.dpt.dpt import DPTComplexData, DPTEnumData
from xknx.exceptions import XKNXException
from xknx.telegram import Telegram
from xknx.telegram import Telegram, TelegramDirection
from xknx.telegram.apci import GroupValueResponse, GroupValueWrite
from homeassistant.core import HomeAssistant
@ -119,6 +119,8 @@ class Telegrams:
device := self.project.devices.get(f"{telegram.source_address}")
) is not None:
src_name = f"{device['manufacturer_name']} {device['name']}"
elif telegram.direction is TelegramDirection.OUTGOING:
src_name = "Home Assistant"
if isinstance(telegram.payload, (GroupValueWrite, GroupValueResponse)):
payload_data = telegram.payload.value.value

View File

@ -39,7 +39,7 @@ MOCK_TELEGRAMS = [
"dpt_name": None,
"payload": [1, 2, 3, 4],
"source": "0.0.0",
"source_name": "",
"source_name": "Home Assistant",
"telegramtype": "GroupValueWrite",
"timestamp": MOCK_TIMESTAMP,
"unit": None,