Server Socket API

Posted on
Tue Jul 24, 2012 6:56 am
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Tue Jul 24, 2012 9:44 am
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Server Socket API

Hi Matthew,

Try GetEventTriggerList and GetEventScheduleList instead.

Image

Posted on
Tue Jul 24, 2012 11:13 am
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Wed Jul 25, 2012 6:52 pm
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Thu Aug 02, 2012 7:33 am
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Thu Aug 02, 2012 12:47 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

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

Posted on
Fri Aug 03, 2012 3:04 pm
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Fri Aug 03, 2012 8:53 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: Server Socket API

Sounds good -- glad that got it working, and looking forward to seeing the AIR app!

Image

Posted on
Mon Aug 06, 2012 3:42 pm
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Tue Aug 07, 2012 8:32 am
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

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

Posted on
Tue Aug 07, 2012 11:49 am
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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

Posted on
Tue Aug 07, 2012 12:15 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

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

Posted on
Thu Aug 16, 2012 3:47 pm
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

Re: Server Socket API

Attached is a picture of the current UI.
Screen Shot 2012-08-16 at 5.33.27 PM.jpg
Screenshot of as3Indigo_explorer beta
Screen Shot 2012-08-16 at 5.33.27 PM.jpg (109.29 KiB) Viewed 5718 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

Posted on
Fri Aug 17, 2012 1:16 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

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

Posted on
Mon Aug 20, 2012 9:01 pm
mreyn2005 offline
User avatar
Posts: 161
Joined: Oct 06, 2006

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>

Who is online

Users browsing this forum: No registered users and 6 guests