Browse Source

add setunset command to set the state of a channel.. useful for testing..

irr_shared
John-Mark Gurney 3 years ago
parent
commit
bf5934f693
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      lora.py

+ 5
- 1
lora.py View File

@@ -48,6 +48,7 @@ CMD_TERMINATE = 1 # no args: terminate the sesssion, reply confirms
CMD_WAITFOR = 2 # arg: (length): waits for length seconds
CMD_RUNFOR = 3 # arg: (chan, length): turns on chan for length seconds
CMD_PING = 4 # arg: (): a no op command
CMD_SETUNSET = 5 # arg: (chan, val): sets chan to val

class LORANode(object):
'''Implement a LORANode initiator.'''
@@ -121,6 +122,9 @@ class LORANode(object):
async def runfor(self, chan, length):
return await self._sendcmd(CMD_RUNFOR, chan, length)

async def setunset(self, chan, val):
return await self._sendcmd(CMD_SETUNSET, chan, val)

async def ping(self):
return await self._sendcmd(CMD_PING)

@@ -285,7 +289,7 @@ async def main():

await l.start()

valid_cmds = { 'waitfor', 'runfor', 'ping', 'terminate', }
valid_cmds = { 'waitfor', 'setunset', 'runfor', 'ping', 'terminate', }

cmdargs = list(args.args)
while cmdargs:


Loading…
Cancel
Save