XKNX / xknx

XKNX - A KNX library written in Python

Home Page:http://xknx.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Several xknx daemons

mralessio opened this issue · comments

commented

For my use case I need to monitor more than one KNX/IP connections (separate lines) and periodically send the telegrams.
Is it possible to establish several tunneling connections to different KNX/IP interfaces with deamon_mode=True at the same time?
Thanks for help

Not sure if daemon_mode works with multiple connections. Maybe in separate asyncio tasks. Just try it out.
Otherwise you can just call start() and stop() for every of your XKNX instance in a custom function where you wait for sigint.

commented

Unfortunately, it doesn't. Next XKNX daemon will not start until the previous one has not finished.
Not sure that just start / stop would work for me in the full scope, as I need to monitor connections constantly.

Daemon mode doesn't do anything else than calling start() and waiting for sigint.

async def loop_until_sigint(self) -> None:

Have you put your instances in Tasks? That should not block...

But it's probably a good idea to write a custom supervisor for your usecase. If Xknx would raise in daemon mode it would also return (quit) - this can eg. Happen on unsuccessful first Connection attempt.

commented

Thank you for the giving the idea. I just have started using Python recently for knx purposes. I will try to implement.