Oh wow, I think it can be done but this is definitely not a beginner level task. I’m going to have to do some thinking on this one.
I appreciate that you’re willing to think on it!
I imagine the components I’m suggesting fall into the following difficulties:
Easy
- Detect next phone alarm (I believe this is possible with “Test Next Alarm”)
- Detect if home (this should be possible with “Get Location”)
- 10 minutes after alarm is dismissed, change color temperature to 2700k
- Technically this could be a Google Home “when dismissed” routine, though I’m not totally sure if it can delay the action by 10 minutes.
- “Alarm Done” could also maybe do this.
- Set color temperature on my bedside lamp (an IKEA Zigbee dimmable with temperature/color changes) to 2200k (assuming this is a simple API command)
- Set dimmer on my bedside lamp to 1% (assuming this is a simple API command)
Medium
- 90 (or 100, if that’s easier for dimming percentages) minutes before next alarm…
- This is “medium” because while “minutes before alarm” is simple, I’m not sure if it can go beyond 60 minutes.
Hard
- Increase to 100% between start and next alarm (I have no idea how this would work, maybe a “for each” loop of some kind?)
- Change color temperature from 2200k to 4000k over same time (I have no idea how this would work, maybe a “for each” loop of some kind?)
I’m going to keep researching! My main barrier is that I often am presented by lots of options from Tasker and I don’t always understand which are necessary and which are just options that don’t do anything when ignored.
Hey just wanted to say thanks. Since groovy shutdown and sharptools stopped working I haven’t been able to make a shortcut to unlock my door, google home doesn’t even allow adding it to device control for some reason, but using your code I was able to make it and it works great.
When setting up Tasker and Sharptools to update my phone as a presence sensor, what do you put in the body of the pushover for sharptools to send to Tasker?
For Title, I use SharpTools Notice. In Body, I use Wife Home (Switch On). I use my wife’s name actually, but I didn’t want to include it here. Then I use AutoNotification in Tasker to intercept the Pushover notification and Tasker turns on my wife presence switch in SmartThings, which then triggers an Automatic routine in SmartThings
I’m having a bit of trouble making variables/tasks for multiple scenes. Could anyone help me figure out which variables in the Get/Run Scene tasks I need to amend? It works fine when I run it as-is, but as soon as I change anything, it creates a pop-up.
Also, nothing appears to happen when I try to run “Build Database,” it just spins on “Creating JSON” for a while then ends. Unsure if this is related.
I just created an API call to set a virtual Temp/Humidity device by @TAustin with the current outside Temperature and even the Humidity since it was available in the OpenWeather API response. Now I can use this virtual device’s temperature as a pre-condition with a few of my Automations.
First I setup an HTTP Request API call to my free openweathermap API account to get the ‘/onecall’ data. I then set the http_data.temp and http_data.humidity JSON responses to Tasker variables %OUTSIDETEMP and %OUTSIDEHUMIDITY.
{
“commands”: [
{
“component”: “main”,
“capability”: “partyvoice23922.vtempset”,
“command”: “setvTemp”,
“arguments”: [%OUTSIDETEMP]
},
{
“component”: “main”,
“capability”: “partyvoice23922.vhumidityset”,
“command”: “setvHumidity”,
“arguments”: [%OUTSIDEHUMIDITY]
}
]
}
I’m trying to get a persistent notification whenever my garage tilt sensor (in SmartThings as a “contact sensor” but it’s physically a tilt type with mislabeled drivers) is open. The SmartThings App can do this for the most part, but it can’t do persistent notifications, and it’s also buggy. Sometimes I get the notification when it’s not true, other times the notification gets cleared (for example, by restarting a phone that died) and then doesn’t return even if the state is Open (it only seems to trigger during state changes).
I think the API can help! I’m set up for the most part (built the device database, etc.). I’m struggling to interpret my options though. I think I need some combination of “Get DeviceID” and “Get DeviceStatus” before passing that on to the AutoNotification function in Tasker.
Can someone please help me?
I use the SmartThings Advanced website to get my device ID’s and capabilities. Much easier than using the CLI. I wish I saw this before now.
Yea, that’s helpful. I’m able to get the JSON with the specific ID, I’m just not sure how to pass that to other tasks (for example “value”: “closed”).
Can you give me the exact flow of gow you want this to work. This will allow me to better help build you a task.
Sure thanks!
I have a Third Reality Tilt Sensor attached to my garage. When the garage is open, I want to know. The notification should be persistent so it’s not accidentally cleared by Clear All, and if the notification doesn’t yet exist it should check periodically (say, every 30-60 min) to see if the tilt sensor is open. This is to account for the door being already open when a phone reboots. The exit task should occur when the tilt sensor is closed, and clear the notification.
One tricky thing about AutoNotification that I’ve never been able to figure out is sometimes it will work the first time, then not again until reboot. I think it has something to do with persistent notifications, but I’m not sure.
Does that help? Happy to elaborate, not sure how yet.
I do something similar for my doors or gate being open for an extended period. However, I use the Edge Counter Utility driver to keep track of the interval and a virtual switch to keep track of the state of the notifications. Here are my Routines:
Gate Opens
Gate Open for 15 mins
Gate Open for Another 15 mins
Gate Closes
All based on device state and no dependency on your phone.
Interesting! Thanks for sharing. So, basically, you use the device state to send notifications and start virtual switch timers. Then, you use the virtual switch timer to check on the device state? So, in my case, I could do something like:
- Tilt sensor notifies users when the garage is open
- Tilt sensor tells the virtual switch when the garage is closed
- When the virtual switch detects the garage as closed, start a timer
- When that timer reaches, say, 15 minutes, check if the garage is open? I’m not sure about how this part works.
Regardless, I still have to use Tasker to clear the “open” notification once the garage is closed, but I have that already working so that’s not a big deal.
More or less. I also use a virtual switch to indicate that the initial notification has been sent, but in thinking a little more about it, I’m not sure that’s really necessary.
Assuming, you just want to be reminded that the door is open every 30 mins, here are the Routines I’d use:
If Tilt sensor indicates door is open
Then
Send Notification "Door is Open"
Start Door Open Timer
If Tilt sensor indicates door is open (precondition)
Timer is >=30 min
Then
Send Notification "Door is Open"
Reset Door Open Timer to Zero
If Tilt sensor indicates door is closed
Then
Stop Door Open Timer
I don’t understand this. Are you using Tasker to dismiss the notification on your phone?
I currently use virtual timers too in Edge to alert about various things Open or On that replaced the old pre-Edge ‘Left it Open’ app.
However, the idea of using the Tasker persistent (‘permanent’) notification feature that would require a Tasker ‘Notify Cancel’ routine to kill it has the advantage of it being a non-annoying notification every X virtual timer minutes. It could replace the need to open the SmartThings app to look at the Home Status bar and tap on the various status icons.
However, I just tested the Tasker ‘permanent’ notification on my S24, and it was not permanent at all since I was able to swipe it away. And, when I tested the Tasker permanent notification feature, the notification did not play the default sound, nor did the notification get sent to my Galaxy Watch either. Oh well…
Hmm, yea I don’t really want a new notification every 30 minutes. I want the existing notification to persist, and/or create it anew if it doesn’t exist yet (as would be the case if the phone rebooted). A fresh one every 30 minutes will just pile up and I’ll get into the mindless habit of swiping them away. Sometimes the garage is supposed to be open for long periods.
I am using Tasker to clear the notification, yes. This is because SmartThings isn’t…smart…about this. It just knows how to send the notification, but it doesn’t have any sort of “exit” task the way Tasker does. I basically have SmartThings send a “closed” notification, and when Tasker sees that it clears both.
As for persistent notifications being swiped away: I believe that’s an Android 14+ thing, not a Tasker thing. I’m assuming S24 phones run Android 14. Android 14 introduced the ability to swipe away persistent notifications. They will remain if you press “clear all” however, so they are still slightly more persistent. I’m on Android 11 (because it’s the last UI that doesn’t use Material You, a design language I don’t care for), so my notifications are still old-way persistent.
@Jake_Mohl I’ve been using your code for a couple years now, but the SmartThings API address must have changed because I’m now getting errors. Do you know what it changed to? Can Tasker still access it? Thanks!
I’m not sure if you have the same error I’ve been experiencing recently, but for some reason, Tasker does not like ‘Content-Type: application/json’ in the header. If you remove it, it works. I’d recommend making a copy of your Tasker data before removing anything, just in case things change again.
Also, I’m only noticing it on two devices that updated recently; my phone still works without removing this.
That does allow the task to fetch the data, but when I run it manually, I get two pop ups that I have to clear. I didn’t get these before, but I see that they are part of the code, so I can turn them off. Thanks!