Skip to main content

Python package to interact with Elkron Alarm devices

Project description

pyLkron

List of known endpoints:

  • "sys/info.cgi" : Returns infos on the system (no authentication required??)
  • "user/info.cgi" : Returns current user info and authLevel (-1 if not logged in)
  • "user/logout.cgi" : Logout endpoint (returns error 405 if not logged in)
  • "user/login.cgi" : Endpoint for first login procedure
  • "spweco/globalstates.cgi": Endpoint to check alarm status
  • "spweco/detailedstates.cgi": Endpoint to get activezone and zone + sensors states
  • "spweco/plantstructure.cgi": Endpoint to get zone informations
  • "spweco/activate.cgi": Endpoint to get zone informations
  • "spweco/deactivate.cgi": Endpoint to get zone informations
  • "spweco/getshortcuts.cgi": UNKNOWN

Cookie Structure

  • i18next: language selector ("it", "en", etc.)
  • TRACKID: alphanumeric string to keep session, same value always

Endpoint infos

sys/info.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)
  • POST: ????

Example

{
  "data": {
    "backend": "it500web 2.0.170615",
    "boardid": "",
    "bzone": 0,
    "cbrand": "elkron",
    "cmodel": "ELKRON - MP500/8",
    "cumod": 0,
    "cver": "01.07",
    "lang": "it",
    "macadd": "",
    "maxidle": 120,
    "plantname": "HAL9000",
    "sendcloud": true,
    "sesstate": -1,
    "swpver": "2.0.0-27",
    "swupdprogress": 100.0,
    "swupdstate": 0,
    "sysmode": 1
  },
  "result": "ACK",
  "title": "/sys/info.cgi"
}

user/login.cgi

Request

  • GET: returns error 405
  • POST: Logs in with JSON object as request body:
    • user: Plaintext Web panel username
    • pwd: Double hashed password (md5(md5(password)))

Response

  • 200 OK: JSON object with the login result
    • result: Login Status
      • NAK: Not Logged-In
      • ACK: Logged-In successfully + Session Cookie
    • title: Endpoint name
    • [data]: if result is ACK contains authentication details
      • authlevel
      • userid
      • username

Example

{
  "data": {
    "authlevel": 1,
    "userid": -1,
    "username": "..."
  },
  "result": "ACK",
  "title": "/user/login.cgi"
}

user/info.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)
  • POST: ????

Example

{
  "data": {
    "authlevel": 1,
    "userid": -1,
    "username": "..."
  },
  "result": "ACK",
  "title": "/user/info.cgi"
}

spweco/globalstates.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)
  • POST: ????

Response

  • 404 KO: If not logged-in
  • 200 OK: With the system status data
    • result: "ACK"
    • title: Endpoint name
    • data: Dictionary of n sectors identified by a letter and with value (0, 1, 2, ... unknown meaning)
      • Example: { "A": 1, "I": 2, "K": 0}

Example

{
  "data": {
    "A": 0,
    "F": 0,
    "I": 0,
    "O": 0,
    "X": 0
  },
  "result": "ACK",
  "title": "/spweco/globalstates.cgi"
}

spweco/detailedstates.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)
  • POST: ????

Example

{
  "data": {
    "activezone": [],
    "sensorstate": [],
    "zonestate": []
  },
  "result": "ACK",
  "title": "/spweco/detailedstates.cgi"
}

spweco/plantstructure.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)
  • POST: ????

Example

{
  "data": {
    "cfgarea": [{ "NAME": "", "NID": 0, "PID": [] }],
    "cfgoutput": [],
    "cfgsensor": [
      { "NAME": "Ingresso 1 - Ingresso", "NID": 1, "PID": [1] },
      { "NAME": "Ingresso 2 - ...", "NID": 2, "PID": [2] },
      { "NAME": "Ingresso 3 - Tapparelle giorno", "NID": 3, "PID": [3] },
      { "NAME": "Ingresso 4 - Barriere notte", "NID": 4, "PID": [4] },
      { "NAME": "Ingresso 5 - Tapparelle notte", "NID": 5, "PID": [5] },
      { "NAME": "Ingresso 6 - Barriere giorno", "NID": 6, "PID": [2] }
    ],
    "cfgzone": [
      { "NAME": "Settore 1 - Ingresso", "NID": 1, "PID": [0] },
      { "NAME": "Settore 2 - Barriere giorno", "NID": 2, "PID": [0] },
      { "NAME": "Settore 3 - Tapparelle giorno", "NID": 3, "PID": [0] },
      { "NAME": "Settore 4 - Barriere notte", "NID": 4, "PID": [0] },
      { "NAME": "Settore 5 - Tapparelle notte", "NID": 5, "PID": [0] }
    ],
    "exsensor": [
      { "NAME": "Ingresso 1 - Ingresso", "NID": 1, "PID": [1] },
      { "NAME": "Ingresso 2 - ...", "NID": 2, "PID": [2] },
      { "NAME": "Ingresso 3 - Tapparelle giorno", "NID": 3, "PID": [3] },
      { "NAME": "Ingresso 4 - Barriere notte", "NID": 4, "PID": [4] },
      { "NAME": "Ingresso 5 - Tapparelle notte", "NID": 5, "PID": [5] },
      { "NAME": "Ingresso 6 - Barriere giorno", "NID": 6, "PID": [2] }
    ]
  },
  "result": "ACK",
  "title": "/spweco/plantstructure.cgi"
}

spweco/getshortcuts.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)

Example

{
  "data": [
    { "delay": 0, "enable": 0, "id": 1, "name": "", "zone": [] },
    { "delay": 0, "enable": 0, "id": 2, "name": "", "zone": [] }
  ],
  "result": "ACK",
  "title": "/spweco/getshortcuts.cgi"
}

spweco/filteredstructure.cgi

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)

Example

{
  "data": {
    "cfgarea": [{ "NAME": "", "NID": 0, "PID": [] }],
    "cfgoutput": [],
    "cfgsensor": [
      { "NAME": "Ingresso 1 - Ingresso", "NID": 1, "PID": [1] },
      { "NAME": "Ingresso 2 - ...", "NID": 2, "PID": [2] },
      { "NAME": "Ingresso 3 - Tapparelle giorno", "NID": 3, "PID": [3] },
      { "NAME": "Ingresso 4 - Barriere notte", "NID": 4, "PID": [4] },
      { "NAME": "Ingresso 5 - Tapparelle notte", "NID": 5, "PID": [5] },
      { "NAME": "Ingresso 6 - Barriere giorno", "NID": 6, "PID": [2] }
    ],
    "cfgzone": [
      { "NAME": "Settore 1 - Ingresso", "NID": 1, "PID": [0] },
      { "NAME": "Settore 2 - Barriere giorno", "NID": 2, "PID": [0] },
      { "NAME": "Settore 3 - Tapparelle giorno", "NID": 3, "PID": [0] },
      { "NAME": "Settore 4 - Barriere notte", "NID": 4, "PID": [0] },
      { "NAME": "Settore 5 - Tapparelle notte", "NID": 5, "PID": [0] }
    ],
    "exsensor": [
      { "NAME": "Ingresso 1 - Ingresso", "NID": 1, "PID": [1] },
      { "NAME": "Ingresso 2 - ...", "NID": 2, "PID": [2] },
      { "NAME": "Ingresso 3 - Tapparelle giorno", "NID": 3, "PID": [3] },
      { "NAME": "Ingresso 4 - Barriere notte", "NID": 4, "PID": [4] },
      { "NAME": "Ingresso 5 - Tapparelle notte", "NID": 5, "PID": [5] },
      { "NAME": "Ingresso 6 - Barriere giorno", "NID": 6, "PID": [2] }
    ]
  },
  "result": "ACK",
  "title": "/spweco/filteredstructure.cgi"
}

spweco/activate.cgi

Request

  • POST:
    • [zone]: Array of zone IDs

Example

Request

{
  "zone": [1]
}

Response

{
  "result": "ACK",
  "title": "/spweco/activate.cgi"
}

spweco/deactivate.cgi

Request

  • POST:
    • [zone]: Array of zone IDs

Example

Request

{
  "zone": [1]
}

Response

{
  "result": "ACK",
  "title": "/spweco/deactivate.cgi"
}

spweco/gethistory.cgi

Request

  • POST:
    • [event]: Number of events (0 for all??)

Example

Request

{
  "event": 0,
  "period": 1
}

Response

{
  "data": [
    {
      "AREA": [],
      "CAT": 3,
      "CODE": "Disattivazione impianto",
      "DATE": { "DAY": 11, "HR": 18, "MIN": 0, "MT": 5, "SEC": 54, "YR": 19 },
      "DT": 3,
      "ID": 1,
      "NAME": "Tastiera 1 - KP 01",
      "USER": "Utente 3 - Jacopo",
      "ZONE": [
        "Settore 1 - Ingresso",
        "Settore 2 - Barriere giorno",
        "Settore 3 - Tapparelle giorno",
        "Settore 4 - Barriere notte",
        "Settore 5 - Tapparelle notte"
      ]
    },
    {
      "AREA": [],
      "CAT": 3,
      "CODE": "Codice valido",
      "DATE": { "DAY": 11, "HR": 18, "MIN": 0, "MT": 5, "SEC": 52, "YR": 19 },
      "DT": 3,
      "ID": 1,
      "NAME": "Tastiera 1 - KP 01",
      "USER": "Utente 3 - Jacopo",
      "ZONE": []
    },
    {
      "AREA": [],
      "CAT": 3,
      "CODE": "Attivazione impianto",
      "DATE": { "DAY": 11, "HR": 14, "MIN": 3, "MT": 5, "SEC": 42, "YR": 19 },
      "DT": 3,
      "ID": 1,
      "NAME": "Tastiera 1 - KP 01",
      "USER": "Utente 2 - Seve",
      "ZONE": [
        "Settore 1 - Ingresso",
        "Settore 2 - Barriere giorno",
        "Settore 3 - Tapparelle giorno",
        "Settore 4 - Barriere notte",
        "Settore 5 - Tapparelle notte"
      ]
    },
    {
      "AREA": [],
      "CAT": 3,
      "CODE": "Codice valido",
      "DATE": { "DAY": 11, "HR": 14, "MIN": 3, "MT": 5, "SEC": 40, "YR": 19 },
      "DT": 3,
      "ID": 1,
      "NAME": "Tastiera 1 - KP 01",
      "USER": "Utente 2 - Seve",
      "ZONE": []
    }
  ],
  "result": "ACK",
  "title": "/spweco/gethistory.cgi"
}

spweco/access.cgi

Sets the user for the current session

Request

  • POST:
    • [code]: Authentication code

Example

Request

{
  "code": "..."
}

Response

{
  "data": {
    "authlevel": 2,
    "userid": 4,
    "username": "Username"
  },
  "result": "ACK",
  "title": "/spweco/access.cgi"
}

user/refresh.cgi

Checks if the user is still authenticated

Request

  • GET:
    • [_]: Time since epoc in ms (Request Query Parameter)

Example

Response

{
  "result": "ACK",
  "title": "/user/refresh.cgi"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylkron-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylkron-0.0.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pylkron-0.0.1.tar.gz.

File metadata

  • Download URL: pylkron-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pylkron-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0b61cbdd1b82447e9aea8b14e07f60a3b98b93a47b0e6e2bb97e475c69f16d7b
MD5 a7371de1bf6a217b59f92e922d1958be
BLAKE2b-256 93cdb667c070d449f2a4f345c988389a044d95d77740647fa810d604fd01826d

See more details on using hashes here.

File details

Details for the file pylkron-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pylkron-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pylkron-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9421d02d4279cdbad86764c3d023d3e983384695f4da9dd8b6f90beafd6692f5
MD5 1c72f30cad193a52e90cb0ea66ab64a7
BLAKE2b-256 bf2009c91648ccd0aa1b06853d5d2ae6fbe0626015fa105eaedb36c98e340191

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page