I’m trying to get a push confirmation working from HomeyScript.
The script does not return an error… I use it in Adv.Flow card “And - homeyscript run script”
Sending a push message works fine, but the confirm version does not work yet.
Any thoughts?
Thanks Jeroen, tried earlier and got the error as well.
But, nów I suddenly get the “action” part, thanx Caseda.
While that card is a condition card, the “run flowcard” has to be the condition type as well
Very nice, this works now:
const response = await Homey.flow.runFlowCardCondition({
uri: 'homey:manager:mobile',
id: 'push_confirm',
args: {
user: {
athomId: MyUserAthomID
},
text: 'Test push confirmation from HomeyScript, now choose Yes to confirm; for No, just ignore this:'
},
});
log (response);
return(true);
.
A follow up question:
Replying the pushmessage with either yes or no, results in yes and the flow continues. Is that as designed?
Because, when the message is sent, and I don’t respond to the question, the flow stops.
So now we have a “Should I do action A, press Yes; if not, don’t respond” option.
I was expecting a
-Yes: do this
-No: do nothing, or do something else
Thanks, I know now the syntax, the id of the card is push_image, I believe that I need the image token. So I tried to get the token with the command bellow
But get the error about missing scope and no access error message.
My script looks like
Homey.flow.runFlowCardAction({
uri: 'homey:manager:mobile',
id: 'push_image',
args:
{
user:
{
athomId: 'my user id'
},
text: 'Test push notification'
},
droptoken:
{
image: 'id of my images'
}
the script runs but no notifictions received, when i change the type to push_text I get the notification on my mobile. Does some if it is possible to use the push_image from script and how it needs to setup?
Yes that works fine, I want to speed things up. My flow runs a script, I set some variabel and based on that the flow send the push notification. The flow runs every 5 seconds, I can see that the flow will take some while waiting for the script finished. I think on this moment I cannot be done, no big deal. But if someone knows how please let me know.
Well, all flowcards can be simulated through HS. Am sure of that.
But, im not sure you can get the image (ID) that you need.
Im willing to take a look tomorrow or at least this week.
The WebApi/developer page shows all images, so there is some way of getting the image (id) (which you will need for the card or you would need have access to a real/binary file in HS?).
Hi Peter, Don’t know if you found out, but the reason that it always results in Yes is that you have a return(true) as the last line. If you use return(response.result) instead then you will get a Yes or No.
Found this topic because i can’t find an option within Homey to send a push message to te last person leaving the house. I am using smartPresence and within the flow i get the username. So, i thought to solve it by modifying this script.
But, i never came that far, because the script isn’t sending a push message at all. With the standard action flowcard i can send push messages. So pushmessages is working. I tried it by just running the script as a test and by using a actionflowcard with running this script. I also entered my athomID.
Do you know how i set this up in a normal advanced flow? (dutch) I have adding questionmark and ‘verzoek’ at the beginnen of the pushmessage, but i can’t get the question when recieving the notification?
for a standard flow or for an advanced flow?
I’ll show both.
Standard flow:
With the code below, you can save it as script, and run the script as AND condition, just like you would do with the normal Push confirmation flow card
Code:
// push confirmation
// to retreive the user ID and Athom ID, open this site
// https://tools.developer.homey.app/tools/api-playground
// and run the line:
// Homey.users.getUserMe();
const response = await Homey.flow.runFlowCardCondition({
uri: 'homey:manager:mobile',
id: 'homey:manager:mobile:push_confirm',
args: {
user: {
athomId: 'your_athomid_here',
id: 'your_id_here'
},
text: 'Test push confirmation from HomeyScript, now choose Yes to confirm; for No, just ignore this:'
},
});
log (response);
return(true);
Advanced flow:
You can use the Homeyscript AND card “Run code”, and paste the code above in that card
This is an example of what the webapi playground returns: