Page 5 of 7

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat May 12, 2012 8:44 am
by hamw
I shortened the timeouts so the plugin executes immediately - really useful. Now I'm trying to set a variable value and, when changed, execute a trigger to send a command to SSP. I tried modifying Jay's script above but keep getting errors.The command I'm trying to send is *cw,68,1,31
Any suggestions?

Code: Select all
simpleSerialId = indigo.server.getPlugin("org.yergeyjDoesntHaveaURL.simpleserial")
if simpleSerialId.isEnabled():
   message = (indigo.variable["direct_Vaux_Send"].value)
   simpleSerialId.executeAction("textToSerial", deviceId=775789076, props={"newCommand":message})


also tried this:

simpleSerialId = indigo.server.getPlugin("org.yergeyjDoesntHaveaURL.simpleserial")
if simpleSerialId.isEnabled():
   message = "%s\n" % (indigo.variable["direct_Vaux_Send"].value)
   simpleSerialId.executeAction("textToSerial", deviceId=775789076, props={"newCommand":message})



Error messages:
for the first trial:
Script Error embedded script: 'VariableCmds' object is unsubscriptable
Script Error Exception Traceback (most recent call shown last):

embedded script, line 3, at top level
TypeError: 'VariableCmds' object is unsubscriptable


for the second:
Script Error around line 3 - "message = "%\n" % (indigo.variable["direct_Vaux_Send"].value)simpleSerialId.executeAction("textToSerial", deviceId=775789076, props={"newCommand":message})"

Thanks!

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat May 12, 2012 10:36 am
by jay (support)
To get a variable, use indigo.variables[ID] (not it's variables not variable):

Code: Select all
simpleSerialId = indigo.server.getPlugin("org.yergeyjDoesntHaveaURL.simpleserial")
if simpleSerialId.isEnabled():
   message = (indigo.variables["direct_Vaux_Send"].value)
   simpleSerialId.executeAction("textToSerial", deviceId=775789076, props={"newCommand":message})


And I HIGHLY recommend using the ID rather than the name so that if the name changes the script will continue to work...

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat May 12, 2012 4:01 pm
by hamw
All working great. Thanks again for a super plugin!

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sun May 13, 2012 2:08 am
by mat
I've email my version, with all of the timeouts removed and responce code removed.

My alterations to the plugin ignore any timings or responses thus making it fast, but not necessarily useful for everyone. I need no feedback from the port. The dmx controller that I'm using accepts commands faster than the "unrestricted" pluging can send data and have never noticed it missing a command yet.

I only use hex to save a couple of nanoseconds (I guess) to speed up further, so started removing some of the other code too, but I've not fully cleaned it up as I suspect there a very few people with the same dmx controller as me, and even fewer that want to use indigo to control it.

Cheers

Mat

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Mon Oct 01, 2012 11:12 am
by Korey
Any progress on having multiple devices (ports) available in Indigo?

Hoping to use a 4 port Keyspan USA49WG. for RS232 control of AV components.

currently running Plugin Version 0.9.3 to control 1 device.

Thanks for a great Plugin!

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Wed Oct 03, 2012 3:46 pm
by yergeyj
Korey wrote:
Any progress on having multiple devices (ports) available in Indigo?

Hoping to use a 4 port Keyspan USA49WG. for RS232 control of AV components.

currently running Plugin Version 0.9.3 to control 1 device.

Thanks for a great Plugin!


Korey,

Sorry, at this juncture I do not plan to add anything additional to the Simple Serial Plugin v 0.9.3, as it was intended as just that, a "simple" plugin.

I had been doing a lot of work trying to get serial communications operating, and created this plugin just to check communications before working on a far more complicated plugin. it seemed like something worth sharing, but I really only updated it to a point that it was "operational."

Again, sorry,
Jim

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Mon Feb 11, 2013 1:16 pm
by 4billl
yergeyj -
I tried using Simple Serial v0.93 with Indigo 6.0.0b5. I just installed it as a plugin and set up a DEVICE using an FTDI USB - serial convertor. Then I added a TRIGGER to get it to send. It seems to work with the lower half of ASCII (up to 127 or 0x7F) just fine, using text, decimal, or hexadecimal .
But when I tried to send anything above 0x7F using the send hexadecimal command, it either gives me an "XML Parse Error: not well-formed", or locks up Indigo 6 to the point that I have to reboot the MAC in order to restart the server.

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Tue Feb 12, 2013 5:40 pm
by yergeyj
4billl wrote:
yergeyj -
I tried using Simple Serial v0.93 with Indigo 6.0.0b5. I just installed it as a plugin and set up a DEVICE using an FTDI USB - serial convertor. Then I added a TRIGGER to get it to send. It seems to work with the lower half of ASCII (up to 127 or 0x7F) just fine, using text, decimal, or hexadecimal .
But when I tried to send anything above 0x7F using the send hexadecimal command, it either gives me an "XML Parse Error: not well-formed", or locks up Indigo 6 to the point that I have to reboot the MAC in order to restart the server.


First, I've never tried sending any serial commands with non-ASCII characters, so I'll have to do a bit of research. I was however, able to reproduce the "XML Parse error," although in my case (running Indigo 6.0.0.b5) the command just terminated at the error.

I'll keep looking and try to get back soon.

Jim

P.S. I've released version 0.9.4 that catches and exits if decimal or hexadecimal values greater than 127 or 7F, respectively are entered, as the current code makes extensive use of character strings that cannot readily handle the use of extended ASCII characters. Sorry folks.

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Fri Jan 16, 2015 3:51 pm
by Ksullivan
Hi Jim
I have installed your plugin but cannot get it to work. I can get it to send a command but nothing happens. If I send the code using cool term then the amplifier responds.
I'm using Hex code as supplied by the manual.
Any help would be gratefully received.

Keith


Sent from my iPad using Tapatalk

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Fri Jan 16, 2015 6:16 pm
by wiery
might be easier to do it via a bit of python code, i do that for somfy transmitter, works well for sending hex

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Fri Jan 16, 2015 10:24 pm
by hamw
can this plugin control more than one device at a time? Haven't tried, but if I ever move on AV control, serial would be useful to allow full feedback for a pre/pro etc.

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat Jan 17, 2015 3:11 am
by Ksullivan
Hi Wiery

Still a novice so some help with the Python code would be great if you could

Keith


Sent from my iPad using Tapatalk

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat Jan 17, 2015 3:54 am
by wiery
hamw wrote:
can this plugin control more than one device at a time? Haven't tried, but if I ever move on AV control, serial would be useful to allow full feedback for a pre/pro etc.


Not sure but probably not as you define the device parameters in the main configuration and you select the serial device.

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat Jan 17, 2015 3:55 am
by wiery
Ksullivan wrote:
Hi Wiery

Still a novice so some help with the Python code would be great if you could

Keith


Sent from my iPad using Tapatalk



Keith, just match up your settings from cool term and you should be good to go and change the serialCommand to whatever you want. It needs to be wrapped in double quotes and each 2 characters escaped with \x as below.

# Import Python modules.
import serial
import time

# Command to send to the serial device.
serialCommand = "\x7F\xF2\xFA\x16\x69\xFA\x00\x00\x00\xFB\xFD\x05\xDC"

# Connection details for the serial port. Opens the port immediately.
ser = serial.Serial(
port='/dev/tty.usbserial-FTVQV0YG',
baudrate=4800,
timeout=0, # Increase this if timing is too low to get a response.
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
)

# Write the command to the serial port
ser.write(serialCommand)

# Close the serial port.
ser.close()

Re: Simple Serial Plugin - just to use for debugging

PostPosted: Sat Jan 17, 2015 6:16 am
by Ksullivan
Thanks I'll give a try

Keith


Sent from my iPad using Tapatalk