Closed siddharthkhandelwal1 closed 2 years ago
Thanks for opening your first issue here! đ
đ Be sure to:
1. đ Have a look at the Wiki and README for information
2. đ Search for similar issues (open and closed)
3. âī¸ Provide enough information to understand, recreate and help out with your problem
4. âšī¸ Let us know if you find a solution
5. đ Close the issue when your problem has been solved
The web interface has a terminal if you mean that.
When i read this comment i see more of like an access via API. I could see all kinds of fun use cases for it with automation, and it would really allow this to interface with anything and allow people to code against it in their language of choice. A fun random example that pops into my mind is one that unlocks my computer when i get home and locks it when i leave.
Here's a python script that runs /myscript on the duck using websockets:
import asyncio
from websockets import connect
uri = "ws://192.168.4.1/ws"
async def wifiduck_run(script):
async with connect(uri) as websocket:
await websocket.send(f"run {script}")
await websocket.recv()
asyncio.run(wifiduck_run("/myscript"))
I think other websocket clients would probably work similarly, but I haven't tested them. Search script.js for calls to ws_send for other ideas.
Thank you for posting that @jstorrs I was able to get it to work. Being able to write or update a script on the fly would be the other piece that would be very handy to have in the tool bag. Looks like there is a function "create" and "write" that would be useful.
After a few minutes playing around i was able to get this to work. I did run into issues with spaces and new lines until i did this.
data = """STRING 123
STRING 456
"""
and
await websocket.send(f'write {script} "{data}"')
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.