Run "something" at certain time -tile?

The variables are set on a dashboard tile. I would like the variables set to blank {{}} but settled for x when I couldn’t get blank to work.

Clock manually delete x and enter military time (ex. 0600)
Clock rule id ImcFahEN06isbj1YOMuA

Hour manually delete x and enter single digit (ex. 7)
Hour rule id koNjieEYCspZpRL31OBC

The rule debug logs show

Summary
Message
Rule was not triggered by the variable event. No trigger condition was matched.


Runtime Data
[
  {
    "type": "event",
    "subtype": "variable",
    "data": {
      "platform": "sharptools",
      "uid": "VC92ednwcAb4mZaYu8hlCMsNGh93",
      "variableId": "AlarmSetTimeClock",
      "value": "x",
      "datetime": "2024-01-26T13:35:10.200Z",
      "source": "VARIABLE"
    }
  }

Edit to add details:
I just double checked and both variables are strings. Should they be numbers instead?

I think it’s the format of the input being used rather than the type. It looks like you are inputting the time in the format 0600 rather than 06:00 AM from the original example.

When the actual comparison is done, the 0600 is inferred as numeric. Even with string values, the comparison checks to see if the values are numeric and if so compares them as numeric - this was intended to support cases where numeric strings were compared (eg. “2500” > “35” is false as a string but true when they’re numbers).

So you could either:

  1. Change the Trigger condition to something like is not -1
    • And set the ‘reset’ value to -1 instead of x
       
  2. Change your input format to include the colon (eg. HH:mm)
    • You can still use 24 hour time, but the colon forces the trigger comparison as a string

Thanks for all the help Josh. I was able to get these working by setting the default value of the tiles to 0 and the trigger to if $var changes and is not 0. I can enter the values as a whole number or as 4 digits.

A little context of what I was working on…
A while back when Webcore shutdown for SmartThings, I replicated an alarm clock rule into Sharptools. This wasn’t ideal as I had to use static variables for each possible time. Over time, I ended up with about 20 variables just for times and each variable required 4 rules (80+ rules total). This did not include the other variables used in the rules.
I have now recreated the alarm clock that plays announcements over Alexa, turns stuff on, sets the thermostat an hour before the alarm goes off in the winter and when the alarm goes off the rest of the year. I have maximum flexibility for the timing by using 1 variable where I can select the number of hours before the alarm goes off, i.e. 8 hours, and the other where I can enter the actual time for the alarm to go off, i.e. 6am.

I have now combined this into 15 variables and 12 total rules, including the 2 you are helping me with which simply display the time the alarm will go off on a dashboard (not critical to the alarm function) and a rule that resets everything when I get up.

As I said, I have them working for now and am pretty happy with the outcome but I would still like to understand why setting the trigger as updates and is not {{}} (blank space) or changes to not {{}} (blank space) would not trigger the rule when a value was entered in the variable? I was reading through some older posts and found this exact suggestion.

I tried setting the default variable value to blank space by manual input and from a rule using {{}}, {{ }}, and expression input of "", and " ". The rules would not register a variable change when a number was entered in the variable but would occasionally trigger the rule when the variable was cleared.

Again Josh, thank you for all the help!

I presume you mean a literal empty input in the trigger field (eg. add some text and then delete it so the field is blank) rather than the actual double brackets that are typically used for inline expressions.

It’s the format of the input being used. Since it’s a pure numeric value and doesn’t have the : delimiter in it, the comparison is treating it as numeric.

I have an idea on how this can be improved, but since it’s such a deeply shared part of the engine, it’s not something I want to change on a whim.

I realize this is the same explanation you gave before but this time it somehow made sense. :rofl:
I have it working and am happy with the outcome. Thanks again for all your help!

1 Like

I created a separate thread here to show how my example works for an alarm clock.