Rule triggered by Timer: Not implemented?

Hi, I am trying to write some rules that are triggered once every hour. I assume I would want to use “Timer” as the condition but it says “Timer not implemented”. May I know if it will be implemented soon? Or some pointers if I should try to implement it myself?

Thanks!
Jeffrey

Hi Jeffrey, we can not tell yet when we have implemented the timer. However, you might be able to use the ‘schedule’ to achieve the same? Please describe the exact use case, so we can think along (and possibly see where we have a gap to fill :slight_smile: )

Hi Pierre,
Thanks for the reply! Let me briefly explain my scenario: We have say 50 energy producer assets and we use an HTTP agent to fetch their “total energy export” and update onto the attribute of each asset via attribute link (agent link polled once per 10 minutes).

We want to use a Rule
Trigger: When any of the energy producer has a “total energy export” > 0
Result: Send an email to a user

What we want to achieve is to have an email that contains all assets’ “total energy export” like a summary report. Since the agent is polled every 10 minutes, we expect we would receive an email every 10 minutes (when the agent polls the data and update the attribute).

However, we did not receive any email (despite the fact that the agent kept updating the attributes without problem). I was wondering if we should use a timer as the trigger of the rule instead of when any of the energy producer has a “total energy export” > 0?

Thanks for your time and input! :slight_smile:

Hi Jeffrey, first of all, did you configure a mail server (sorry for asking :slight_smile: ).

Secondly, does each of the 50 energy producers need to send to an e-mail or are you adding up all 50 values into a single attribute? If it’s individual, you should set a rule per energy producer where each can have his own e-mail adres.

Note that, if you use ‘any producer’, the rule will trigger when the first ‘producer’ is meeting the condition, but needs a reset of the rule, before triggering again for any other ‘producer’. A reset is done only when none of the producers meet the condition. (So that might never happen…)

Hi Pierre, thanks for the prompt reply!

1&2) Yes, the mail server is set up and I forgot to mention that I was able to receive the email when I manually update the “total energy export” attribute of a random producer to say 10
Here is a screenshot of the email I received, it is exactly what I need


What I want is one email summarising all producers’ wattage

  1. Ha! I am not aware that it needs to be reset by having none of the producers to meet the condition… I guess this is the reason why no subsequent email was received because the wattage is always larger than 0. May I know more about how to use “schedule” as you suggested above?

Thanks again for your help!

I wasn’t clear about the use case earlier on, so don’t think schedule can work in your case. You might try a repeating occurence schedule with a time period each day (so disable ‘all day’). It might be that the rule resets in that case and at least it could be triggered once per day. But not sure whether it works and whether it’s a solution for you?

No problem, let me try and hopefully share back some lessons learnt. :slight_smile:
Thank you @Pierre !

Hi Jeffrey,

It’s been a while, but the Time condition for the When-Then rules has been implemented. You can use it to trigger a rule for a given time of the day, or on sunrise, sunset, or twilight. This is not exactly the function you were looking for (yet), but you can use it to create what you wanted to do by adding the Time condition 24 times as OR conditions :slight_smile:
Later we could also add a “Every x minutes” option.

Don

2 Likes

Thanks @Don for the update! :grinning:

Hi Jeffery,

How did you setup your mail server?

And/or can you point me to how to documentation.

thanks!

Hi bobster888,

I am not 100% sure since I have not worked on OR for a while. I think you can customise the following fields in the deploy.yml to set your mail server

# Configure Email, SMTP server to send password reset emails etc.
      OR_EMAIL_HOST:
      OR_EMAIL_USER:
      OR_EMAIL_PASSWORD:
      OR_EMAIL_PORT: ${OR_EMAIL_PORT}
      OR_EMAIL_TLS: ${OR_EMAIL_TLS}
      OR_EMAIL_X_HEADERS: ${OR_EMAIL_X_HEADERS:-} # Headers to set on all outbound emails

Link: https://github.com/openremote/openremote/blob/master/profile/deploy.yml

2 Likes

Yeah … I was going in that direction … will need to dig deeper.

thanks jeffrey.