Can't figure out how to add msg.payload to PushBullet notification

New to node red (obviously). I have my HA’s device tracker in Node Red. Whenever a device enters into a new zone, the msg.payload consists of the name of the new zone. For example, when my wife arrives home, the payload is “Home”. In the service node, for the data, I have tried { “message”:msg.payload} but that gives me an error. Obviously I’m getting something fundamentally wrong. Help is appreciated. Here is the screenshot of the properties for the HA service node:

@PlayedIn, node-red-node-pushbullet will do what you need from it, it also provides more push types and actions.

here is an example
[{"id":"6cbff303.b66efc","type":"change","z":"fc32e4e1.e1bf78","name":"From off to stop","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":580,"wires":[["db0a376a.4369d8","9f4827f4.ffa1b8"]]},{"id":"2b0be2ca.d728ce","type":"server-state-changed","z":"fc32e4e1.e1bf78","name":"Siren","server":"f0aa0465.fa7ce8","entityidfilter":"switch.sirenstrobe_switch","entityidfiltertype":"substring","haltifstate":"","x":87,"y":580,"wires":[["6cbff303.b66efc"]]},{"id":"db0a376a.4369d8","type":"looptimer","z":"fc32e4e1.e1bf78","duration":"30","units":"Second","maxloops":"100","maxtimeout":"1","maxtimeoutunits":"Hour","name":"Open loop","x":491,"y":581,"wires":[["d8f9c434.9fae48"],["7672a2ab.0fea7c"]]},{"id":"9f4827f4.ffa1b8","type":"ui_button","z":"fc32e4e1.e1bf78","name":"","group":"72dc54a4.eaf9fc","order":3,"width":0,"height":0,"passthru":false,"label":"Alarm Sound Off","color":"","bgcolor":"","icon":"","payload":"stop","payloadType":"str","topic":"","x":400,"y":640,"wires":[["db0a376a.4369d8"]]},{"id":"a96ae1f2.5a0ad","type":"pushbullet","z":"fc32e4e1.e1bf78","config":"8f1d0208.de239","pushtype":"note","title":"Alarm activated","chan":"","name":"The Alarm Was Activated!","x":1070,"y":560,"wires":[]},{"id":"d542ea95.cc44f8","type":"pushbullet","z":"fc32e4e1.e1bf78","config":"8f1d0208.de239","pushtype":"note","title":"The alarm was turned off.","chan":"","name":"Alarm off","x":1020,"y":600,"wires":[]},{"id":"d8f9c434.9fae48","type":"function","z":"fc32e4e1.e1bf78","name":"Alarm Activated","func":"var newMsg = {\"payload\":\"The alarm has been activated, intruder alert\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":660,"y":560,"wires":[["a96ae1f2.5a0ad","69b9b0cc.3c1bb"]]},{"id":"69b9b0cc.3c1bb","type":"cast-to-client","z":"fc32e4e1.e1bf78","name":"Living room Mini","url":"","contentType":"","message":"","language":"en","ip":"192.168.2.40","port":"","volume":"40","x":840,"y":580,"wires":[[]]},{"id":"7672a2ab.0fea7c","type":"function","z":"fc32e4e1.e1bf78","name":"Alarm off","func":"var newMsg = {\"payload\":\"The home alarm has been turned off\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":640,"y":600,"wires":[["d542ea95.cc44f8","69b9b0cc.3c1bb"]]},{"id":"f0aa0465.fa7ce8","type":"server","z":"","name":"Home Assistant","url":"http:\\\\192.168.1.104:8123","pass":"password"},{"id":"72dc54a4.eaf9fc","type":"ui_group","z":"","name":"Doors","tab":"5e50bdab.a4a344","order":2,"disp":true,"width":"6","collapse":false},{"id":"8f1d0208.de239","type":"pushbullet-config","z":"","name":"mail.com"},{"id":"5e50bdab.a4a344","type":"ui_tab","z":"","name":"Lights","icon":"dashboard","order":4}]

1 Like

I tried to import your export, but your pushbullet node isn’t coming across. I’m using HA’s service node to connect to PushBullet. In my screenshot above, what goes into the data field if I want to add the msg.payload to the push bullet notification?

The call-service node doesn’t translate msg.payload into a value. You need to insert a template or function node before the call-service and then the call service node will merge it.

An example of the template node

1 Like

you will need to install the pushbullet node in order for it to work or to @Kermit point you will need to use a template or function node to feed the call service node.

1 Like

That got it for me. Thanks!

Ok thanks. With the help, I was able to get both ways to work. I’m wondering if one solution has any benefits over the other (other than not needing a format node with one)? Not sure which one to go with for all my flows?

Each has its strength, I guess it comes down to what you want to get out of it. The function and template nodes are very powerful, but you will need to learn javascript or mustache, however, there are a lot of people on this forum that can help as well as in the node-red forum.

1 Like

I’m also struggling to setup the pushbullet notify from HA. Is someone able to share a bit more details of how to get this working. I’ve been playing with the template node, but unclear as to exactly what code is needed here for a message??

What kind of message are you wanting to send? A phrase or sentence that is always the same, or a phrase or sentence that changes based upon a sensor state? Give an example of what you’re trying to do.

Its just a phase thats always the same just saying someone is home.

My flow is

`

> [{"id":"bafd27f.1c7eed8","type":"server-state-changed","z":"bb8473c3.beb02","name":"Matt Home","server":"869a2a4c.486638","entityidfilter":"device_tracker.oneplus_3t","entityidfiltertype":"exact","haltifstate":"","outputinitially":false,"x":120,"y":500,"wires":[["13a4113.ccadbef"]]},{"id":"13a4113.ccadbef","type":"switch","z":"bb8473c3.beb02","name":"home or away","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"not_home","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":500,"wires":[["91f3bc3b.49dbc"],["1727c3c3.37316c"]]},{"id":"91f3bc3b.49dbc","type":"api-call-service","z":"bb8473c3.beb02","name":"","server":"869a2a4c.486638","service_domain":"input_boolean","service":"turn_on","data":"{\"entity_id\":\"input_boolean.matt_home\"}","render_data":false,"mergecontext":"","x":600,"y":440,"wires":[["cd9e6cf2.585ce"]]},{"id":"1727c3c3.37316c","type":"api-call-service","z":"bb8473c3.beb02","name":"","server":"869a2a4c.486638","service_domain":"input_boolean","service":"turn_off","data":"{\"entity_id\":\"input_boolean.matt_home\"}","render_data":false,"mergecontext":"","x":600,"y":520,"wires":[[]]},{"id":"ff496d73.709e","type":"api-call-service","z":"bb8473c3.beb02","name":"Matt home","server":"869a2a4c.486638","service_domain":"notify","service":"pushbullet","data":"{}","render_data":false,"mergecontext":"","x":870,"y":540,"wires":[[]]},{"id":"cd9e6cf2.585ce","type":"template","z":"bb8473c3.beb02","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n\"data\": {\n \"message\": {{Matt is home}}\n }\n}","output":"str","x":820,"y":460,"wires":[["ff496d73.709e"]]},{"id":"869a2a4c.486638","type":"server","z":"","name":"Home Assistant"}]

`

So in the template node, you would choose set property: msg.payload. Choose mustache template. Then in the first line of template, put something like:

{ "data" : {"message" : "Jane is at home!", "target" : "channel/zonealerts"} }

The target part is a channel that can be set up in Pushbullet so you can categorize your push bullet notifications. I created a channel called zonealerts that handle all my location notifications.

Thats great thanks, but what do I need to do in the service call node. So far all i have done is call the push bullet notify

In the service node:
Server: Home Assistant
Domain: notify
Service: pushbullet
The next two are blank
EntityID:
Data:

That way the msg.payload that comes from the template node is sent to the service.

I still cannot seem to get a message through, despite following the steps you suggested. Maybe its something to do with my flow??

I see that if you’re home, you are turning on a boolean. Did you mean it that way, or are you trying to only send the message if the boolean is on. If it is the latter, you’re using the wrong node. In that case, you would use the Current State Node to determine the state of the boolean.

However if you did mean to “turn on” a boolean if you are home, connect the template node to the top output of that switch node. You would then have both the template node and that service node to turn on the boolean connected to the top output of that switch node.

@mattpitts74 there is a pushbullet node as well for node-red, its call node-red-node-pushbullet below is an example on how I use it

[{"id":"6cbff303.b66efc","type":"change","z":"fc32e4e1.e1bf78","name":"From off to stop","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":580,"wires":[["db0a376a.4369d8","9f4827f4.ffa1b8"]]},{"id":"2b0be2ca.d728ce","type":"server-state-changed","z":"fc32e4e1.e1bf78","name":"Siren","server":"f0aa0465.fa7ce8","entityidfilter":"switch.sirenstrobe_switch","entityidfiltertype":"substring","haltifstate":"","x":87,"y":580,"wires":[["6cbff303.b66efc"]]},{"id":"db0a376a.4369d8","type":"looptimer","z":"fc32e4e1.e1bf78","duration":"30","units":"Second","maxloops":"100","maxtimeout":"1","maxtimeoutunits":"Hour","name":"Open loop","x":491,"y":581,"wires":[["d8f9c434.9fae48"],["7672a2ab.0fea7c"]]},{"id":"9f4827f4.ffa1b8","type":"ui_button","z":"fc32e4e1.e1bf78","name":"","group":"72dc54a4.eaf9fc","order":3,"width":0,"height":0,"passthru":false,"label":"Alarm Sound Off","color":"","bgcolor":"","icon":"","payload":"stop","payloadType":"str","topic":"","x":400,"y":640,"wires":[["db0a376a.4369d8"]]},{"id":"a96ae1f2.5a0ad","type":"pushbullet","z":"fc32e4e1.e1bf78","config":"8f1d0208.de239","pushtype":"note","title":"Alarm activated","chan":"","name":"The Alarm Was Activated!","x":1070,"y":560,"wires":[]},{"id":"d542ea95.cc44f8","type":"pushbullet","z":"fc32e4e1.e1bf78","config":"8f1d0208.de239","pushtype":"note","title":"The alarm was turned off.","chan":"","name":"Alarm off","x":1020,"y":600,"wires":[]},{"id":"d8f9c434.9fae48","type":"function","z":"fc32e4e1.e1bf78","name":"Alarm Activated","func":"var newMsg = {\"payload\":\"The alarm has been activated, intruder alert\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":660,"y":560,"wires":[["a96ae1f2.5a0ad","69b9b0cc.3c1bb","60eab7ff.b77eb8"]]},{"id":"69b9b0cc.3c1bb","type":"cast-to-client","z":"fc32e4e1.e1bf78","name":"Living room Mini","url":"","contentType":"","message":"","language":"en","ip":"192.xxx.xx.xx","port":"","volume":"42","x":860,"y":540,"wires":[[]]},{"id":"7672a2ab.0fea7c","type":"function","z":"fc32e4e1.e1bf78","name":"Alarm off","func":"var newMsg = {\"payload\":\"The home alarm has been turned off\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":640,"y":600,"wires":[["d542ea95.cc44f8","69b9b0cc.3c1bb","60eab7ff.b77eb8"]]},{"id":"60eab7ff.b77eb8","type":"cast-to-client","z":"fc32e4e1.e1bf78","name":"bedroom Mini","url":"","contentType":"","message":"","language":"en","ip":"192.xxx.xx.xxx","port":"","volume":"42","x":860,"y":620,"wires":[[]]},{"id":"f0aa0465.fa7ce8","type":"server","z":"","name":"Home Assistant","legacy":true},{"id":"72dc54a4.eaf9fc","type":"ui_group","z":"","name":"Doors","tab":"5e50bdab.a4a344","order":2,"disp":true,"width":"6","collapse":false},{"id":"8f1d0208.de239","type":"pushbullet-config","z":"","name":"[email protected]"},{"id":"5e50bdab.a4a344","type":"ui_tab","z":"","name":"Lights","icon":"dashboard","order":4}]
1 Like