Merge from old Gitea
This commit is contained in:
26
examples/power.py
Normal file
26
examples/power.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import asyncio
|
||||
import time
|
||||
from esasdk import Machine
|
||||
|
||||
async def main():
|
||||
# Connect to a machine
|
||||
machine = Machine("ws://localhost:5424")
|
||||
await machine.connect()
|
||||
|
||||
# Get machine power
|
||||
power = await machine.power()
|
||||
print(f"Machine Power (Volts): {power}")
|
||||
|
||||
# Get machine power source
|
||||
powerSource = await machine.power_source()
|
||||
print(f"Machine Power Source: {powerSource}")
|
||||
|
||||
# Set machine power timer - TODO: cpp response for this call.
|
||||
powerTimer = await machine.poweroff_timer_enable(False)
|
||||
print(f"Machine Power Timer: {powerTimer}")
|
||||
|
||||
# Close connection
|
||||
await machine.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user