Timer Issue in Blockly

Does NSPanel_weather update under other circumstances or only in response to this rule? If it’s only in response to this rule, than the easiest thing to do would be to create a separate rule that triggers when NSPanel_weather updates and do what ever you need to there.

Based on my experiments, linking to ChatGPT causes autoupdate to be turned off on that Item. This is good because it means the Item won’t actually update until after ChatGPT responds and not on the command you send to the Item with your query. So a separate rule will only trigger once ChatGPT responds.

Beyond that, OHRT includes a looping timer which implements exactly what @stefan.hoehn describes.

OHRT can be installed from openhabian-config, maunally from the command line (npm install openhab_rules_tools), or there is a rule template to install OHRT (install the template, create a rule based on the template, and run it, watching the logs for errors). Then there is a block library that needs to be installed to access OHRT from Blockly.

The rule template and block library can be installed from the Add-on store in MainUI.

The looping timer block looks like this:

The condition on the until dictates when the loop stops. So this example will create a timer that runs every second until loopCount is >= 5. When it runs, it logs out the loop count and increments it. But for your use case, you’d test to see NSPanel_weather changed and do what ever it is you need to when it does and then the exit condition is if the loop > 10 or NSPanel_weather changed.

Note that timers are not blocking. The rest of the rule will run after the timer is created. Then in the background the timer runs in the background.

1 Like