API Questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Geps
    Automated Home Guru
    • Nov 2010
    • 136

    API Questions

    Hi,

    I'm playing around with the API at the moment.

    Could someone just clarify where the API Messaging window, within Cortex is please?

    The Help File says: Visit the Main menu | Tools | Cortex API.

    But I can't see it under tools.....?


    Also, how do you change between the two versions? I'm using the plain text version at the moment and wanted to try the XML formatted one.

    Cheers,
  • achapman
    Automated Home Jr Member
    • Jan 2006
    • 43

    #2
    It's the bottommost entry on the Tools menu.

    Just clicking on it opens the API messaging window. The two API versions are active at the same time. How you structure the query determines whether you get a version 1 reply or a version 2 one.

    Comment

    • Geps
      Automated Home Guru
      • Nov 2010
      • 136

      #3
      Ah ha - looks like I was running an older version without those bits.

      All working now.

      Thanks.

      Comment

      • Geps
        Automated Home Guru
        • Nov 2010
        • 136

        #4
        Is there anyway to load up with the XML format selected?

        Cheers,

        Comment

        • achapman
          Automated Home Jr Member
          • Jan 2006
          • 43

          #5
          Not sure what you mean. If you mean can the standard messages from modules be received as XML messages the answer is no, I believe. Certain ports on modules transmit a message whenever their status changes, so a constant stream of API version 1 messages are output, e.g.
          Ground Floor Humidity.Dewpoint Output=0.556517544907261
          or
          Desk Lighting Switch.Output logic state=100.

          These same values could be obtained via XML (the Version 2 API), but only by sending an XML query first, e.g.

          <CortexAPI>
          <QueryPortValue>
          <FriendlyName>Ground Floor Humidity</FriendlyName>
          <PortDescription>Dewpoint Output</PortDescription>
          </QueryPortValue>
          </CortexAPI>

          would give the reply:

          <CortexAPI>
          <PortEvent>
          <FriendlyName>Ground Floor Humidity</FriendlyName>
          <IDNumber>151</IDNumber>
          <PortDescription>Dewpoint Output</PortDescription>
          <Type>ValueOut</Type>
          <Value>0.556517544907261</Value>
          </PortEvent>
          </CortexAPI>

          but you can't switch Cortex into sending the standard notification messages as XML in the first place AFAIK.

          Comment

          • Geps
            Automated Home Guru
            • Nov 2010
            • 136

            #6
            Excellent, thanks again.

            Comment

            • achapman
              Automated Home Jr Member
              • Jan 2006
              • 43

              #7
              IdraAPI

              I'm writing an application to use the API to do various things. If you want to have a look - look here - http://www.zen96094.zen.co.uk/Anate/index.html.

              It's work in progress, I'm just doing the Twitter bit atm.

              Comment

              • Geps
                Automated Home Guru
                • Nov 2010
                • 136

                #8
                Interesting......especially your Sonos plugin.....

                I've just created a Squeezebox one that will allow your music to follow you round the house on a similar principle.

                Comment

                Working...
                X