Global Expression – Reference Error
-
Hi!
After several tests, restarting the computer where the MSR is, and the MSR itself by Tools > Restart, I have a persistent error in the logs.
Looking at the global expression (screen below), I see that it is highlighted as an error, however, if I look at two other expressions above that have the same structure, they do not present an error, so I do not think the problem is with the expression's code.
This expression uses a group, which validates 4 devices of type door sensor, whether the status is true or false, door open or closed.
"dgc_entrance_open": name: DGC Entrance Open select: - include_entity: - "hubitat>37" - "hubitat>38" - "hubitat>99" - "hubitat>130" filter_expression: > entity.attributes?.door_sensor?.state == true
I also compared it with other groups, the structure is identical.
Looking at the 4 devices in this group, I see that all are active in the MSR, have similar variables, are used in other groups and rules that do not present a problem.
Looking at the log, I understand that it refers to some object that would be null, at which point I am lost on what to actually look at.
[latest-22118]2022-05-02T22:33:11.711Z <Engine:INFO> Reaction Engine starting [latest-22118]2022-05-02T22:33:11.719Z <Engine:INFO> Checking rule sets... [latest-22118]2022-05-02T22:33:11.746Z <Engine:INFO> Checking rules... [latest-22118]2022-05-02T22:33:11.748Z <Engine:INFO> Data check complete; no corrections. [latest-22118]2022-05-02T22:33:11.892Z <Engine:ERR> [Engine]Engine#1: error evaluating expression EntranceOPEN: [ReferenceError]ReferenceError: Invalid scope in reference to member attributes of (object)null [latest-22118]2022-05-02T22:33:11.893Z <Engine:ERR> [Engine]Engine#1: expression: sort(each id in ( getEntity('groups>dgc_entrance_open').attributes.sys_group.members ): getEntity(id).name) [latest-22118]2022-05-02T22:33:11.894Z <Engine:CRIT> ReferenceError: Invalid scope in reference to member attributes of (object)null ReferenceError: Invalid scope in reference to member attributes of (object)null at _run (C:\MSR\reactor\common\lexp.js:1449:31) at _run (C:\MSR\reactor\common\lexp.js:1443:33) at _run (C:\MSR\reactor\common\lexp.js:1443:33) at _run (C:\MSR\reactor\common\lexp.js:1536:38) at _run (C:\MSR\reactor\common\lexp.js:1480:33) at C:\MSR\reactor\common\lexp.js:1283:29 at Array.forEach (<anonymous>) at _run (C:\MSR\reactor\common\lexp.js:1282:28) at run (C:\MSR\reactor\common\lexp.js:1663:22) at Object.evaluate (C:\MSR\reactor\common\lexp.js:1699:20) [latest-22118]2022-05-02T22:33:12.232Z <Engine:NOTICE> Reaction Engine running! [latest-22118]2022-05-02T22:33:12.233Z <Rule:INFO> Rule#rule-kxjp2el2 (Mode DAY) started [latest-22118]2022-05-02T22:33:12.234Z <Rule:INFO> Rule#rule-kxjp7kc8 (Mode EVENING) started [latest-22118]2022-05-02T22:33:12.234Z <Rule:INFO> Rule#rule-kxjparz7 (Mode NIGHT) started [latest-22118]2022-05-02T22:33:12.234Z <Rule:INFO> Rule#rule-kxjpd0d6 (Mode AWAY ∆) started [latest-22118]2022-05-02T22:33:12.235Z <Rule:INFO> Rule#rule-kxjqrcr9 (Mode PARTY) started [latest-22118]2022-05-02T22:33:12.235Z <Rule:INFO> Rule#rule-kxjqyhnu (Mode VACATION ∆) started
Finally, if I return the expression and press the Try This Expression button, it is executed and the error disappears.
This situation started to occur on the latest version of Reactor 22118, on a Windows 10 Bare Metal installation. Does anyone have a similar scenario?
Sorry for the long post, I tried to document as best as possible to try to identify the problem.
Thanks.
-
Have you looked at the entity contents for
groups>dgc_entrance_open
? That's what it's complaining about. -
Have you looked at the entity contents for
groups>dgc_entrance_open
? That's what it's complaining about.I had not looked at it as an entity, but when comparing it now with others of similar group function, I see no difference in structure that might help understand the error.
Thanks.
-
You should have a file in the
storage/entities/groups
directory calleddgc_entrance_open
. Can you please post its contents? -
You should have a file in the
storage/entities/groups
directory calleddgc_entrance_open
. Can you please post its contents?{ "id": "dgc_entrance_open", "type": "Group", "name": "DGC Entrance Open", "source_id": null, "_lastupdate": 1651610485346, "deadsince": false, "can_rename": true, "can_delete": true, "primary_attribute": "sys_group.empty", "_attributes": { "sys_group": { "members": [], "empty": true } }, "actions": {}, "capabilities": { "sys_group": { "attributes": { "members": { "type": "array", "default": [] }, "empty": { "type": "bool", "default": true } }, "actions": {} } }, "notify_member_changed": true, "serialize_version": 2 }
Thaks.
-
OK, and let's be clear... does this happen on every restart, and only on this global variable? You have cleared the alert and restarted and verified that the alert returns?
-
OK, and let's be clear... does this happen on every restart, and only on this global variable? You have cleared the alert and restarted and verified that the alert returns?
Every time I perform a restart, the error appears, and always and only in this variable.
I clear the message, restart the variable and everything is fine. If I restart the MSR again, then the whole error scenario comes back.
Thanks.
-
OK, and let's be clear... does this happen on every restart, and only on this global variable? You have cleared the alert and restarted and verified that the alert returns?
ATTENTION: I have just installed the new version 22123, a new installation procedure, and the error does not happen.
I have tested restarting the MSR by Service and Tools > Restart.
We can close this discussion.
Thanks.
-
OK, but just to be safe, please do the following:
- Stop your Reactor service.
- Remove the reactor.log file from the
logs
subdirectory. - Restart Reactor.
- Post the log file.
I want to have a look from the start onward. Thanks!
-
OK, but just to be safe, please do the following:
- Stop your Reactor service.
- Remove the reactor.log file from the
logs
subdirectory. - Restart Reactor.
- Post the log file.
I want to have a look from the start onward. Thanks!
@toggledbits thank you for all your attention.
I tried to post the log here, but it exceeds the number of characters.
Can you indicate another place to send the file?
Thanks. -
I'll send you a link via PM.
-
Got it. Looks good. Perfectly clean. There was an incidental issue where the DGC was delaying releasing notifications on a group if the group filtered out all of its entities. You might have noticed different behavior had a door been open at the time Reactor restarted vs what appears to be the more common condition that all were closed (thus empty group displaying the bug). Onward!
-
Got it. Looks good. Perfectly clean. There was an incidental issue where the DGC was delaying releasing notifications on a group if the group filtered out all of its entities. You might have noticed different behavior had a door been open at the time Reactor restarted vs what appears to be the more common condition that all were closed (thus empty group displaying the bug). Onward!
-
T toggledbits locked this topic on