Simple Serial Plugin - just to use for debugging
Re: Simple Serial Plugin - just to use for debugging
Two questions. First, can I get this plugin? I have a Hayward/Goldline system I'm trying to control.
Second, where can I get SerialX? Couldn't find it on the web.
Second, where can I get SerialX? Couldn't find it on the web.
David Clonts
Re: Simple Serial Plugin - just to use for debugging
Jim I need some help.
Here is some code I added:
### Log response - this plugin does not parse or do anything with the response, but it's still called decodeResponse.
### May have more than one item in response string, even if sending command
def decodeResponse(self, devId, responseString, commDirection):
stringLen = len(responseString)
indigo.server.log("Response from XXX device: " + responseString + ", of length " + str(stringLen) + " characters")
if responseString[0:2]=="01":
command = " 08 "+responseString[3:7]+" "
queueSerialCommand(self, command, dev)
indigo.variable.updateValue("Switch",responseString[3:7])
The red line is where I am failing. When I receive from my device a response beginning with "01" I need to send a command to get additional response. How can I que or send the line formatted as "command" to the serial device.
Thanks
Richard
Here is some code I added:
### Log response - this plugin does not parse or do anything with the response, but it's still called decodeResponse.
### May have more than one item in response string, even if sending command
def decodeResponse(self, devId, responseString, commDirection):
stringLen = len(responseString)
indigo.server.log("Response from XXX device: " + responseString + ", of length " + str(stringLen) + " characters")
if responseString[0:2]=="01":
command = " 08 "+responseString[3:7]+" "
queueSerialCommand(self, command, dev)
indigo.variable.updateValue("Switch",responseString[3:7])
The red line is where I am failing. When I receive from my device a response beginning with "01" I need to send a command to get additional response. How can I que or send the line formatted as "command" to the serial device.
Thanks
Richard
Re: Simple Serial Plugin - just to use for debugging
Sure, per the original post, just send me a PM with your e-mail address and I will send you the plugin in it's current form (0.9.2 as of 9-Dec).dclonts wrote:Two questions. First, can I get this plugin? I have a Hayward/Goldline system I'm trying to control.
Second, where can I get SerialX? Couldn't find it on the web.
Sorry, should have referred to SerialPortX:
http://alteredhorizons.infiniteserve.co ... cSoft.html
Jim
Last edited by yergeyj on Fri Dec 09, 2011 5:09 pm, edited 1 time in total.
Re: Simple Serial Plugin - just to use for debugging
Richard,dfiedler wrote:Jim I need some help.
Here is some code I added:
### Log response - this plugin does not parse or do anything with the response, but it's still called decodeResponse.
### May have more than one item in response string, even if sending command
def decodeResponse(self, devId, responseString, commDirection):
stringLen = len(responseString)
indigo.server.log("Response from XXX device: " + responseString + ", of length " + str(stringLen) + " characters")
if responseString[0:2]=="01":
command = " 08 "+responseString[3:7]+" "
queueSerialCommand(self, command, dev)
indigo.variable.updateValue("Switch",responseString[3:7])
The red line is where I am failing. When I receive from my device a response beginning with "01" I need to send a command to get additional response. How can I que or send the line formatted as "command" to the serial device.
Thanks
Richard
I think it's just a python syntax error on the queueSerialCommand call:
Code: Select all
### Log response - this plugin does not parse or do anything with the response, but it's still called decodeResponse.
### May have more than one item in response string, even if sending command
def decodeResponse(self, devId, responseString, commDirection):
stringLen = len(responseString)
indigo.server.log("Response from XXX device: " + responseString + ", of length " + str(stringLen) + " characters")
if responseString[0:2]=="01":
command = " 08 "+responseString[3:7]+" "
self.queueSerialCommand(command, dev)
indigo.variable.updateValue("Switch",responseString[3:7])
Jim
Re: Simple Serial Plugin - just to use for debugging
Jim,
I need some flexibility with the command output. It would be nice if the command was a variable that could reformatted as needed instead of hard coded. I see you have some scripting support but I don't understand these values like deviceId or props.
" simpleSerialId.executeAction("textToSerial", deviceId=1842531032, props={"newCommand":"#PUMP?"})"
What would be nice is if I could establish when creating the plugin what the name of the variable containing the output string is.
I need some flexibility with the command output. It would be nice if the command was a variable that could reformatted as needed instead of hard coded. I see you have some scripting support but I don't understand these values like deviceId or props.
" simpleSerialId.executeAction("textToSerial", deviceId=1842531032, props={"newCommand":"#PUMP?"})"
What would be nice is if I could establish when creating the plugin what the name of the variable containing the output string is.
Re: Simple Serial Plugin - just to use for debugging
All,
I've updated the simple serial plugin to have a few "states," which are just the most recent response presented in three formats - text, decimal and hexadecimal, providing an easy way to access the responses without having to dig into the python coding. Note, however, that if your serial device is sending information in a relatively continuous basis, only the most recent will be stored in the state information.
Hope this helps those who were looking for access to the response.
As noted in the main post, if you would like an updated version, please send me a PM, with your e-mail address.
Jim
I've updated the simple serial plugin to have a few "states," which are just the most recent response presented in three formats - text, decimal and hexadecimal, providing an easy way to access the responses without having to dig into the python coding. Note, however, that if your serial device is sending information in a relatively continuous basis, only the most recent will be stored in the state information.
Hope this helps those who were looking for access to the response.
As noted in the main post, if you would like an updated version, please send me a PM, with your e-mail address.
Jim
Re: Simple Serial Plugin - just to use for debugging
RESOLVED I have the plugin changing my dmx lighting!
Hi all,
I've got Indio talking to my enttec serial dmx lighting controller using jims pluggin. The indigo log is stating:
I presume all is well above?
I am sending Hand calculated hex data as follows:
Is my serial device connected?
If so, presumably my data being transmitted is incorrect? The data I want to send (excluding the control information) is (in decimal) 1, 80, 2, 80, 3, 80, 4, 80 - not the full string shown in the manfacturers example.
I'm not sure I have the 3rd (data length) argument correct!? Is the new line char interfering?
This is my first attempt at serial communications since the early 80's, so any pointers would be most welcome.
Thanks
Mat
Hi all,
I've got Indio talking to my enttec serial dmx lighting controller using jims pluggin. The indigo log is stating:
Code: Select all
Simple Serial Plugin Debug <<-- entering deviceStopComm, Device: serialdeviceDMX; ID=205500296, Type=simpleSerialCommunicator
Simple Serial Plugin Debug Initiating stop of concurrent thread.
Simple Serial Plugin Debug exiting deviceStopComm -->>
Simple Serial Plugin Debug <<-- entering deviceStartComm, Device: serialdeviceDMX; ID=205500296, Type=simpleSerialCommunicator
Simple Serial Plugin Debug Serial Port Name is /dev/cu.usbserial-EN095395
Simple Serial Plugin Debug Serial Port Baud Rate is 57600
Simple Serial Plugin Debug Serial Port Parity is N
Simple Serial Plugin Debug Serial Port Data Bits are 8
Simple Serial Plugin Debug Serial Port Stops Bits are 1
Simple Serial Plugin Debug Device name is serialdeviceDMX
Simple Serial Plugin Debug Started concurrent thread.
Simple Serial Plugin Debug exiting deviceStartComm -->>
Simple Serial Plugin Debug Starting concurrent serial communications.I am sending Hand calculated hex data as follows:
This is based on the following code from manufacturers:7E,06,08,FF,01,50,02,50,03,50,04,50,E7
I have tried the plugin on all options for the EOL commands, but get the following error after a reboot:OUTPUT_ONLY_SEND_DMX_LABEL = 6
SOM_VALUE = 0x7E
EOM_VALUE = 0xE7
def test_dmx_send():
print "Sending 512 DMX data bytes: 00 01 02 ... FF 00 01 02 ... FF"
int_data = [0] + range(0,256) + range(0,256)
msg_data = [chr(int_data[j]) for j in range(len(int_data))]
transmit_to_widget(OUTPUT_ONLY_SEND_DMX_LABEL, msg_data, len(msg_data))
def transmit_to_widget(label, data, data_size):
ser.write(chr(SOM_VALUE))
ser.write(chr(label))
ser.write(chr(data_size & 0xFF))
ser.write(chr((data_size >>& 0xFF))
for j in range(data_size):
ser.write(data[j])
ser.write(chr(EOM_VALUE))
Two questions, plus a couple of minor ones if anyone could assist please:Trigger serial test
Simple Serial Plugin Debug Queue has 1 command(s) waiting.
Error XML Parse Error: not well-formed
Error On character 188 of line number 1.
Error XML Parse Error: not well-formed
Error On character 184 of line number 1.
Simple Serial Plugin Response from serial device (text): , of length 0 characters
Error XML Parse Error: not well-formed
Error On character 168 of line number 1.
Simple Serial Plugin Debug Decimal string is
Simple Serial Plugin Debug Decimal string is
Is my serial device connected?
If so, presumably my data being transmitted is incorrect? The data I want to send (excluding the control information) is (in decimal) 1, 80, 2, 80, 3, 80, 4, 80 - not the full string shown in the manfacturers example.
I'm not sure I have the 3rd (data length) argument correct!? Is the new line char interfering?
This is my first attempt at serial communications since the early 80's, so any pointers would be most welcome.
Thanks
Mat
Last edited by mat on Sun Jan 08, 2012 5:17 pm, edited 2 times in total.
Late 2018 mini 10.14
Re: Simple Serial Plugin - just to use for debugging
Deleted - additional information to resolved post above.
Thanks Jim, I've have the plugin talking to my enttec USB pro dmx lighting controller.
Thanks Jim, I've have the plugin talking to my enttec USB pro dmx lighting controller.
Late 2018 mini 10.14
Re: Simple Serial Plugin - just to use for debugging
Jim,
Are we able to use your plugin as a template to create purpose specific plugins please? I'm not sure of the etiquette on such matters? As well as knowing no python at this point in time!
I have the plugin controlling my dmx lighting, but it's only sending serial information every three seconds or so. Ideally I would like to remove all of the built in "sleeps" and periods where it is waiting for a response from the serial device as the dmx lights can be changed up to 850 times a second (not that I need anywhere near that speed, nor do I thinking will get it!). The controller is only used in single way communication.
Thanks again.
Mat
Are we able to use your plugin as a template to create purpose specific plugins please? I'm not sure of the etiquette on such matters? As well as knowing no python at this point in time!
I have the plugin controlling my dmx lighting, but it's only sending serial information every three seconds or so. Ideally I would like to remove all of the built in "sleeps" and periods where it is waiting for a response from the serial device as the dmx lights can be changed up to 850 times a second (not that I need anywhere near that speed, nor do I thinking will get it!). The controller is only used in single way communication.
Thanks again.
Mat
Late 2018 mini 10.14
Re: Simple Serial Plugin - just to use for debugging
Mat,mat wrote:Jim,
Are we able to use your plugin as a template to create purpose specific plugins please? I'm not sure of the etiquette on such matters? As well as knowing no python at this point in time!
I have the plugin controlling my dmx lighting, but it's only sending serial information every three seconds or so. Ideally I would like to remove all of the built in "sleeps" and periods where it is waiting for a response from the serial device as the dmx lights can be changed up to 850 times a second (not that I need anywhere near that speed, nor do I thinking will get it!). The controller is only used in single way communication.
Thanks again.
Mat
You are perfectly welcome to use the Simple Serial Plugin as a starting point to develop your own device-specific plugin.
This plugin was in fact only created to help folks get started, and for very simple testing, as I had a number of difficulties with my own plugin and thought it might help.
Enjoy.
Jim
Re: Simple Serial Plugin - just to use for debugging
Thanks Jim, I'll have a look and see what I can do!
Late 2018 mini 10.14
Re: Simple Serial Plugin - just to use for debugging
Hi Jim,
Just a note to say a big thanks.
I've amended the plug in to allow control over 4 Dmx channels, and can send somewhere over 30 sets of hex data per second.
I've still not mastered the data for the enttec dmx pro. I think I've got to resolve the least significant bit and most significant bit data correctly, as well as the data Len, ....... I'm calling the plugin three times for each dmx change, which actually speeds things up ..... A very nasty hack! It may be because I've removed all the time.waits so data isn't queuing as well as the data reads, but it's working at a great speed. I'll play more when I have time.
BUT I have achieved what I set out to do.
I have iTunes play a 2 minute thunderstorm sound effect with my dmx lighting flashing lightening in time with the thunder claps ala rainforest cafe!
Thanks once again for the great work and inspiration. I just need some time to refine what I've done!
Mat
Just a note to say a big thanks.
I've amended the plug in to allow control over 4 Dmx channels, and can send somewhere over 30 sets of hex data per second.
I've still not mastered the data for the enttec dmx pro. I think I've got to resolve the least significant bit and most significant bit data correctly, as well as the data Len, ....... I'm calling the plugin three times for each dmx change, which actually speeds things up ..... A very nasty hack! It may be because I've removed all the time.waits so data isn't queuing as well as the data reads, but it's working at a great speed. I'll play more when I have time.
BUT I have achieved what I set out to do.
I have iTunes play a 2 minute thunderstorm sound effect with my dmx lighting flashing lightening in time with the thunder claps ala rainforest cafe!
Thanks once again for the great work and inspiration. I just need some time to refine what I've done!
Mat
Late 2018 mini 10.14
Adapt AppleScript for Simple Serial Plugin
My WHA matrix switch is controlled with Serial Bridge. The Indigo Touch app will change the value of a variable for either source or volume. The variable change activates a trigger to execute the attached zone specific script. Each zone therefore uses two identical scripts- one triggered when the volume changes and one when the source changes - for a total of 16 scripts exectued by 16 triggers. The system works very well to date.
It's really just the product of the first line, vauxCommand, that needs to be sent. I was thinking that instead of directly sending vauxCommand, it could be put into an Indigo variable that then triggers a Python script to Simple Serial Plugin. However, seems like that would slow down the processing of multiple sends, like multizone global volume adjustments. Any ideas as to how would one rewrite the script in Python so they can send directly to SSP?
It's really just the product of the first line, vauxCommand, that needs to be sent. I was thinking that instead of directly sending vauxCommand, it could be put into an Indigo variable that then triggers a Python script to Simple Serial Plugin. However, seems like that would slow down the processing of multiple sends, like multizone global volume adjustments. Any ideas as to how would one rewrite the script in Python so they can send directly to SSP?
Code: Select all
set vauxCommand to "*CW,15,1," & value of variable "audio_1_source" & "," & "1" & "," & value of variable "audio_1_volume" & "
"
tell application "Serial Bridge"
set connectionName to "Vaux"
send to source connectionName string vauxCommand
end tell
if value of variable "audio_1_source" is "0" then
set value of variable "audio_1_source_name" to "Off"
end if
if value of variable "audio_1_source" is "1" then
set value of variable "audio_1_source_name" to "Tuner"
end if
if value of variable "audio_1_source" is "2" then
set value of variable "audio_1_source_name" to "iTunPan"
end if
if value of variable "audio_1_source" is "3" then
set value of variable "audio_1_source_name" to "Pool iPod"
end if
if value of variable "audio_1_source" is "4" then
set value of variable "audio_1_source_name" to "Cable"
end if
if value of variable "audio_1_source" is "5" then
set value of variable "audio_1_source_name" to ""
end if
if value of variable "audio_1_source" is "6" then
set value of variable "audio_1_source_name" to ""
end if
if value of variable "audio_1_source" is "7" then
set value of variable "audio_1_source_name" to ""
end if
if value of variable "audio_1_source" is "8" then
set value of variable "audio_1_source_name" to ""
end if
- jay (support)
- Site Admin
- Posts: 19232
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Simple Serial Plugin - just to use for debugging
According to the docs, it would be something like this:
Untested of course but that should get you 98% of the way there.
Code: Select all
simpleSerialId = indigo.server.getPlugin("org.yergeyjDoesntHaveaURL.simpleserial")
if simpleSerialId.isEnabled():
message = "*CW,15,1,%s,1,%s\n" % (indigo.variables["audio_1_source"].value, indigo.variables["audio_1_volume"].value)
simpleSerialId.executeAction("textToSerial", deviceId=1842531032, props={"newCommand":message})Re: Simple Serial Plugin - just to use for debugging
Jim, your plugin works really well, and Jay, your code sample was what I needed to get started - thank you for the excellent support as always. I have the scripts updated and functional, but like Mat need faster response with a "no debugging" option. It would be nice to receive the serial response codes back, though.mat wrote:Jim,
I have the plugin controlling my dmx lighting, but it's only sending serial information every three seconds or so. Ideally I would like to remove all of the built in "sleeps" and periods where it is waiting for a response from the serial device as the dmx lights can be changed up to 850 times a second (not that I need anywhere near that speed, nor do I thinking will get it!). The controller is only used in single way communication.
Jim or Mat, could you forward me an updated speedy copy of the plugin "not just for debugging"?
BTW you might have to change the name of this to "SUPER Serial Plugin"!