Simple Serial Plugin - just to use for debugging

Pool / Spa Integration - Ain't life, and Indigo, GREAT when you can turn on the spa from the restaurant, and it's ready when you get home!
hamw
Posts: 1246
Joined: Mon Mar 31, 2008 7:45 pm

Re: Simple Serial Plugin - just to use for debugging

Post by hamw »

I wonder if you could rename the plug-in and therefore create a new instance? Not exactly the same as handling multiple devices, but would have the same effect.
User avatar
matt (support)
Site Admin
Posts: 21476
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Simple Serial Plugin - just to use for debugging

Post by matt (support) »

You can clone plugins to create additional instances of them, but note you need to edit the plugin's Contents/Info.plist file so that both the CFBundleDisplayName and CFBundleIdentifier are unique for the clone. Also note that devices, actions, etc. created by the clone will be in their own sandbox and will only be accessible/usable by the clone. That is, the original plugin won't recognize them since they have a different plugin creator ID. Give what is needed here, that should be fine.
Image
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Hi Wiery

Have entered the code but are getting the error below, any ideas?

17 Jan 2015 19:04:49
Script Error embedded script: [Errno 35] Resource temporarily unavailable: '/dev/cu.usbserial-A602B3P0'
Script Error Exception Traceback (most recent call shown last):

embedded script, line 15, at top level
File "/Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app/Contents/PlugIns/serial/serialutil.py", line 296, in __init__
self.open()
File "/Library/Application Support/Perceptive Automation/Indigo 6/IndigoPluginHost.app/Contents/PlugIns/serial/serialposix.py", line 295, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK | os.O_EXLOCK)
OSError: [Errno 35] Resource temporarily unavailable: '/dev/cu.usbserial-A602B3P0'
wiery
Posts: 288
Joined: Mon Jun 02, 2008 2:52 am
Location: Ireland
Contact:

Re: Simple Serial Plugin - just to use for debugging

Post by wiery »

It sounds like coolterm is also open, close it down to free up the serial port
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Thanks Wiery it was the Simple Serial Plugin holding the serial port, is there a way I can receive code back?


Sent from my iPad using Tapatalk
wiery
Posts: 288
Joined: Mon Jun 02, 2008 2:52 am
Location: Ireland
Contact:

Re: Simple Serial Plugin - just to use for debugging

Post by wiery »

It depends on the device, does coolterm give a response ? If it does then yes, I think it just needs slight mod to the code. My Somfy RTS don't respond so didn't need it
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Yes when I use coolterm and call for a status update then I get a response


Sent from my iPad using Tapatalk
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Hi Jim

Im getting these messages in the event log but the amplifier doesn't respond, any ideas? :? :(


Action Group new action group
Simple Serial Plugin Debug Queue has 1 command(s) waiting.
Simple Serial Plugin Debug Processing command: REQ88C
Simple Serial Plugin Debug Sending command:REQ88C
Schedule Update Time/Date/Day
Simple Serial Plugin Response from serial device (text): , of length 0 characters
Simple Serial Plugin Debug Decimal string is
Simple Serial Plugin Debug Hex string is
Simple Serial Plugin Debug REQ88C

Thank you

Keith
yergeyj
Posts: 260
Joined: Wed Dec 29, 2004 7:30 am

Re: Simple Serial Plugin - just to use for debugging

Post by yergeyj »

Keith (and others),

First, apologies for not seeing this on the forum, as I hadn’t seen any traffic on this plugin page for quite some time.

So, to send a command so that the plugin will respond, you need to embed the python code in an Action Item directed at the plugin, similar to the example on the main plugin page:

Code: Select all

simpleSerialId = indigo.server.getPlugin("org.yergeyjDoesntHaveaURL.simpleserial")
if simpleSerialId.isEnabled():
   simpleSerialId.executeAction("hexToSerial", deviceId=577450175, props={"newCommand":"23, 50, 55, 4D, 50, 3F”})
Also, you have to translate the hex command into Ascii as above. For the hex code example you sent me in a PM (\x52\x45\x51\x38\x38\x43\x00\x00\x33\x0F\x00\x20\x20\xFF), the right command would be “52, 45, 51, 38, 38, 43, 00, 00, 33, 0F, 00, 20, 20” - and unfortunately, if the “\xFF” is required at the end, the plugin as currently implemented will not work, as it uses extensive Ascii character manipulations and anything higher than 7F cannot be handled (per the help page entry for revision 0.9.4).

Because this has come up with several folks who have tried the plugin, I'm going to have a look at implementing a version that does not require Ascii-only commands.

Jim
yergeyj
Posts: 260
Joined: Wed Dec 29, 2004 7:30 am

Re: Simple Serial Plugin - just to use for debugging

Post by yergeyj »

Version 0.9.5 is now available, and DOES {finally) support hexadecimal commands and responses using the full Extended ASCII character set (00 through FF).

Please send a PM with your e-mail address if you would like a copy.

Jim
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Hi Jim

I have just noticed that the trigger from last Hex command is not working even when i copy the received code from the log. It does when when i use “has any change” but when you use “last response hex” becomes equal to” i get no trigger. This will be handy to update a variable.
Thank you
Keith


Sent from my iPad using Tapatalk
yergeyj
Posts: 260
Joined: Wed Dec 29, 2004 7:30 am

Re: Simple Serial Plugin - just to use for debugging

Post by yergeyj »

Ksullivan wrote:Hi Jim

I have just noticed that the trigger from last Hex command is not working even when i copy the received code from the log. It does when when i use “has any change” but when you use “last response hex” becomes equal to” i get no trigger. This will be handy to update a variable.
Thank you
Keith
Sent from my iPad using Tapatalk
Keith,

Below is what my Trigger main page looks like for a hexadecimal state change "Becomes Equal to." Unfortunately, you can’t see the whole text field without scrolling within it. When creating a Trigger, be careful not to include any spaces before or after, and no quotes in the text field for comparison.

I expect you realize this, but just to be sure, note that if you copy from the log, and then enter a command that responds back with the same value, it won’t trigger for “Becomes Equal to" as the value hasn’t changed. You have to force a different value, and then resend the command that gives the response that will initiate the trigger.

Jim
Attachments
Trigger for Simple Serial %22Last Response%22 State Change.png
Trigger for Simple Serial %22Last Response%22 State Change.png (25.6 KiB) Viewed 18486 times
Ksullivan
Posts: 83
Joined: Sat Feb 22, 2014 5:02 pm

Re: Simple Serial Plugin - just to use for debugging

Post by Ksullivan »

Thanks Jim all sorted


Sent from my iPad using Tapatalk
Vig
Posts: 111
Joined: Tue Oct 06, 2015 8:09 am

Re: Simple Serial Plugin - just to use for debugging

Post by Vig »

This might be a dumb question but what variable is responsible for setting this device state that will show On/Off under the State column in Indigo?

thanks,
Vig
yergeyj
Posts: 260
Joined: Wed Dec 29, 2004 7:30 am

Re: Simple Serial Plugin - just to use for debugging

Post by yergeyj »

Vig wrote:This might be a dumb question but what variable is responsible for setting this device state that will show On/Off under the State column in Indigo?

thanks,
Vig
Vig,

First, sorry I didn't see this post until today! I had checked in a few weeks back to see if there were any new questions, but somehow missed your post.

In answer, there is no state displayed for a device set up with the Simple Serial Plugin (it's simple :wink: ). That said, you can tell the state simply from the text color of the device linked to the plugin. Note that you can enable/disable communication between a device and Indigo using an option-click.

Plugin Enabled, Device Communication with Indigo Enabled: Device will appear in black text
Plugin Disabled, Device Communication with Indigo Enabled: Device will appear in red text
Plugin Enabled or Disabled, Device Communication with Indigo Disabled: Device will appear in gray text

I have used this to set up multiple devices with the Simple Serial Plugin, and then only had one of them with "enabled communication" with Indigo.

Hope this helps,
Jim
Post Reply

Return to “Yergey's Forum”