[SOLVED] Expressions not auto-updating when dependencies change (22022)
-
Reactor 22022, Raspberry PI4 Buster, Docker
What is expected: When an expression value changes, dependent expression values will also change
What is occurring: When an expression changes, dependent expressions only update if I click "Try this expression".
After updating to 22021 and then 22022 I noticed that my Thermostat routine started having issues. While looking into the cause I found that dependent expression were not updating automatically.
My specific application is as follows: I have MSR poll the Lennox "iComfort" API to get the current state of the Thermostat via an HTTP request every minute.
The request returns a JSON response. The polling rule captures that response to an expression:That expression is being updated as expected:
Other expressions are set to the values of various parts of the g_iComfort response. For example the cool set point expression is set as follows:
These screen shots show that g_iComfort has the cool set point at 74, but g_tstat_csp is still 72 as I hadn't clicked the "Try this expression" button.
I have additional expressions set up for the heat set point, the operation mode, the humidity, etc.
Since g_tstat_csp is dependent on g_iComfort, if g_iComfort changes g_tstat_csp should change. When the polling rule runs each minute the g_iComfort expression updates, but none of the expressions that are dependent on g_iComfort update. If I click the "Try this expression" button, they update. On versions before 22021 they updated as expected.
As a test I set up two simpler expressions, one a string and one set to mirror that string:
The attached screen shot was after I set g_test3 to "bar" and clicked Save, then clicked "Try this expression" on g_test4 which caused it to update to "bar". I then changed g_test4 to "foo" and clicked Save which resulted in this screen shot where g_test3 is "foo" but g_test4 is still showing "bar".
-
This is exactly what I've tried to explain in https://smarthome.community/topic/873/api-poll-doesn-t-un-set-or-populate-child-expressions, mine is bare metal.
-
@toggledbits in another similar example, updating a global expression no longer triggers a rule that uses this variable.
Until version 22004 there was no problem.
If I manually activate the Reset Rule. the update is performed on the chosen rule.
Thanks.
-
I searched through old topics looking to see if this was already reported, but somehow i missed your post.
I'm also seeing the issue where even when I update the expression, the new value doesn't appear in a rule that references it unless I manually reset the rule.
-
Opened Mantis 298 from the problem above.
-
SOLVED v. 22023! Thanks!
-
Ditto - just updated and a minute later the APIs ran as expected, lots of green status'. Many thanks, @toggledbits! Will close out the linked thread.
-
-
I'm still experiencing a strange behavior with 22023. I have a couple of reactions using expression, where they are null and are only updating when I manually press play, thus not firing the associated reaction when an expression changes. Am I the only one with such a problem?
-
@therealdb Mine have been working as expected since the latest build.
-
I still had issues, but then I realized that even after 22023 was posted, my install of the Docker 'latest' version re-installed 22022. Once I got 22023 the expressions seem to be working properly.
Probably unrelated to the updates, but I had a rare misfire this morning where Reactor didn't see a switch thrown on my Hubitat hub. I turned on a virtual switch via a Hubitat dashboard. That switch being on should start a reaction to set my Thermostat to daytime settings. The switch turns off automatically 5 seconds later. The MSR logs don't show the switch turning on (or off) the first time I clicked it, but the Hubitat dashboard showed it in an 'on' state for 5 seconds. When I clicked it again it worked as expected. I use that function every night and every morning and this is the first time I can remember it failing.
-
@gwp1 @Alan_F and @therealdb
Trying to collaborate with the discussion, what I have seen is that actions that occur during the update process, ie if I turn on or off some switch, or if there was an action in progress and I perform the update the state of the action would end during the update, this action remains activated and switch with old status. In other words, it seems to me that maybe there has to be something that downloads all the actions, performs the update, and then when restarting with the new version restarts the actions. Or also take the updated status of the devices.
In theory that's what MSR does, that's what I see in the logs, but my feeling is that again we come back to the issue that MSR is much faster than Hubitar and things get left behind when rebooting. When we manually reload an action, or turn a switch on or off, we do a manual re-sync.
My suggestion is on the next update, we have to watch the ongoing actions that are paused and the status of devices, perform the upgrade, look at the log when it returns and try to create some consistency in this eventual problem scenario.
-
@alan_f said in [SOLVED] Expressions not auto-updating when dependencies change (22022):
Probably unrelated to the updates, but I had a rare misfire this morning where Reactor didn't see a switch thrown on my Hubitat hub. I turned on a virtual switch via a Hubitat dashboard. That switch being on should start a reaction to set my Thermostat to daytime settings. The switch turns off automatically 5 seconds later. The MSR logs don't show the switch turning on (or off) the first time I clicked it, but the Hubitat dashboard showed it in an 'on' state for 5 seconds.
Do you have the community Hub Information app installed, with a device created for it?
-
@toggledbits Yes, I have the hub information app and I see the data from it in MSR and Influx.
-
Had the same issue with the same switch last night. Google assistant turns the virtual switch on. The Hubitat turns it off 5 seconds later. Reactor should see the switch on and initiate the night thermostat and lights-off actions. The logs on the Hubitat show the switch turned on, but Reactor missed it. On a second attempt, Reactor reacted. I definitely notice if this reaction fails, as the lights in the bedroom don't turn out. I can't remember any failures prior to version 22021. I haven't made any changes to the default settings related to the communications with Hubitat, but I was under the impression that those related to ensuring that MSR didn't hit Hubitat with too many commands at once, so I'm not sure they would have any relationship to MSR not receiving an entity update from Hubitat.
-
toggledbitswrote on Jan 27, 2022, 2:52 PM last edited by toggledbits Jan 27, 2022, 1:02 PM
In
logging.yaml
, turn up the logging on HubitatController by adding a section like that shown below. Indent theHubitatController:
line like the other items already in the file. IfHubitatController:
is already in the file, just modify it as shown. Then restart Reactor. Capture the log file (name shown below) the next time this happens (make sure the time range in the file includes the time range of the miss). I will need the entire log without redaction, the time of the (non-)event, and your timezone. I'll give you a safe place to post the log when you have it.Do not take any corrective actions. At least, don't do anything for at least 5 minutes. Then you can fix whatever should have happened. But leave it alone at least 5 minutes after the expected event.
HubitatController: level: 5 streams: - type: file name: hubitat.log keep: 2 level: 999
-
Done. At the rate it's been going I'd expect it to be at least a few days before I get anything.
I am connected to two Hubitat devices... one at my house and one at my parents' house. If there is a way to filter by name should I have it only do the detailed logs for one to keep the log size more manageable?
If I get a misfire, will I need to pull the logs right away (after the 5 minute wait to re-issue the command) before they get overwritten? Since this happens at bedtime my wife would probably be happier if I wait until morning to pull the logs... she already won't be super happy with the 5 minute wait to turn out the lights. But it wouldn't be the first time I got out of bed to go to the computer and troubleshoot home automation
-
toggledbitswrote on Jan 27, 2022, 6:01 PM last edited by toggledbits Jan 27, 2022, 1:02 PM
You should have plenty of time before the logs rotate away. If in doubt, up the
keep
value to something higher, maybe even 10. How much it logs really depends on your system activity. Just to be safe, also remove therecycle: true
line (starts a new log on every Reactor restart -- don't need that, maybe don't want that).To limit the log to just the one unit, make the
HubitatController:
line read"HubitatController#id":
, where id is the ID you assigned to it in your config. I always quote when introducing special characters. -
Ok. Currently I have log from 14:47 hours at 1.3 MB, log.1 from 1411 hours at 2 MB, and log.2 from 13:31 hours at 2 MB, so it looks like I'm getting about 40 minutes per log file. I'll bump up the keep value and filter to just the one device id to make sure they persist until morning.
4/25