Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source_address in Telegram() #516

Merged
merged 9 commits into from
Nov 29, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

## Unreleased changes

### HA integration

- knx_event: add `source` attribute
marvin-w marked this conversation as resolved.
Show resolved Hide resolved

### Internals

- Telegram: `group_address` renamed to `destination_address`, to prepare support for other APCI services.
- Telegram: `group_address` renamed to `destination_address`, to prepare support for other APCI services and add `source_address`
- Farewell Travis CI; Welcome Github Actions!

## 0.15.6 Bugfix for StateUpater 2020-11-26
Expand Down
8 changes: 6 additions & 2 deletions examples/example_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ async def main():
await tunnel.connect_udp()
await tunnel.connect()

await tunnel.send_telegram(Telegram(GroupAddress("1/0/15"), payload=DPTBinary(1)))
await tunnel.send_telegram(
Telegram(destination_address=GroupAddress("1/0/15"), payload=DPTBinary(1))
)
await asyncio.sleep(2)
await tunnel.send_telegram(Telegram(GroupAddress("1/0/15"), payload=DPTBinary(0)))
await tunnel.send_telegram(
Telegram(destination_address=GroupAddress("1/0/15"), payload=DPTBinary(0))
)
await asyncio.sleep(2)

await tunnel.connectionstate()
Expand Down
1 change: 1 addition & 0 deletions home-assistant-plugin/custom_components/xknx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ async def telegram_received_cb(self, telegram):
{
"address": str(telegram.destination_address),
"data": telegram.payload.value,
"source": str(telegram.source_address),
marvin-w marked this conversation as resolved.
Show resolved Hide resolved
},
)

Expand Down
4 changes: 3 additions & 1 deletion test/devices_tests/binary_sensor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ def test_process_wrong_payload(self):
"""Test process wrong telegram (wrong payload type)."""
xknx = XKNX()
binary_sensor = BinarySensor(xknx, "Warning", group_address_state="1/2/3")
telegram = Telegram(GroupAddress("1/2/3"), payload=DPTArray((0x1, 0x2, 0x3)))
telegram = Telegram(
destination_address=GroupAddress("1/2/3"), payload=DPTArray((0x1, 0x2, 0x3))
)
with self.assertRaises(CouldNotParseTelegram):
self.loop.run_until_complete(binary_sensor.process(telegram))

Expand Down
Loading