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.
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.
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
### 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])
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.
7E,06,08,FF,01,50,02,50,03,50,04,50,E7
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))
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
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
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
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})
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.
Users browsing this forum: No registered users and 2 guests