-
Notifications
You must be signed in to change notification settings - Fork 58
pyscript equivalent to HA yaml "mode: queued" #478
-
I'm new to HA, and even newer to pyscript.
After fighting with automations, bash scripts and nc/netcat so that HA can talk to my devices (two of which are multizone amplifiers, one a receiver), I've just discovered pyscript and import telnet. Relief :-)
I have one significant thing I can't find a pyscript solution for. I use the HA yaml "mode: queued" to ensure that only one HA action is telneting with one of my devices at any one time. It is simple to use. Is there a pyscript equivalent please ?
Thanks.
David
Beta Was this translation helpful? Give feedback.
All reactions
First, you should be using asynctelnet
instead of the vanilla telnet
module to avoid blocking.
To ensure your telnet I/O is serialized among multiple callers, you should use asyncio.Lock()
, or one of the other async synchronization primitives. See #340 for an example.
Replies: 1 comment
-
First, you should be using asynctelnet
instead of the vanilla telnet
module to avoid blocking.
To ensure your telnet I/O is serialized among multiple callers, you should use asyncio.Lock()
, or one of the other async synchronization primitives. See #340 for an example.
Beta Was this translation helpful? Give feedback.