Messages structure - Gleeno/DomAlgo GitHub Wiki

##Client/Server messages All server/client messages exchanged are in json format, and they must have this fields:

  • action -> action to perform
  • data -> data to pass
  • id -> id of source entity
  • type -> sensor type

Example 1:

{

    action: "getDataSensor",

    data: "all",

    id: "SmatPhone_ees",

    type: "terminal",

}

Example 2:

{

    action: "getDataSensor",

    data:   [
                {
                    action: "getLastVal",

                    data: "0,25 Ah",

                    id: "SS_23564",

                    type: "SimpleSwitch"
                }
            ],

    id: "SmatPhone_ees",

    type: "terminal",

}

Example 3:

{

    action: "getDataSensor",

    data:   [
                {
                    action: "getLastVal",

                    data: "0,25 Ah",

                    id: "SS_23564",

                    type: "SimpleSwitch"
                },
                {
                    action: "getStats",

                    data: "currentConsumption",

                    id: "SK_5609322",

                    type: "SimpleKnob"
                }
            ],

    id: "SmatPhone_ees",

    type: "terminal",

}