Automation Help - Timed Automation Doesn’t Seem To Be Triggering

This might be a bit long, but please try to stay with me as I try my best to explain.

I have two air conditioners that I i am automating. Neither can the automated directly through SmartThings, so to do this, I have a couple virtual switches (I am using TAustins vEdge Creator, Alexa Switch which generates a contact switch for Alexa) that when triggered will start an Alexa Routine to turn on or off the air conditioners.

THE SETUP
Air conditioner, one has two automations, one to turn it on based on time and temperature and the other to turn it off (regardless of time). The first automation says, if the time is between 8am - 11pm and the temperature sensor in the room has a temperature equal to 73°F or above then turn “on” the virtual switch. This then triggers the Alexa Routine to turn on the physical air conditioner. The second automation says, if the virtual switch is “on” and the temperature sensor is equal to 71.9°F or below, then turn “off” the virtual switch, which triggers the Alexa Routine to turn off the physical air conditioner.

Air conditioner two, has four separate routines (this is because it’s in a bedroom, so there are day and night automations to achieve different temperatures). The first set of automations for daytime says; if it is 8:30am - 7:59pm and the temperature sensor is equal to or above 73.1°F then turn “on” the virtual switch. The other daytime automation says if the time is 8:30 AM - 7:59 PM and the virtual switch is “on” and the temperature sensor is equal to or below 71.9°F then turn “off” the virtual switch. The second set automations for air conditioner two says; if it is 8:00pm - 4:00 and the temperature sensor is equal to or above 72.9°F then turn “on” the virtual switch. The other automation says if it is 8:00pm - 4:00am and the virtual switch is “on” and the temperature sensor is equal to or below 71.9°F then turn “off” the virtual switch.

THE PROBLEM
It seems that the automations for both air conditioners won’t run without some intervention. For example, in both spaces right not (as I’m writing this) the temperature is 76.1°F and 74.4°F respectively and it is within the time limits set (it’s is currently 10:50am EST) but both air conditioners are off because the automations haven’t run. However, if I were to go into ST and turn on the virtual switch for both device, the automations runs perfectly for both … the automations turn off and on both virtual switches (and in turn triggering the Alexa Routine to turn off and on the actual air conditioners) until the prescribed time limit; which is 11 PM for air conditioner one and 4 AM for air conditioner two … but the automations don’t seem to run until, or before I intervene.

THE SOLUTION OR WHAT AM I DOING WRONG?
That’s what I’m asking. Is there something I am missing? Can I check to see when and what automations are running or not running or what is going on?

Thanks in advance for any and all help.






You can see Routine and device history in the ST app using the 3 bar menu and selecting History and applying/removing any Filters as needed. Look to see if the Routine is actually running as well as if the sensor is reporting temp changes.

What are you using to create the virtual devices? There were issues with the combo switch/sensors that are created by the vEdge Creator driver that made them work inconsistently (or not at all) for triggering Alexa routines.

Hi,

Yes, I am aware that I can see the history there, I guess I was wondering if there was anything more advanced … I know the routine is running, because it works because if I turn on the switch in SmartThings the routines will run no problem. It’s that they are not starting without me at least turning on one or both of the switches at least once … I don’t want to have to interact with them at all, I want them “automated.”

I am using the Alexa Switch from @TAustin. I have it configured so that the has a matching contact sensor for Alexa, which is what actually triggers the mountie.

The problem isn’t with the Alexa Routine, as the routine runs consistently is the switch is turnt on or off. The problem is on the ST side. ST isn’t triggering the routine until I at least interact with the virtual switch at least once.

I have included a screen shot of the “history” which shows that the automation (one of them, because it just met the criteria) just ran. The sensor is reporting the temperature and the routine is firing … because I had interacted with the switch earlier.

Thanks.

The problem as I understand it, and I may not be 100% correct is that you are waiting for a ‘change’ in the value of the sensor reading to trigger the automation. It is the same limitation of sensor characteristics that I have found in the past, and have adopted 2 alternative solutions.

  • I run a rule with the Every command every [30] minutes, running a check virtual trigger and setting the sensor value as a pre-condition. The trigger checks the value and fires.
  • Use @Mariano_Colmenarejo 's Zigbee Temp Sensor and Child Thermostat MC driver, changing mode to Cool in summer (opposite winter!) to trigger. It’s well documented on another thread, and although it needs some fine tuning runs really well.

Thank you very much for the reply.

I am not sure I quite follow; would you mind elaborating further? I know that the temperature is always going to change, and that the sensor is going to report that change at some point, so shouldn’t that trigger the routine?

Would you mind giving an example of the rule you are running? I am not familiar with writing rules (though I literally just uploaded my first rule … but that was a cut and paste job).

I will take a look at @Mariano_Colmenarejo Zigbee Temp Sensor and Child Thermostat MC driver.

Thanks

For the sake of this post, let’s consider a Routine being ‘triggered’ to mean that the Routine examines the current logical value of all its conditions to see if it needs to run any of the actions. I am not saying that is a preferred term, or if it is that it means what I just suggested, only that I need a word to use for that specific thing.

The logical values of Preconditions are constantly being updated as events happen but this never results in the Routine being ‘triggered’.

The logical values of other conditions are also constantly being updated by events and this will often result in the Routine being ‘triggered’, but not always. Under the bonnet there may be an option to either trigger every time there is an update, or to only trigger when the condition changes from false to true, or true to false. My understanding is that the ‘equal to or above’ comparison has been implemented in the latter fashion.

I would suggest you consider when the temperature changes are actually happening, in case the temperatures are already above the thresholds when the preconditions become true.

1 Like

@orangebucket Thanks for the response.

If I understand what you’re saying correctly, I should change the trigger to be “If Temperature is ‘X’” then execute. Is that correct? For example, “If Temperature is 72°F,” then execute. If so, the problem I have found with this is that the temperature sensors make incremental changes and this might not capture that change … so the temperature might go from 73°F to 72.5°F and then to 71.9°F in which case, the automation would not get executed as the value of 72°F would have been skipped. Also, that doesn’t explain why the automation runs as expected once I have interacted with the switch at least once.

No. What I am saying is that if you have a time precondition from 8pm to 4am you need to consider whether the temperature is already over the threshold at 8pm. This can be done by running a Routine at 8pm.

An approach that some people use is to have the time period represented by a virtual switch which they turn on at 8pm and off at 4am. Then instead of the time period as a precondition they use the virtual switch as one of the conditions.

Try turning off the “use as a precondition” option and the select the “when all conditions below are met” option instead and see if that works.

Okay, I think I understand a bit better now. So you’re saying that for example, with AC 1, if the temperature is already above the 73.1°F at 8:30am (let’s say it’s at 74°F at that time) as opposed to changing from 73°F to 74°F at 8:30am (or changing during the specified time precondition), this is what’s preventing the automation from running as it was already above the starting range?

Is that correct?

1 Like

Can’t. A “Period of time” trigger in an automation is always used as a precondition. If it were a specific time (as opposed to a specific period of time) then it wouldn’t be a precondition.

Yes that’s correct

Yes that’s it. I don’t know that is the issue in your case but it is worth considering as it happens a lot.

I haven’t thought about how you are using switches in your Routines but I would say that in general there is a temptation to use them as a precondition as it just seems the right thing to do. However it can be that as conditions they provide an extra trigger that can be useful and is at worst harmless. So they do need thinking about.

You might try looking at the routine logic in SmartThings® API Browser+

You will need a PAT (personal access tokens page) with full authorization to use the Browser

Once the SmartThings® API Browser+ is open, select your routine by selecting Automations->Routines and then select Details. This will show you the logic that the routine has implement. This should help you understand where the issue is, or post the routine json here so others can see how the routine is implemented.

As you can see there is more than one approach to solve the same problem. My suggestion is probably not the best, but I find it useful to have a continual check on a series of conditions, be it in this case temperature, or cases like humidity, air purity, status of certain doors etc, when in these scenarios there exist various preconditions.

For what its worth you can take a look at this simple rule, once published then you can use in any Routine, switching it off afterwards in actions. If you´re impatient one day you can even tell Alexa to “Switch on Check Switch” !
Hope you find your best solution one way or another.

{
    "name": "Every 30 minutes run Check",
    "actions": [
        {
            "every": {
                "interval": {
                    "value": {
                        "integer": 30
                    },
                    "unit": "Minute"
                },
                "actions": [
                    {
                        "command": {
                            "devices": [
                                "Your Virtual Check Switch ID"
                            ],
                            "commands": [{
                                "component": "main",
                                "capability": "switch",
                                "command": "on",
                                "arguments": []
                            }]
                        }
                    }
                ]
            }
        }
    ]
}

Thanks. I did take a look at the routine in the API Browser+, but I think it’s what @orangebucket and @nathancu said, the starting value was already past what the routine was looking for.

Thank you!

Thank you very much for this! I really appreciate all the help.

One question about the code … I wasn’t aware that you could run a rule within a routine. I have been looking for a bit and can’t seem to find anything. Do you mind assisting a bit further? How would I set that up to run inside a routine?

Thank you

I’m not sure if you have solved this, but I was able to get virtual device to turn on and off based on temperature change and time. See below for the routine and history of the virtual device NewVD. Note that I was using an outside temp sensor I was at the mercy of the weather. At 10:34AM the temp raised above 76 and went back below 74 at 6:55PM

  • First you need to create a Virtual Check Switch (recommend you use the ‘Momentary Button Only’ from @TAustin vEdge Creator to not have to worry about switching it off).
  • The ID for this then use in the rule, which basically all it does is pushes this Check Switch every X minutes.
  • Then use this Check Switch in routines, I think more convenient than rules for editing, modifying temp values etc; example, just one of several I have, in this case to check fresh air ventilation

My solution is just one of several but you might want to take into consideration.

1 Like