Olen yrittänyt tehdä shell modulilla json haun parsimista onnistumatta.
Seuraavalla lausekkeella olen yrittänyt.
@KWHILPO:REGEXP = ^.*"CounterToday"\s*:\s*(?P<Kwh_ilpo>[0-9.\-]+)[,\s].*$
Mutta virhettä pukkaa, olisiko ajatuksia? Pitäisi saada paljas luku jotta ohjelma hyväksyy tuloksen.
KWHILPO: ERROR: Shell data does not match (regexp: ^.*"CounterToday"\s*:\s*(?P<Kwh_ilpo>[0-9.\-]+)[,\s].*$): {
"ActTime" : 1642361641,
"AstrTwilightEnd" : "18:29",
"AstrTwilightStart" : "06:30",
"CivTwilightEnd" : "16:43",
"CivTwilightStart" : "08:16",
"DayLength" : "06:41",
"NautTwilightEnd" : "17:38",
"NautTwilightStart" : "07:21",
"ServerTime" : "2022-01-16 21:34:01",
"SunAtSouth" : "12:29",
"Sunrise" : "09:09",
"Sunset" : "15:50",
"app_version" : "2021.1 (build 13949)",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"Counter" : "1.562 kWh",
"CounterToday" : "1.539 kWh",
"CustomImage" : 0,
"Data" : "1.562 kWh",
"Description" : "",
"Favorite" : 0,
"HardwareDisabled" : false,
"HardwareID" : 4,
"HardwareName" : "Dummyt",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "82115",
"LastUpdate" : "2022-01-16 21:33:57",
"Name" : "KWH_ILPO",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" :
[
0
],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : 8,
"SubType" : "Counter Incremental",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "General",
"TypeImg" : "counter",
"Unit" : 1,
"Used" : 1,
"ValueQuantity" : "",
"ValueUnits" : "",
"XOffset" : "0",
"YOffset" : "0",
"idx" : "115"
}
],
"status" : "OK",
"title" : "Devices"
}