Autor Thema: Lupus Alarmanlage mit Httpmod/JSON auslesen  (Gelesen 58 mal)

Offline stenny

  • Jr. Member
  • **
  • Beiträge: 73
Lupus Alarmanlage mit Httpmod/JSON auslesen
« am: 07 Oktober 2018, 12:29:42 »
Hallo

Versuche gerade eine Lupus Alarmanlage (XT1+) mit HttpMod auszulesen.

Der Status Funktioniert ohne Fehler

{
  "updates" : {
    "mode_a1" : "{AREA_MODE_1}",
    "mode_a2" : "{AREA_MODE_1}",
    "dc_ex" : "1",
    "alarm_ex" : "0",
    "battery_ex" : "1",
    "battery_ok" : "1",
    "battery" : "{WEB_MSG_NORMAL}",
    "tamper_ok" : "1",
    "tamper" : "{WEB_MSG_NORMAL}",
    "interference_ok" : "1",
    "interference" : "{WEB_MSG_NORMAL}",
    "ac_activation_ok" : "1",
    "ac_activation" : "{WEB_MSG_NORMAL}",
    "sys_in_inst": "",
    "rssi" : "1",
    "sig_gsm_ok" : "1",
    "sig_gsm" : "{WEB_MSG_NA}"
  },
  "forms" : {
    "pcondform1" : {
      "mode" : "1",
      "f_arm" : "0"
    },
    "pcondform2" : {
      "mode" : "1",
      "f_arm" : "0"
    }
  }
}

Nur bei den Sensoren werden über extractAllJSON 1 keine Readings erstellt

{
  "senrows": [
{"area": 1, "zone": 1, "type": 37, "type_f": "{D_TYPE_37}", "name": "Eingang",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [0,5,5,5,5,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "", "sid": "RF:0073ed70", "su": 0, "alarm_status": "", "status_ex": "0"},
{"area": 2, "zone": 1, "type": 9, "type_f": "{D_TYPE_9}", "name": "BM Treppenhaus",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [0,0,0,0,0,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "", "sid": "RF:04435330", "su": 1, "alarm_status": "", "status_ex": "0"},
{"area": 1, "zone": 2, "type": 4, "type_f": "{D_TYPE_4}", "name": "Wohnungstür",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [3,1,1,1,1,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "{WEB_MSG_DC_CLOSE}", "sid": "RF:04993310", "su": 1, "alarm_status": "", "status_ex": "0"}]
}

Im Log erhalte ich

2018.10.07 12:14:02 5: HttpUtils https://xxx:xxx@ip/action/deviceListGet: Got data, length: 1260
2018.10.07 12:14:02 5: HttpUtils response header:
HTTP/1.0 200 OK
Server: Mongoose
Pragma: no-cache
Cache-control: no-cache
Expires: 0
Content-Type: application/json; charset=utf-8
2018.10.07 12:14:02 4: Alarmanlage_device: Read callback: request type was update retry 0,
Body: {
  "senrows": [
{"area": 1, "zone": 1, "type": 37, "type_f": "{D_TYPE_37}", "name": "Eingang",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [0,5,5,5,5,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "", "sid": "RF:0073ed70", "su": 0, "alarm_status": "", "status_ex": "0"},
{"area": 2, "zone": 1, "type": 9, "type_f": "{D_TYPE_9}", "name": "BM Treppenhaus",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [0,0,0,0,0,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "", "sid": "RF:04435330", "su": 1, "alarm_status": "", "status_ex": "0"},
{"area": 1, "zone": 2, "type": 4, "type_f": "{D_TYPE_4}", "name": "Wohnungstür",
"cond": "", "cond_ok": "1", "battery": "", "battery_ok": "1",
"tamper": "", "tamper_ok": "1", "bypass": 0, "rssi": "{WEB_MSG_STRONG} 9",
"resp_mode": [3,1,1,1,1,0], "ammeter": "0", "ver": "",
"hue": "-1", "sat": "-1", "bypass_tamper": 0,
"status": "{WEB_MSG_DC_CLOSE}", "sid": "RF:04993310", "su": 1, "alarm_status": "", "status_ex": "0"}]
}

2018.10.07 12:14:02 3: Alarmanlage_device: error while parsing JSON data: invalid character encountered while parsing JSON string, at character offset 230 (before "\t9", \n"resp_mode":...") at (eval 2730) line 1.

2018.10.07 12:14:02 5: Alarmanlage_device: ExtractSid called, context reading, num
2018.10.07 12:14:02 4: Alarmanlage_device: CheckAuth decided no authentication required
2018.10.07 12:14:02 3: Alarmanlage_device: no parsed JSON structure available
2018.10.07 12:14:02 5: Alarmanlage_device: Read starts parsing response to update with defined readings:
2018.10.07 12:14:02 3: Alarmanlage_device: Read response to update didn't match any Reading
2018.10.07 12:14:02 5: Alarmanlage_device: HandleSendQueue called, qlen = 0

List....
Internals:
   BUSY       0
   CHANGED   
   DEF        https://xxx:xxx@ip/action/deviceListGet 60
   Interval   60
   JSONEnabled 1
   LASTSEND   1538907961.40994
   MainURL    https://xxx:xxx3de@ip/action/deviceListGet
   ModuleVersion 3.5.1 - 5.7.2018
   NAME       Alarmanlage_device
   NR         530
   STATE      ???
   TRIGGERTIME 1538908021.40683
   TRIGGERTIME_FMT 2018-10-07 12:27:01
   TYPE       HTTPMOD
   addr       https://ip
   auth       1
   code       200
   compress   1
   conn       
   data       
   displayurl https://xxx:xxx@ip/action/deviceListGet
   header     
   host       192.168.2.198
   httpheader HTTP/1.0 200 OK
Server: Mongoose
Pragma: no-cache
Cache-control: no-cache
Expires: 0
Content-Type: application/json; charset=utf-8
   httpversion 1.0
   hu_blocking 0
   hu_filecount 33
   hu_port    443
   hu_portSfx
   ignoreredirects 0
   loglevel   4
   path       /action/deviceListGet
   protocol   https
   pwd        L563fbe3de
   redirects  0
   timeout    2
   url        https://xxx:xxx@ip/action/deviceListGet
   user       ckuntze
   value      0
   Helper:
     DBLOG:
       state:
         DBLogging:
           TIME       1538907271.62737
           VALUE      reread
   QUEUE:
   READINGS:
   REQUEST:
     data       
     header     
     ignoreredirects 0
     retryCount 0
     type       update
     url        https://xxx:xxx@ip/action/deviceListGet
     value      0
   sslargs:
Attributes:
   enableControlSet 1
   enforceGoodReadingNames 1
   extractAllJSON 1
   room       Lupus
   verbose    5

Wenn ich die Regex umgehen könnte würde es später einfacher wenn alle Sensoren angelernt wären.....

Für Hilfe oder Ideen wäre ich dankbar


Carsten

 

decade-submarginal