toppe
1 February 2022 11:58
1
Hi,
I'm having the following function:
data :{
title : msg.title,
message : msg.message,
data: {
push: {
sound: {
name: 'default',
critical: msg.setCritical,
volume: 1
}
},
actions: [msg.action],
}
},
service : msg.receiver
}
I'm also having this:
if(msg.imageurl){ msg.setImage = "image: https://github.com/home-assistant/assets/blob/master/logo/logo.png?raw=true"; }
But how can I pas the msg.setImage
after actions: [msg.action],
?
It's not possible to already put image: msg.setImage
to it and send a empty image because it's shows a 404 error image.
Colin
1 February 2022 15:08
2
I don't understand what you have showed us.
That appears to be part of an object, not a function.
Again I don't understand. If you want to include the contents of msg.setImage into the structure then using image: msg.setImage
is the correct way to do it. If you do that and look at the result in a debug node (before you do anything else with it) what do you see?
toppe
1 February 2022 15:39
3
I've created a sub-flow with soms variables on the input side. This is in my function.
I would like to check if msg.imageurl
got a value and if so, put is after actions: [msg.action],
.
E1cid
1 February 2022 15:45
4
if(msg.imageurl) {
msg.payload.data.data.image = msg.imageurl;
}
Add something like this after you set the payload. this will check if msg.imageurl exist and add it to your payload.
Colin
1 February 2022 15:45
5
Something like this after the msg.payload = ...
statement
if (msg.imageurl) {
msg.payload.data.data.image = msg.imageurl
}
system
Closed
2 April 2022 15:50
8
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.