XML Socket API questions 2013-05-29T05:29:37+00:00

HOME Forums Gateways Raspberry Pi XML Socket API questions

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • Anonymous
    Post count: 16
    #40368 |

    Hey

    I am having some trouble authenticating via the XML socket API, would appreciate it if someone knowlegable could point out what i am doing wrong

    I believe the authenticate process requires a sha1 hash of the default password, so I tried

    > echo Smartenit | sha1sum
    445389adb29f6bd03520d81f7cdaf9039ecba7da –

    then did this (my pi is at 192.168.24.51)

    telnet 192.168.24.51 50333
    and pasted this to console

    ZBP_SystemSys_Authenticate445389adb29f6bd03520d81f7cdaf9039ecba7da

    what i got back was auth failure code 4

    ZBP_SystemSys_Authenticate41807a07d-9d8d-46ec-9b45-f856740f37c2

    did i misunderstand the authentication process ?

    S

    Anonymous
    Post count: 16

    figured it out, my sha1 has was wrong, works just fine now

    sent
    ZBP_SystemSys_Authenticate09cbef6f2f30e9bf9a202c53142295478786d5f3

    recv
    ZBP_SystemSys_Authenticate2298aa940-bd64-4dee-943a-c0a17a017c99

    cheers

    S

    Anonymous
    Post count: 16

    Folks
    i am not sure how to proceed, i have got past the Sys_Authenticate step and can access the zbpserver just fine
    send
    ZBP_SystemSys_Authenticate5507b46f340c3bffd9be85a6a9a0387584adb2f9

    recv
    ZBP_SystemSys_Authenticate0460f0303-6c49-4fa3-90bc-91b04dcdc87a

    I can query and get a json list of nodes

    send

    ZBP_NodeNode_GetAllNodesJson

    recv

    ZBP_Node
    Node_GetAllNodesJson

    3
    [{ “id”:48823, “name”:””, “image”:””, “hid”:1669163, “user_descriptor”:””, “node_descriptor”:1283, “category”:”503″, “model”:”PLM”, “parameters”:{}},{ “id”:48951, “name”:”Messenger”, “image”:”default.png”, “hid”:14636947900334128, “user_descriptor”:””, “node_descriptor”:52, “category”:””, “model”:”Messenger”, “parameters”:{}},{ “id”:27749, “name”:”Home Office Main Light”, “image”:”default.png”, “hid”:1717422, “user_descriptor”:””, “node_descriptor”:2818, “category”:”b02″, “model”:”b02″, “parameters”:{}}]

    15ad256f-4206-4937-8a0d-12652b81a4da

    The third node is a simple insteon light switch

    I can turn it on and off via the android app, and see this from zbpserver when i do

    NodeNode_ClusterCmdRsp06c650000[2b,11,ff]

    I assume is should be using a Node_ClusterCommand to turn the light on and off via xml socket API, but i can’t find an exmaple of what to send or how to do that ?

    can someone wiser and knowledgable give an example based on above info

    cheers

    Anonymous
    Post count: 259

    I assume is should be using a Node_ClusterCommand to turn the light on and off via xml socket API, but i can’t find an exmaple of what to send or how to do that ?

    Yes you can use Node_ClusterCommand API to communicate to your devices. Below is an example for Insteon devices.
    // READ STATUS

    ZBP_Node
    Node_ClusterCommand

    2
    27749
    0
    0
    0
    [25,0]

    11161

    ………………………………………..

    //TURN OFF
    Inside Harmony Controller:: Node_ClusterCommand
    Time Sent: Mon Jun 10 11:06:19 GMT-0700 2013
    ………………………………………..

    ZBP_Node
    Node_ClusterCommand

    2
    27749
    0
    0
    0
    [19,0] //Turn ON would be [17,255]

    14921

    ………………………………………..

    Anonymous
    Post count: 16

    great thanks Dhawal, much appreciated

    Anonymous
    Post count: 2

    I have the zbpserver running on a Raspberry Pi and am able to exchange messages based on the information available on this forum. I also have the XML API spec available at http://www.simplehomenet.com/Downloads/TCP_CLIENT_API.pdf. The methods mentioned on this forum do not match what is in the document, likely because the document appears to be dated. Where can i get a complete list of methods that are supported by the zbpserver? Is there an updated version of the document or is this information available in any of the files that are part of the install?

    Thanks
    PiJet

    Anonymous
    Post count: 259
    Anonymous
    Post count: 2

    Thanks Dhawal. I see the complete list of commands on the Wiki. Even though i am able to exchange commands, i am still trying to understand what the values coming from the zbpserver mean or what values i should send to the server to read the temperature and humidity. Can you please point me to any resources that can help? I am currently trying out the examples from this forum for controlling the smart plugs.

    Anonymous
    Post count: 259

    Hi,

    When requesting information or sending commands you want to use the Node_ClusterCommand API. For getting information from a Zigbee temperature/humidity sensor we just have to fill up the API with the correct Endpoint, Cluster id and Payload value.

    You may want to download the Zigbee Cluster Library and understand more about Endpoints, Commands, Clusters, Datatypes, Attribute ID’s etc.

    We also have a lower level API called ZBPCID_API for messages between the ZBPServer and the Zigbee Radio

    Here’s an example for the ZBHT-2:

    //Read Attribute for Humidity
    ………………………………………..

    ZBP_Node
    Node_ClusterCommand

    130 //u8Mode
    16491 //u16DestAdd
    10 //u8DestEP
    1029 //u16ClusterID. (0x0405 == Relative Humidity Measurement)
    0 //u8Command. (Command for Read Atrributes = 0)
    [1,0,0] //Payload. [Number of Attributes, Attibute ID byte 1, Attribute ID byte 2]

    8922

    ………………………………………..

    //Read Attribute for Temperature
    ………………………………………..

    ZBP_Node
    Node_ClusterCommand

    146
    16491
    10
    1026 //Cluster ID. (0x0402 == Temperature Measurement)
    0
    [1,0,0]

    45533

    ………………………………………..

    The Gateway will then respond with:
    ………………………………………..

    ZBP_Node
    Node_ClusterCommand

    0 //Status byte (0=success, message sent to device),(2=Device not found)

    39043

    ………………………………………..

    If successful, the sensor will then send a response to the Gateway, which the Gateway formats as the Node_ClusterCmdRsp Signal:
    ………………………………………..

    Node
    Node_ClusterCmdRsp

    b2 //u8Mode
    406b //u16SrcAdd
    a //u8SrcEP
    402 //Cluster ID. (0x0402 == Temperature Measurement)
    1 //u8CmdID. (Read Attributes Response = 0x01)
    1 //Number of Attributes in Payload
    [00,00,00,29,09,b1] //Payload explained below.

    ………………………………………..

    ………………………………………..

    Node
    Node_ClusterCmdRsp

    b2
    406b
    a
    405 //u16ClusterID. (0x0405 == Relative Humidity Measurement)
    1
    1
    [00,00,00,21,11,45]

    ………………………………………..

    Payload received is formatted as follows:
    Array (list) of attribute records. Each record consists of:
    u16AttribID – Attribute identifier
    u8Status – Attribute read status (SUCCESS = 0)
    u8DataType – Type of the attribute
    AttribData – Attribute data (variable depending on type)
    ………………………………………..

    For Humidity we received: [00,00,00,21,11,45]. Here’s how to derive the actual Humidity %
    00,00 = 0x0000 MeasuredValue (Attribute of the Humidity Cluster)
    21 = 0x21 DataType (Unsigned 16-bit integer)
    11,45 = 0x1145 Data. Convert to Decimal and divide by 100. Humidity = 44.21%
    ………………………………………..
    and for Temperature we received: [00,00,00,29,09,b1]
    00,00 = 0x0000 MeasuredValue (Attribute of the Temperature Cluster)
    29 = 0x29 DataType (Signed 16-bit integer)
    09,b1 = 0x09b1 Data. Convert to Decimal and divide by 100 for Celsius. Temperature = 24.81 °C

    Hope this helps. Thanks.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.