A few old, unchanged VBScripts that increment counters fail in 3.0.0.187, 280, and 293, but work fine in 3.0.0.163 when using hs.CounterIncrement("countername") or it's decrement counterpart in a script.
I backed down to 163 and the counter increments fine, but I recently bought an Amazon Echo and had to upgrade to 280 to use it.
The old problem is back, so I just downloaded 293 and still have the same problem. Has anyone else run into a similar issue?
Here's one of the scripts (note the call to write the before/after and counter values to the log at the end):
Here's the log entry:
Type/Error Message/Source
CellCount Correction 2 => 1 (CellCount=2)
The script gets the current value of the counter and correctly calculates and displays the oldcount and new cc values, but the CellCount counter remains unchanged.
Sub CountCellPhones(var)
DIM cc As Integer
DIM oldcount As Integer
cc=0
oldcount = hs.Countervalue("CellCount")
'check for my phone, Device ID = 336
IF(hs.DeviceValue(336)>0) THEN
cc = cc + 1
END IF
'now check for wife's phone, Device ID = 99
IF(hs.DeviceValue(99)>0) THEN
cc = cc + 1
END IF
IF (cc< hs.CounterValue("CellCount")) THEN
WHILE (hs.CounterValue("CellCount") < cc)
hs.CounterIncrement("CellCount")
END WHILE
ELSE
WHILE (hs.CounterValue("CellCount") > cc)
hs.CounterDecrement("CellCount")
END WHILE
END IF
IF (cc <> oldCount) THEN
hs.WriteLog("CellCount","Correction " & oldCount & " => " & cc & " (CellCount=" & hs.Countervalue("CellCount") & ")")
END IF
End Sub
I backed down to 163 and the counter increments fine, but I recently bought an Amazon Echo and had to upgrade to 280 to use it.
The old problem is back, so I just downloaded 293 and still have the same problem. Has anyone else run into a similar issue?
Here's one of the scripts (note the call to write the before/after and counter values to the log at the end):
Here's the log entry:
Type/Error Message/Source
CellCount Correction 2 => 1 (CellCount=2)
The script gets the current value of the counter and correctly calculates and displays the oldcount and new cc values, but the CellCount counter remains unchanged.
Sub CountCellPhones(var)
DIM cc As Integer
DIM oldcount As Integer
cc=0
oldcount = hs.Countervalue("CellCount")
'check for my phone, Device ID = 336
IF(hs.DeviceValue(336)>0) THEN
cc = cc + 1
END IF
'now check for wife's phone, Device ID = 99
IF(hs.DeviceValue(99)>0) THEN
cc = cc + 1
END IF
IF (cc< hs.CounterValue("CellCount")) THEN
WHILE (hs.CounterValue("CellCount") < cc)
hs.CounterIncrement("CellCount")
END WHILE
ELSE
WHILE (hs.CounterValue("CellCount") > cc)
hs.CounterDecrement("CellCount")
END WHILE
END IF
IF (cc <> oldCount) THEN
hs.WriteLog("CellCount","Correction " & oldCount & " => " & cc & " (CellCount=" & hs.Countervalue("CellCount") & ")")
END IF
End Sub