View unanswered posts | View active topics It is currently Sat May 25, 2013 12:20 pm



Reply to topic  [ 23 posts ]  Go to page: 1, 2  Next
 Server Socket API 
Author Message

Joined: Oct 06, 2006
Posts: 60
Post Server Socket API
Greetings Matt B!
It has been awhile, but I am back tinkering with my flex api (apache flex 4.8 came out yesterday).

From a previous thread on the matter:
viewtopic.php?f=9&t=3045&start=150&hilit=getdevicelist

<Packet><Type>Request</Type><Name>GetVariableList</Name></Packet>
<Packet><Type>Request</Type><Name>GetTDTriggerList</Name></Packet>
<Packet><Type>Request</Type><Name>GetTriggerList</Name></Packet>
<Packet><Type>Request</Type><Name>GetActionGroupList</Name></Packet>
<Packet><Type>Request</Type><Name>GetDeviceList</Name></Packet>


The Request packets for GetTDTriggerList and GetTDTriggerList no longer seem to return any data packets...

Can you tell me the Request packet names I need to send in order to get Triggers and Schedules from the server over a socket connection?

Thanks!
Matthew


Tue Jul 24, 2012 6:56 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
Hi Matthew,

Try GetEventTriggerList and GetEventScheduleList instead.

_________________
Image


Tue Jul 24, 2012 9:44 am
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Matt,
I'll try this out when I get home from work and post my results back here.
Thanks for the quick reply!

Matthew


Tue Jul 24, 2012 11:13 am
Profile

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
That works great, thanks Matt!

The xml data still comes back formatted as Trigger and TDTrigger, as before, for anyone else who cares.

Cheers!,
Matthew


Wed Jul 25, 2012 6:52 pm
Profile

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Hey Matt,
To continue with the category of "things that used to work but no longer seem to"...

I used to connect the Indigo cocoa client to the local Indigo server, then connect my flash (socket) api to the server and I would see Broadcast packets from the server. For example, the native cocoa client would cause a device to update, a broadcast packet would be sent out, and my flash api would see the broadcast packet.

I don't see Broadcast packets coming from the server (to the flash api) anymore. The only packets I do see coming in are the responses to my specific requests, such as GetDeviceList. Is there a specific packet request I can make in order to receive Broadcast packets? I am interested in receiving the log stream and any updates to the items in the requested lists (devices, variables, action groups, triggers, schedules).

Thanks a ton for your help! I really appreciate your efforts.

Regards,
Matthew


Thu Aug 02, 2012 7:33 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
Try sending this packet after you connect to the server:

Code: Select all
   <Packet type="dict">
      <Type type="string">Command</Type>
      <Target type="string">Server</Target>
      <Name type="string">SubscribeToServerBroadcasts</Name>
      <Data type="vector">
         <Name type="string">AddedDevice</Name>
         <Name type="string">RemovedDevice</Name>
         <Name type="string">ReplacedDevice</Name>
         <Name type="string">AddedTrigger</Name>
         <Name type="string">RemovedTrigger</Name>
         <Name type="string">ReplacedTrigger</Name>
         <Name type="string">AddedTDTrigger</Name>
         <Name type="string">RemovedTDTrigger</Name>
         <Name type="string">ReplacedTDTrigger</Name>
         <Name type="string">AddedVariable</Name>
         <Name type="string">RemovedVariable</Name>
         <Name type="string">ReplacedVariable</Name>
         <Name type="string">LogStream</Name>
      </Data>
   </Packet>

_________________
Image


Thu Aug 02, 2012 12:47 pm
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Thanks again Matt! That worked great. :lol:

I am making a flex library called as3Indigo that can use either the Indigo socket or RESTful API to provide Indigo data and control to Flex/ActionScript projects. In addition I am creating a small AIR application called as3Indigo_explorer to demonstrate the library's capabilities.

I will share my progress with you when things are a bit more polished.

Thanks for all your help! Been loving me some Indigo since 2006! :mrgreen:

Matthew


Fri Aug 03, 2012 3:04 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
Sounds good -- glad that got it working, and looking forward to seeing the AIR app!

_________________
Image


Fri Aug 03, 2012 8:53 pm
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Hey Matt,
The socket api is almost complete, including the UI to go with in the explorer app. I only need 3 things, namely the command packets to do the actual work of (1) controlling a device (2) changing a variable and (3) triggering an action group. (I want to stay at parity with the restful api and it looks like these 3 control operations are what we can do there.)

This packet is no longer working:
<Packet type="dict">
<Type type="string">Command</Type>
<Name type="string">TurnOn</Name>
<Data type="string">den fixture</Data>
</Packet>

Indigo does respond with an IllegalParameterError packet however... I am sure you're familiar with its contents given the packet above?

Thanks in advance!
Matthew


Mon Aug 06, 2012 3:42 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
Try:

Code: Select all
<Packet type="dict">
   <Type type="string">Command</Type>
   <Target type="string">Server</Target>
   <Name type="string">TurnOn</Name>
   <Data type="dict">
      <ID type="integer">123456</ID>
      <Name type="string">bedroom lamps</Name>
   </Data>
</Packet>

In the Data node you should be able to user either the ID or Name. Just omit the one you don't want to use.

_________________
Image


Tue Aug 07, 2012 8:32 am
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Excellent,
I will apply these changes tonight...

What is this part:
<Name type="string">TurnOn</Name>

For setting a variable value? For triggering an action group?

I have all this code on github and will be happy to add you to my repo anytime! Feel free to send me a PM for the details.

Thanks!
Matthew


Tue Aug 07, 2012 11:49 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
I don't think they changed. Let me know if they don't work and I can dig up the new commands.

_________________
Image


Tue Aug 07, 2012 12:15 pm
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Attached is a picture of the current UI.
Attachment:
File comment: Screenshot of as3Indigo_explorer beta
Screen Shot 2012-08-16 at 5.33.27 PM.jpg
Screen Shot 2012-08-16 at 5.33.27 PM.jpg [ 109.29 KiB | Viewed 1504 times ]


I still need the command name for setting a variable value and for triggering an action group. When I have those I will be pretty close to functional complete, albeit only with the socket API implemented.

Next steps:
I need to implement the RESTful api.
I need to clean up some code behind the scenes.
I need to add options to the UI.

Matthew


Thu Aug 16, 2012 3:47 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11698
Location: Texas
Post Re: Server Socket API
Neat -- it is good to see the progress.

For setting a variable value try:

Code: Select all
    <Packet type="dict">
       <Type type="string">Command</Type>
       <Target type="string">Server</Target>
       <Name type="string">SetVariableValue</Name>
       <Data type="dict">
          <ID type="integer">123456</ID>
          <Name type="string">or some var name (don't need if you use ID)</Name>
       </Data>
    </Packet>

And for Action Group execution:

Code: Select all
    <Packet type="dict">
       <Type type="string">Command</Type>
       <Target type="string">Server</Target>
       <Name type="string">ExecuteActionGroup</Name>
       <Data type="dict">
          <ID type="integer">123456</ID>
          <Name type="string">or some group name (don't need if you use ID)</Name>
       </Data>
    </Packet>

_________________
Image


Fri Aug 17, 2012 1:16 pm
Profile WWW

Joined: Oct 06, 2006
Posts: 60
Post Re: Server Socket API
Is there a Value parameter for the SetVariableValue command?

Code: Select all
    <Packet type="dict">
       <Type type="string">Command</Type>
       <Target type="string">Server</Target>
       <Name type="string">SetVariableValue</Name>
       <Data type="dict">
          <ID type="integer">123456</ID>
          <Name type="string">or some var name (don't need if you use ID)</Name>
          <Value type="string">false</Value>
       </Data>
    </Packet>


Mon Aug 20, 2012 9:01 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 23 posts ]  Go to page: 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.