Simple Serial Plugin - just to use for debugging

Posted on
Sat May 12, 2012 8:44 am
hamw offline
Posts: 1043
Joined: Mar 31, 2008

Re: Simple Serial Plugin - just to use for debugging

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!

Posted on
Sat May 12, 2012 10:36 am
jay (support) offline
Site Admin
User avatar
Posts: 13067
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Simple Serial Plugin - just to use for debugging

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...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat May 12, 2012 4:01 pm
hamw offline
Posts: 1043
Joined: Mar 31, 2008

Re: Simple Serial Plugin - just to use for debugging

All working great. Thanks again for a super plugin!

Posted on
Sun May 13, 2012 2:08 am
mat offline
Posts: 518
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Simple Serial Plugin - just to use for debugging

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

mini 10.11.6 and indigo 7.02

Posted on
Mon Oct 01, 2012 11:12 am
Korey offline
User avatar
Posts: 427
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Simple Serial Plugin - just to use for debugging

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!
Attachments
Screen Shot 2012-10-01 at 11.58.37 AM.PNG
Screen Shot 2012-10-01 at 11.58.37 AM.PNG (79.25 KiB) Viewed 4270 times

--
Korey

Posted on
Wed Oct 03, 2012 3:46 pm
yergeyj offline
Posts: 259
Joined: Dec 29, 2004

Re: Simple Serial Plugin - just to use for debugging

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

Posted on
Mon Feb 11, 2013 1:16 pm
4billl offline
Posts: 50
Joined: Jan 30, 2013
Location: Dripping Springs TX

Re: Simple Serial Plugin - just to use for debugging

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.

Posted on
Tue Feb 12, 2013 5:40 pm
yergeyj offline
Posts: 259
Joined: Dec 29, 2004

Re: Simple Serial Plugin - just to use for debugging

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.

Posted on
Fri Jan 16, 2015 3:51 pm
Ksullivan offline
Posts: 61
Joined: Feb 22, 2014

Re: Simple Serial Plugin - just to use for debugging

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

Posted on
Fri Jan 16, 2015 6:16 pm
wiery offline
Posts: 287
Joined: Jun 02, 2008
Location: Ireland

Re: Simple Serial Plugin - just to use for debugging

might be easier to do it via a bit of python code, i do that for somfy transmitter, works well for sending hex

Posted on
Fri Jan 16, 2015 10:24 pm
hamw offline
Posts: 1043
Joined: Mar 31, 2008

Re: Simple Serial Plugin - just to use for debugging

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.

Posted on
Sat Jan 17, 2015 3:11 am
Ksullivan offline
Posts: 61
Joined: Feb 22, 2014

Re: Simple Serial Plugin - just to use for debugging

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

Posted on
Sat Jan 17, 2015 3:54 am
wiery offline
Posts: 287
Joined: Jun 02, 2008
Location: Ireland

Re: Simple Serial Plugin - just to use for debugging

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.

Posted on
Sat Jan 17, 2015 3:55 am
wiery offline
Posts: 287
Joined: Jun 02, 2008
Location: Ireland

Re: Simple Serial Plugin - just to use for debugging

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()

Posted on
Sat Jan 17, 2015 6:16 am
Ksullivan offline
Posts: 61
Joined: Feb 22, 2014

Re: Simple Serial Plugin - just to use for debugging

Thanks I'll give a try

Keith


Sent from my iPad using Tapatalk

Who is online

Users browsing this forum: No registered users and 0 guests