I am having a problem with extracting information from a json file.
The relevant sections of my code are:-
Code: Select all
[MeasureOffice2]
Measure=Plugin
Plugin=WebParser.dll
URL=#CURRENTPATH#Office2.json
RegExp=(?siU)"mode": (.*), "CalculatedTemperature": "(.*)", "CurrentSetPoint": "(.*)"
[MeasureOffice2Mode]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureOffice2]
StringIndex=1
[MeasureOffice2CalculatedTemperature]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureOffice2]
StringIndex=2
[MeasureOffice2CurrentSetPoint]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureOffice2]
StringIndex=3
[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=Room Temperature
[meterLabelTemprature]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=Temperature
[meterValueTemperature]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureOffice2CalculatedTemperature
X=200
Y=0r
; r stands for relative. In this case, the Y position of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1
; %1 stands for the value of MeasureName.
The contents of Office2.json are :-
Code: Select all
{"id": 5, "ScheduleId": 5, "ComfortModeScore": 927, "HeatingRate": 1200, "SmartValveIds": [8], "Name": "Office 2", "Mode": "Auto", "DemandType": "Modulating", "WindowDetectionActive": false, "ControlSequenceOfOperation": "HeatingOnly", "HeatingType": "HydronicRadiator", "CalculatedTemperature": 182, "CurrentSetPoint": 180, "PercentageDemand": 0, "ControlOutputState": "Off", "SetpointOrigin": "FromSchedule", "DisplayedSetPoint": 180, "ScheduledSetPoint": 180, "AwayModeSuppressed": false, "RoundedAlexaTemperature": 180, "EffectiveMode": "Auto", "PercentageDemandForItrv": 0}
The regex is one I found in a thread on this forum. I assume that, for my case, it is not valid.
I did try to validate/debug the regex on regex101 but the message 'Your regular expression does not match the subject string.' did not help.
I have never needed to use regex before and I am totally in the dark here.
Can someone shed a bit of light for me?
Thanks