Moving forward, updates to this subflow will be found at the following repository: https://github.com/sstratoti/actionable-notifications-subflow-for-ios
-
-
Save sstratoti/8021c5a4ee8e34313c3f59ba20c4a83a to your computer and use it in GitHub Desktop.
Thank for your answer, sorry its a different problem with the Node Red Plugin, its losing the web socket connection to Home Assistant
"[server:Home Assistant] Connected to undefined)", discussed in other Treads. I found out that Node Red crashes after sending the first and second IOS Message.
Thanks again for this nice Sub flow, will use it a lot.
This is amazing and works almost perfectly for me.
The only thing is that when I press any button, it always opens the app even though I have "activation mode" set to background.
There is also no URL provided anywhere.
Am I doing something wrong?
Hmm, I'll check into that! I think it does the same for me.
OK I've updated the flow. Even though URI wasn't populated, it was sending in an empty string, which was causing the default behavior of "foreground" when it is populated.
I also fixed an issue where if msg.notificationOverride wasn't populated, it would send a message twice! Weird bug with my settings on the switch node. Give this update a try? I've edited the gist with the latest.
Oh wait - needed to update once more to remove a debug. Should be good....now!
I've tested it and it works perfectly!
I am using this subflow for a lot of things now and it is working perfect, but while fixing some errors from the log I noticed that this subflow is generating errors (i just cleared it so there is only 1 occurrence):
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:89
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:40:40 (1 occurrences)
Last logged: 22:40:40
[547425187728] Received invalid command: mobile_app/push_notification_channel
I don't think this is a problem, but i'm thinking it might cause one when updates happen. Do you have this error aswell?
Subscribe to this issue:
home-assistant/iOS#1700
From the looks of it, I don't believe it hurts anything.
Thanks, that explains it, i've subscribed to it.
Feel silly asking this question, but I have read through this thread a few times now, I keep getting a 'no connection' error message on the node. Was expecting at least getting a notification as I was getting using the android version of the same subflow. I figure I'm doing something wrong with the config, I have tried both using both notify and mobile_app_eddie as the notify service, neither worked. Can anyone please assist?
Hello, thank you for this node, but I have a problem with Custom Sound (Optional - Will Override Pre-Installed Selection). When I write own sound, from system sound (I imported them, already) still play only Pre-Installed Custom Sound... Have you the same problem? Or I have some mistake? thank you very much
Initial thought - never heard of a .caf file before. I think the delivered sounds are all wavs?
You might want to check the iOS app documentation to see what is supported?
If supported let me know and I’ll take a deeper look?
I used this sound before, and works well... Now with this node they dont work. look at this, please. It is screen from Home assistant website.
This is a part of code, and play .caf sound now. Only this node don't play custom sound:
"sound": {
"name": "3rd_Party_Critical_Haptic.caf",
"critical": 0,
"volume": 1
}
And the .waw format I also have, and no works too :(
Feel silly asking this question, but I have read through this thread a few times now, I keep getting a 'no connection' error message on the node. Was expecting at least getting a notification as I was getting using the android version of the same subflow. I figure I'm doing something wrong with the config, I have tried both using both notify and mobile_app_eddie as the notify service, neither worked. Can anyone please assist?
I figured out the issue. For the call-service nodes in the subflow, I have multiple instances of the Home Assistant server listed, changing that around and found one that allowed the connection.
@pistak23 - thanks for catching that. The default value is set to "default" which is obviously > 0, so the custom sound would never hit in the logic. Swapping those variables will have it check the custom first, then the default sounds - so that looks good to me. I'm making a correction and will edit the gist to update it.
@fireone23 glad to hear its working now! I've run into that issue myself before, it's frustrating til you figure it out. :)
I believe that you can edit the servers that are available, and remove the dead ones from the list. I think thats what I did long ago...
Since 2021.10 iOS actionable notifications allow icons to be included. Mac owners can find the list of SF symbols here. For Windows user, one could look at this list (the list will only show the names, and may not be complete).
Please note that while this works fine on the iPhone, the current versions of WatchOS (even v8.3) will not show such icons.
Following changes should be made to the code:
'create service call' (--> indicates line added)
const destructive = env.get(`${name}Destructive`);
const behavior = env.get(`${name}Behavior`);
--> const icon = env.get(`${name}Icon`);
const actionObject = {};
actionObject.action = action;
if (destructive != "") actionObject.destructive = destructive;
if (behavior != "") actionObject.behavior = behavior;
--> if (icon != "") actionObject.icon = icon;
actions.push(actionObject);
}
Following should be added (in the actionable-notifications-subflow-for-ios.json) after each of the action_TextInputPlaceHolder (where _ is the number 1-4):
{ "name": "action1Icon", "type": "str", "value": "", "ui": { "label": { "en-US": "Action 1 Icon (Optional)" }, "type": "input", "opts": { "types": [ "str", "env" ] } } },
Just remember to change "action1Icon" and "Action 1 Icon (Optional)" accordingly ;)
Is it possible to set notifications properties from the msg.payload ? (such as the message title or message text)
This subflow is great. I had originally posted a question about a problem I was having, but worked it out. Thanks for putting this together.
@fslef - Yes, this is possible. What I do is place a function node in between whatever node is pushing the payload (say an events:state node, or trigger:state).
For instance, here is a flow that I use for my litter robot.
...the status code switch is checking the various codes to see if they match any of the ones that I care about.
The "Set Message" function node is what we're interested in.
// set msg overrides
msg.notificationOverride = {};
msg.notificationOverride.title = "Litter Robot error message!";
msg.notificationOverride.message = "Litter Robot is reporting '" + msg.data.attributes.status + "' (" + msg.data.attributes.status_code + "). Please check the litter robot.";
return msg;
You can override the default properties that you've set for the service call by passing in a msg object with notificationOverride set.
// set msg overrides
msg.notificationOverride = {};
msg.notificationOverride.title = "dynamic title!";
msg.notificationOverride.subtitle = "dynamic subtitle";
msg.notificationOverride.message = "Some new message like Battery is at " + msg.payload.attributes.battery + "%";
msg.notificationOverride.services = "my_phone, partners_phone, kids_phone"; //could override this depending on who is "home".
msg.notificationOverride.tag = "xyzTag" // could be that you want to send the same message, but have it appear multiple times on the device rather than overwritten.
msg.notificationOverride.clear = true; // will attempt to clear all messages to all specified devices in the setup or in msg.notificationOverride.services if overridden. I believe this currently isn't working because apple isn't allowing them to do this with the app. But they've petitioned for it...
return msg;
All of these are optional. If you send in a value, it'll override the default values set in the node so that its more dynamic.
Also, I use the "msg.notificationOverride.services" to dynamically set who gets a message based on who is home, the time of day, if we're asleep, etc. I do this all using another subflow called "Who to send messages to?". It helps to keep things really clean and doesn't bother my wife while she's at work (for instance).
Glad you figured it out @DeltaNu1142 !
Also, thank you @henriklund - gist is updated!
Thanks @sstratoti
Ok I see. So everything should go through the msg.notificationOverride
Would you mind if you share your flow ?
So that I can have a look on the other nodes ?
Thanks a lot
@sstratoti, do you plan to publish this as a subflow module?
Hi @fslef - I’ll see what I can do next week.
@bonanitech - had no idea about this! Very cool, and this would be much easier for people to receive updates to the node! I’ll also look into this next week as well.
Awesome! It may also be a good idea to scrub the flow with this tool before that. 😉
@bonanitech Just did a diff after using that tool, had no idea that the server ID was in there, but it makes sense that it would be. The HA nodes need to use something to connect...
Is there a way to set that dynamically with the subflow module? Or all you all just going in and changing the HA nodes to point at your own instances each time I update this?
EDIT: Or using the scrubber you linked to replace the id... hah
And next week turned into next year...
Sorry, work/life has been kicking my ass. I'm planning some time off over the next month or two, so I'll see about publishing it then. :)
It looks like there is a problem with nodes that depend on configuration nodes in subflow modules. We'll have to wait for a fix first.
That might have to do with iOS and rate limiting. If you go into the subflow (double click it in the palette) and then drag a connection from the API call (blue node called "send notifications") to one of the outputs - say output 4. Then place a debug from that output in your flow, and you'll see the response from the API call in the debug window.