Last active
January 5, 2020 11:29
-
-
Save asquelt/021df672ab0e5732d14f7139dbdd38bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import eiscp,sys,xmltodict | |
receivers = {} | |
for rec in sys.argv[1:]: | |
receiver = eiscp.eISCP(rec) | |
receivers[rec] = xmltodict.parse( receiver.raw('MDIQSTN')[3:] )['mdi'] | |
print('Receivers group info by IP:') | |
print(receivers) | |
cmd = [] | |
if len(sys.argv) > 2: | |
gid = 1 | |
else: | |
gid = 0 | |
cmd.append('<mgs zone="1"><groupid>'+str(gid)+'</groupid>') | |
if len(sys.argv) > 2: | |
cmd.append('<maxdelay>500</maxdelay><devices>') | |
for rec in sys.argv[2:]: | |
cmd.append('<device id="'+receivers[rec]['deviceid']+'" zoneid="1"/>') | |
if len(sys.argv) > 2: | |
cmd.append('</devices>') | |
cmd.append('</mgs>') | |
print('Command to be sent:') | |
print(''.join(cmd)) | |
for rec in [sys.argv[1]]: | |
receiver = eiscp.eISCP(rec) | |
try: | |
out = receiver.raw('MGS'+''.join(cmd)) | |
except: | |
print('Timeout here, but works') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment