Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pyscript equivalent to HA yaml "mode: queued" #478

Answered by craigbarratt
dy-nz asked this question in General
Discussion options

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

You must be logged in to vote

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

Comment options

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.

You must be logged in to vote
0 replies
Answer selected by dy-nz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /