"""Example on how to connect to restart a KNX device."""
import asyncio
import sys

from xknx import XKNX
from xknx.telegram import IndividualAddress, Telegram
from xknx.telegram.apci import Restart


async def main(argv: list[str]):
    """Restart a KNX device."""
    if len(argv) != 2:
        print(f"{argv[0]}: missing target address.")
        return 1

    address = IndividualAddress(argv[1])

    xknx = XKNX()
    await xknx.start()

    await xknx.telegrams.put(Telegram(address, payload=Restart()))
    await asyncio.sleep(2)

    await xknx.stop()


if __name__ == "__main__":
    asyncio.run(main(sys.argv))

@@ -113,51 +113,47 @@
 knx.
-telegram import IndividualAddress, Telegram
+management.procedures import dm_restart
 %0Afro
@@ -171,21 +171,16 @@
 gram
-.apci
  import 
 Rest
@@ -175,23 +175,33 @@
  import 
-Restart
+IndividualAddress
 %0A%0A%0Aasync
@@ -404,161 +404,73 @@
     
-xknx = XKNX()%0A    await xknx.start()%0A%0A
+async with XKNX() as xknx:%0A   
     
+ 
 await 
-xknx.telegrams.put(Telegram(address, payload=Restart()))%0A    await asyncio.sleep(2)%0A%0A    await xknx.stop(
+dm_restart(xknx, address
 )%0A%0A%0A

use management procedure in restart example