Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variable Error in Scheduled Task
#1
I have a scheduled task that has been running for a long time that is now generating errors.  NOt sure when they started appearing, but I did upgrade last week and thats when I first noticed it when looking at the logs.

Below is the tasks (simplified) and it generates an error on the last line in the subtract statement

Devices::FieldRead

    P1=PowerPLC.$UnknownMsg
    P2=LVar:PLCErrorNow
    P3=False

Devices::FieldRead
    P1=Var1.PLCErrorPrevious
    P2=LVar:PLCErrorPrevious
    P3=False

LocalVars::Subtract
    P1=LVar:PLCErrorNow
    P2=%(LVar:PLCErrorPrevious)

Devices::FieldWrite
    P1=Var1.PLCErrorPrevious
    P2=$(PowerPLC.$UnknownMsg)
    P3=False

Output from test window


----------------------------------------------------------


TRC: Start Action
Global Vars=
----------------------------------------------------------
TRC: Start Action

Global Vars=

CMD: 001.  (1ms) - Devices::FieldRead
    P1=PowerPLC.$UnknownMsg
    P2=LVar:PLCErrorNow
    P3=False


CMD: 002.  (1245ms) - Devices::FieldRead
    P1=Var1.PLCErrorPrevious
    P2=LVar:PLCErrorPrevious
    P3=False

VAR: Set variable 'LVar:PLCErrorPrevious'
       =6834

CMD: 003.  (9ms) - LocalVars::Subtract
    P1=LVar:PLCErrorNow
    P2=6834

TRC: End Action [Result=Failure]

Error information

Variable LVar:PLCErrorNow was not found

I cant find anything wrong with this that would cause the error (WIll probably find it about 5 minutes after posting though).

Any one with an eagle eye spot the error.....
Mykel Koblenz
Illawarra Smart Home
Reply
#2
The most likely scenario is that the first read is failing. Since the last parameter is false, that tells it not to generate an error, but you aren't checking the return value. So it would just silently fail and the output variable would never get created.

So you should probably put it in an If/Else and log something in the Else that the PLC error state couldn't be read.
Dean Roddey
Explorans limites defectum
Reply
#3
I found the issue - you were right. THe variable was not being created because of the failure to read the field.

I am pretty sure that I tested all this when I wrote it - yet the field has changed from $UnknownMsg to $UnknownMsgs.

Is there any chance you changed the field names somewhere along the way?
Mykel Koblenz
Illawarra Smart Home
Reply
#4
Yeh, it was changed at some point. I think it was sort of by accident, though it is more correct to be plural. By the time I realized it it had been quite a while so I didn't want to change it back and possibly make things worse.

Sorry about that.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamically Build Call to Variable? gReatAutomation 8 385 05-08-2020, 01:22 PM
Last Post: gReatAutomation
  I updated to the latest beta version of CQC, and now getting libvlc.dll error? ghurty 2 184 04-29-2020, 07:06 AM
Last Post: ghurty
  Action wait and exit if variable changes simplextech 8 779 02-01-2020, 12:35 PM
Last Post: simplextech
  Web Camera: libvlc.dll error simplextech 12 1,424 01-12-2020, 02:40 PM
Last Post: simplextech
  Client side error dialog popping up xlurkr 3 434 01-04-2020, 04:01 PM
Last Post: xlurkr
  Scheduled Events Caseta tom 18 1,800 12-22-2019, 07:06 AM
Last Post: Dean Roddey
  Log Error George M 1 325 12-11-2019, 01:01 PM
Last Post: Dean Roddey
  Pause / Resume Triggered or Scheduled Actions from the Interface Viewer gReatAutomation 2 559 10-30-2019, 01:38 PM
Last Post: gReatAutomation
  Scheduled Events - Cannot find the specified path gReatAutomation 4 531 08-16-2019, 12:21 PM
Last Post: Dean Roddey
  Time formatting RunTime Time Variable? gReatAutomation 5 794 08-14-2019, 05:23 AM
Last Post: gReatAutomation

Forum Jump:


Users browsing this thread: 1 Guest(s)