So, I have over thought this multiple times and decided to clean it up based on some data @Sebastien and @Alan_F supplied in a Tesla Charge Rule. Thank you guys..
Originally I had this rule written to repeat until all Tires were above a specific value.. I now have the required expression cancelling actions if it becomes false.
I also used modes because I do not want notifications while in Sleep Mode.
Virtual switch is to notify, via notification Alexa Devices in home.
I have a similar rule, and the issue you're going to have is that if all 4 tires are low (like due to a sudden temperature drop) the rule will fire multiple times, and it will likely happen so fast that even if you try to prevent that by adding a required condition that the private Boolean is true and set the private Boolean false on the first line it won't happen fast enough to prevent the multiple activation.
I'm using a contact debouncing app that was posted here to work around it. I'm typing this from my phone, but when I'm in front of a bigger screen and keyboard I'll post the details of how I set it up.
I try and keep tire pressure at 38-40.. The car is running 20s staggered and my wife seems to find every damn nail in the road from home to work.....SMH
I can see the issue with it triggering up to 4 times if a sudden cold spell comes overnight....
Maybe grouping the tires would be a work around.
I changed it up a bit using XOR, maybe this will help with multiple triggers at same time.
As its written, and I undertand it,, Required Expression:
IF mode is Away, or Day, or Evening and one of the tires reports low, the required expression will become true and triggers will be applied.
IF the required expression becomes false, the remaining actions are cancelled, if applicable.
In order to group Custom Attributes, as i see it, I would need to create multiple virtual switches based on each tire pressure.
Step 3:
Add a debounced contact
On the menu click Apps:
At the top right click + Add user app:
Select Debounce Contact:
Name the debounced contact (mine is called "Debounced Model 3 TPMS" and select the virtual contact you created in step 1 as the sensor to be debounced.
The first rule calls the virtual contact sensor. Mine is called "Cars - Model 3 tire pressure alerts - call debounce"
Required expression: private boolean is true (used to limit to one activation per day)
Triggers: One for each tire being less than limit (same as you have now)
Actions: close virtual contact sensor (Virtual M3 Contact)
This rule will trigger up to 4 times. It will hit the virtual contact sensor with 4 close actions in quick succession, even though you would think a closed sensor couldn't be closed again. But it can, which is exactly why the debounce app is needed.
The second rule will only fire once after 1,000ms. Mine is called "Cars - Model 3 tire pressure alerts"
Trigger: Debounced Contact (Debounced Model 3 TPMS) closes
Actions:
Set private boolean false on the first rule
Send the notification (my rule sets a bunch of local variables first so I can include the tire pressure readings in the notification, but add whatever notification actions you want)
Open the virtual contact sensor (the bouncy one - "Virtual Model 3 contact"), delayed 10 seconds
Set private boolean true on the first rule, delayed 24 hours (this ensures I will only get notified once a day max)
So the sequence of events is:
Tesla Connect reports all 4 tires low when the car starts moving
The first rule fires 4 times in rapid succession, closing "Virtual M3 Contact" 4x
The debounce app closes "Debounced Model 3 TPMS" once
That triggers the second rule, which fires only once
It sets the first rule's private boolean to false
Then sends the notification
Then reopens the Virtual Model 3 Contact 10 seconds later
And finally it resets the Private Boolean on the first rule 24 hours later so it can trigger again
Using the XOR wouldn't work for me, because even if it succeeded in debouncing the notifications, (and I'm not sure that it would... see below) then it would mean that I would only get one notification for the first value to drop below the limit. Since I include all 4 tire pressures in my notification, I want to make sure the rule only fires after all 4 values have been updated.
I'm also setting my threshold for 1.5 psi below optimal as I'm trying to get alerted when the tires need air due to weather changes even if they're not going flat. So I'm likely to get multiple tires going below threshold at the same time. The odds of two of your tires going below 32 at the same time are much lower, so you may not have a multiple trigger issue at all.
If I understand the linked post correctly, your rule will only fire when a second tire goes low. You need one tire (and ONLY one tire) to go low to make the required expression true. Only then would the second low tire actually fire the trigger.
Combine that with the possibility (especially if you were to go with higher thresholds) that all 4 conditions in the required expression might go from (F) to (T) within a few milliseconds when the car first starts to drive and I have no idea whether this would work at all in that scenario.
So for one tire going flat, your current rule won't notify you. For two going flat separated by a few seconds, it will notify you on the second one. For all 4 reporting low at the same time... your guess is as good as mine.
I really like the idea of a notification on low pressure. I wonder if the Tesla app also does this? Regardless, here’s the app that I would use for this (trying it out for myself at the same time!).
I made this simple by having one rule created per tire. (Create one rule, then clone it.). I have set a low threshold pressure value that I suspect is low enough that cold temperature won’t impact it. If it does, I will change the variable to a lower value. (I’m using a rule variable, but could also setup a Hub variable which would allow it to be changed only once for all tires.)
Note that the tire pressure doesn't report until the tires are spinning (that's the behavior on my Model S and Model X, as well as all the other cars I've owned with TPMS). So you'll likely get this notification at the same time as the car will tell you on the dashboard.
@Sebastien ---- I'm still pretty new at this, stoppable function eludes me, even though I have read up on it.
What is triggering the "stop"
@Alan_F - I See the issue with XOR.... Im moving it back to AND for now....
I will also work on your data for debounce tomorrow--- or later today rather. lol
I need to understand the concept before trying it...
@jlv - With most BT sensor vehicles, they only update when the tires moves and wakes up the device... IF there is a sudden pressure change, increase or decrease, the sensor should wake up and register... Try adding air to a tire with out moving the car, the car should register after a minute or so.
In the example I provided, I enabled the stop but there is nothing in the rule that would cause it to stop. However, I could add a “Stop Repeating Actions” command somewhere in an if condition within the loop that would stop it from continuing. I could also add a “Cancel Rule Timers” in this or another rule that would point to this rule.
From the Hubitat Documentation:
“ Some method to stop the repetition is required. One option is the Repeat n times option, which will stop the repeat after n repetitions. Alternatively (or additionally), if the Stoppable? option is selected on the Repeat... , then a Stop Repeating Actions action elsewhere (often in the other half of an IF THEN /ELSE inside the repeat) will stop this repeat when called from elsewhere in the rule. As an alternative, Cancel Rule Timers from either the current rule or another rule will stop all repeats (and other rule timers), regardless of whether this option is selected.”
A quick Google says that TPMS are required to notify when the tire is 25% above or below the recommended pressure, so 33.75 my Model 3 that recommends 45 psi and 31.5 for configurations that recommend 42 psi. In the examples above, the hubitat notifications would be happening very close to the TPMS notification.
I don't see much value added by notifying my phone of something the car will already be notifying me of. Also since Tesla has added tire pressures to the mobile app, I'm assuming, but not certain, that the out of range warning will alert in the app as well as in-car.
Maybe not everyone would want the notification going off at 1.5 psi low as I'm doing, but if you're trying to run the tires at 42 psi wouldn't you like to know that some of them are below 37 or 38? And if your threshold is as low as 32, are you ok with driving around indefinitely with one (or all 4) tires at 32.1 psi?
I like the idea of moving the threshold to a hub variable. Definitely more refined than changing it in 4 places when I occasionally decide to try running a slightly different pressure, and I can change it from a dashboard where I already control my charge limits.