Content

  1. Sockets
    1. Introduction

      The protocol between server and client is JSON-Format based.

      To be able to request data or to send a command the client has to be authentificated.

      After the authentification every JSON-Command from cliend must have a Token attribute. If the Token is wrong the connection gets closed.

      The server listens to the Action attribute - if a valid action is recogniced it gets executed.

    2. Authentification
      Login Information

      Username: TestUser

      Password: Test

      Client sends it's username "TestUser"

      {
          "Username": "f6c1788e5bc736fb2b6265a39c15178ded2deac2bd6cd4d27fc5185a9ebbdfd3165d1aad078619184b0fcedbc6b29aa48fd03753788b6758570f60f0beec30e0"
      }

      Client receives random hash"

      {
          "UsernameSalt": "ec4de89a840aebf97c7757dc0b0ef75efe65b315115d0895686e32c313f27250a8c24f4b53d1645ab34f645c55cda96fc596a8c2afe9536f7691033363bfcc21"
      }

      Client returns with SHA512(UsernameSalt+SHA512(Password)

      {
          "EndHash": "40bf442a2979e327522e596f2a116f10fc8cfee79317b98929f63e92f6a9fce8076da37f69b2481278c01ab04b3dd1db51f9a432e817f4a9299b6bdbb2c8689b"
      }

      Client receives random Token associated to this socket."

      {
          "Token": "d4bdd55347543aba8bdab7bda807c11dfe0f39743c4842590c9840d578f1bc970d400fd007d7780e579cbad099566c3caddfeeb01f3beb0e4ce978debf8656ae"
      }
    3. Commands
      1. VirtualPlugChanged

        VirtualPlugChanged forces each value of an array of values to a certain plug or variable for exactly one cycle

        Clients wants 1234.DI#01 to change to 1 and than to 0.

        {
            "Action": "VirtualPlugChanged",
            "PlugID": "1234.DI#01",
            "Values": "[1,0]"
        }
      2. StatusRequest

        The server returns the status of the requested plugs.

        Clients wants 1234.DI#01 to change to 1 and than to 0.

        {
            "Action": "StatusRequest",
            "PlugIDs": [
                "1234.DI#01",
                "1234.DI#02",
                "1234.DQ#01",
                "1234.DQ#02"
            ]
        }
      3. Restart

        The server will reset everything and reload the configuration file.

        Clients wants 1234.DI#01 to change to 1 and than to 0.

        {
            "Action": "Restart",
        }
    4. Notifications
      1. PlugStatus

        The server notificates the client with the status information of certain plugs

        Server tell client the values of 1234.DI#01, 1234.DI#02, 1234.DQ#01, 1234.DQ#02.

        {
            "Action": "PlugStatus",
            "Plugs": {
                "1234.DI#01": {"Value": "0"},
                "1234.DI#02": {"Value": "1"},
                "1234.DQ#01": {"Value": "1"},
                "1234.DQ#02": {"Value": "0"}
            }
        }
      2. Status

        The server notificates the client that the command was executed without a certain request.

        Server tell client the values of 1234.DI#01, 1234.DI#02, 1234.DQ#01, 1234.DQ#02.

        {
            "Status": "OK"
        }
    5. Websocket
      Login Information

      Port: 8765

      Password: Test

    6. Standard-Socket
      Login Information

      Username: TestUser

      Password: Test

  2. Serial Connection
    Connection Information

    Baud: 57600

    Data Bit: 8

    Stop Bit: 1

    Parity Bit: None

    Command End: \r\n

    1. Model
      1. Structure

        Command(Parameter)

        ModuleID.PlugType#[Number]=Value //Without []

        ModuleID.Command(Parameter)

        For most commands the modlue has to be specified.

      2. Plugtypes

        DI: ReadOnly - BOOLEAN (0,1)

        DQ: WirteAble - BOOLEAN (0,1)

        AI: ReadOnly - FLOAT (0-10)

        AQ: WirteAble - FLOAT (0-10)

    2. Requests
      1. Get Alive Status Request from Main Module

        Check if the Main Module of Rasmatin Network is answering

        Command:

        Hello RaSmatin!

        Answer:

        Hello!
      2. Get Value of any Plug

        Command Syntax:

        [module id].[plug type]#[number]=?

        Example: Get value of digital output plug numer 1 of module 1234.

        1234.DQ#01=?

        Examlpe Answer:

        1234.DQ#01=1

        Example: Get value of digital input plug number 5 of module 1234.

        1234.DI#05=?

        Examlpe Answer:

        1234.DI#05=1

        Example: Get value of analog input plug number 2 of module 1234.

        1234.AII#02=?

        Examlpe Answer:

        1234.AI#02=823
      3. Get Hardware Infos of the Module

        Returns information of the hardware. (e.g. Plug Types and number of plugs)


        Command Syntax:

        [module id].ModulHardware

        Command:

        1234.ModulHardware

        Answer:

        1234.12DI;12DO;4AI;CAN;Clock;RS485
      4. Get Informations of the Module (Serial, ID, Description, ...)

        Returns information of the hardware. (e.g. Plug Types and number of plugs)


        Command Syntax:

        [module id].ModulInfo

        Command:

        1234.ModulInfo

        Answer:

        1234.ID=-001;Serial=00100;Name=;Description=MainModule;config
      5. Get Software Version

        Returns the software version of the module.


        Command Syntax:

        [module id].Version

        Command:

        1234.Version

        Answer:

        1234.RaControl V0.02 2016-07-07
      6. Get Hardware Status

        Returns the values of all implemented plugs


        Command Syntax:

        [module id].Get HW-Status!

        Command:

        1234.Get HW-Status!

        Answer:

        1234.DI#01=1
        1234.DI#02=0
        1234.DI#03=0
        1234.DI#04=0
        1234.DI#05=0
        1234.DI#06=0
        1234.DI#07=0
        1234.DI#08=0
        1234.DI#09=0
        1234.DI#10=0
        1234.DI#11=0
        1234.DI#12=0
        1234.DQ#01=0
        1234.DQ#02=0
        1234.DQ#03=0
        1234.DQ#04=0
        1234.DQ#05=0
        1234.DQ#06=0
        1234.DQ#07=0
        1234.DQ#08=0
        1234.DQ#09=0
        1234.DQ#10=0
        1234.DQ#11=0
        1234.DQ#12=0
        1234.AI#01=3.04
        1234.AI#02=2.99
        1234.AI#03=0.00
        1234.AI#04=2.99
      7. Relay Test

        Switches on and off all digital outputs for 100ms to check if they are working fine.


        Command Syntax:

        [module id].RELAY_TEST

        Command:

        1234.RELAY_TEST

        Answer:

        1234.Do RELAY_TEST!
    3. Commands
      1. Reset

        Command Syntax:

        [module id].Reset

        Software reset of the module

        1234.Reset

        Answer:

        1234.Do Reset!
      2. Set/Reset digital output plug

        Set/Reset of a digital output plug.


        Command Syntax:

        [module id].DQ#[number]=[0|1]

        Set digital output plug number 3 of Module 1234 to 1.

        1234.DQ#03=1
      3. Set Molule Serial Number

        Set the module serial number. This number has to be unique for each module within an RaSmatin network.


        Command Syntax:

        [module id].SetModul_Serial=[yourModuleID]

        Set module serial number from 100 to 1234.

        100.SetModul_Serial=1234
      4. Set Molule Identification Number

        Set the module identification number.


        Command Syntax:

        [module id].SetModul_ID=[yourModuleID]

        Set module ID from 100 to 123.

        100.SetModul_ID=123
      5. Set Molule Name

        Set the internal name of the module.


        Command Syntax:

        [module id].SetName=[yourModuleName]

        Set module name to "MAIN MODULE" of moule 1234.

        1234.SetName=MAIN MODULE
      6. Set Molule Description

        Set the internal description of the module.


        Command Syntax:

        [module id].SetDescription=[yourModuleDescription]

        Set module description to "Solar Control Module" of moule 1234.

        1234.SetDescription=Solar Control Module

Copyright © 2015 - 2024 RaSmatin

Build with ❤️ by LukasRaab.com