running a home screen widget when screen is off and locked

gmish

New member
Apologies as I'm guessing this has been discussed in the past, but can't seem to find a solution. I have a Samsung Galaxy 9. Not rooted. I've got a widget I'd like to initiate with an action when my screen is off and locked. I can get the screen to come on, but can not get the screen to unlock and get to home screen. I use a pattern lock. Any help would be greatly appreciated.

FWIW, the underlying, more complicated reason for this (maybe explaining it leads to a simpler solution)..... I have Velux blinds that do NOT work with Alexa, only Google Assistant. We have Alexas all over the house, and do not use Google Home. So ultimate goal is getting blinds to open/close via Alexa. So close to making it happen. I created a Google Home routine that will open/close blinds. I was then able to create a home screen widget of that routine, that when pressed, will open/close the blinds. I then created an Alexa routine triggered by the phrase "open all blinds", this causes an IFTTT action that then sends a webhook to Macrodroid. The webhook is a Macrodroid trigger that I thought could then cause an action of initiating the home screen widget.

The home screen widgets all work great. The Alexa trigger and IFTTT setup work great and does start the MacroDroid macro. And.... when the screen is on and unlocked, the macro correctly initiates the google home widget. But when the screen is off and locked, it gets stuck.

So.... thus my desire to get Macrodroid to initiate the home screen widget from a screen off and locked state...... unless of coarse there is a more direct way to get Alexa to initiate a Google assistant/home request.

Thanks in advance for any help.
 

FrameXX

Well-known member
As it was discussed in this thread it's pretty much impossible for MacroDroid to get over pattern if "set lock screen" action is not working. You could use smart lock (you should find it in settings) for your home location, so when you are at home MacroDroid can easily unlock screen just by swiping. Or you can start using a pin. Macrodroid is able to get over pin by IU interaction.

Maybe there could be some way like sending an Intent to "Amazon Alexa" application but I doubt that app supports anything like that.
 

gmish

New member
thank you so much for taking the time to reply. I have since moved over to a pin lock, but still can not get past the lock screen to complete the remaining portion of the macro. I'm usually pretty good at this stuff. Can't figure out what I'm doing wrong. Any assistance would be very much appreciated.
 

FrameXX

Well-known member
thank you so much for taking the time to reply. I have since moved over to a pin lock, but still can not get past the lock screen to complete the remaining portion of the macro. I'm usually pretty good at this stuff. Can't figure out what I'm doing wrong. Any assistance would be very much appreciated.

Where exactly is your problem? Macro like this is perfectly working for me to unlock screen.

(That variable is not needed of course.)

Screen_unlock.png
 

gmish

New member
yup, I had something very similar, but updated it to the below macro. A few notes... the initial wait 3 seconds is just so i can turn off the screen after I start testing, and move away from my eyes so face recognition does not kick in.

Also, the click UI interaction is set as text content (is that the correct one to use vs current focus, XY location, or identify in app?)

And the "enter text to match" is where I typed in "id:com.android.systemui:id/keyX" where X is the pin numbers, 1 at a time in the 4 click UI interactions

When i run the macro, the screen turns on, a virtual swipe happens that brings me to the pin entry screen, but no pin appears to get entered. Maybe I've done the UI click interaction incorrectly?

super nice of you to assist!



macro.png
 

FrameXX

Well-known member
yup, I had something very similar, but updated it to the below macro. A few notes... the initial wait 3 seconds is just so i can turn off the screen after I start testing, and move away from my eyes so face recognition does not kick in.

Also, the click UI interaction is set as text content (is that the correct one to use vs current focus, XY location, or identify in app?)

And the "enter text to match" is where I typed in "id:com.android.systemui:id/keyX" where X is the pin numbers, 1 at a time in the 4 click UI interactions

When i run the macro, the screen turns on, a virtual swipe happens that brings me to the pin entry screen, but no pin appears to get entered. Maybe I've done the UI click interaction incorrectly?

super nice of you to assist!



View attachment 174

I now found this app in plugins section. Give it a try.

Also it seems that you set MacroDroid to click text content and written there what I have on screenshot. Try using "text content" and use just numbers. It should work to. So for exmaple if my password is 1234 you click text content "1", wait 1 second, click...

Or use "identify in app", then press MacroDroid notification immidietaly, lock screen, swipe up, then press needed button for MacroDroid to recognize.
 
Last edited:

gmish

New member
Thanks. That app would not help because my Velux blinds ONLY work with Google Home/Assistant, thus I need to press a widget button on my home screen to get it to work. Trying to update text content now, but it is acting very strange.... doing the first two numbers, then not doing the 3rd. Weird... still testing
 

MacroDroidDev

Administrator
Staff member
Swipe gesture will not work, but as stated above the pin entry should be able to unlock your screen.

I guess the Velux app you are using does not expose any functionality via Android shortcuts? That would be an obvious feature request because it enables so much more flexibility/interoperability than just a home screen widget.
 

gmish

New member
Velux exposes no functionality at all. They've been saying they'll add alexa support at some point, but they've been saying that for 3 years (which I admittedly should have researched before buying). Only google home functionality. Google does not make home/assistant commands available as an action in IFTTT, only as a trigger. So if I want to initiate the google home routine via Alexa, my only option (that I could think of) was get alexa to start an IFTTT web hook, to call Macrodroid macro, that presses the google home widget.
 

FrameXX

Well-known member
Trying to update text content now, but it is acting very strange.... doing the first two numbers, then not doing the 3rd. Weird... still testing

Try adding bigger delay between ui actions. Same things was happening to me.
 

gmish

New member
I believe it is working. This is going to sound crazy, but it was acting very strange if the pin code repeated any numbers. I realize there is no reason that should be, but I tested multiple times. I had a wait of 1 second, 2 seconds, 3 seconds, 500 ms, 100 ms, between each number input. Regardless of the wait between clicks, every time I repeated a number, it would act strange, and sometimes stop at the second occurrence, but if each click was for a different number, it seems to work every time. The repeat was not necessarily AABC, but even ABAC or ABCA was an issue. But as long as I enter ABCD, I think I'm good. Strange. But onto remaining part of macro to complete button press. Thank you both for taking the time to help. Will reach back if other questions.
 

FrameXX

Well-known member
I believe it is working. This is going to sound crazy, but it was acting very strange if the pin code repeated any numbers. I realize there is no reason that should be, but I tested multiple times. I had a wait of 1 second, 2 seconds, 3 seconds, 500 ms, 100 ms, between each number input. Regardless of the wait between clicks, every time I repeated a number, it would act strange, and sometimes stop at the second occurrence, but if each click was for a different number, it seems to work every time. The repeat was not necessarily AABC, but even ABAC or ABCA was an issue. But as long as I enter ABCD, I think I'm good. Strange. But onto remaining part of macro to complete button press. Thank you both for taking the time to help. Will reach back if other questions.

Best for MacroDroid would be word password if you have that option in settings, becuase MacroDroid can just paste it.
 

gmish

New member
Best for MacroDroid would be word password if you have that option in settings, becuase MacroDroid can just paste it.
thank you, good to know. All appears to be working in this incredibly indirect way..... Alexa verbal command initiates IFTTT trigger..... which initiates a webhook action.... which initiates and MacroDroid macro.... which unlocks phone and clicks a google routine widget.... which opens or closes the velux blinds. All because Velux doesn't work with Alexa, and because google won't open home/assistant as an actionable item in IFTTT. What a rabbit hole... but all's well that ends well. Thanks for the help! Hopefully this helps others.
 

EDawg

New member
How do you get MacroDroid to tap on a floating widget that is moved around the screen sometimes not always in the same location. If it were the same location I would use X,Y
 
Top