Send notification from input_text in frontend

Hello, I’m having a problem trying to create simple flow. I want to create flow that takes 2 input_text named as tittle and message and send them as notification on my phone. The issue is that I can’t get text to pass it to notify service. What’s wrong with that flow?

[{"id":"cf0f525.2b25cb","type":"server-state-changed","z":"39c0197e.ed9076","name":"","server":"193decc2.f77053","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.testswitch","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":220,"y":120,"wires":[["7d2aff83.419a9"]]},{"id":"7d2aff83.419a9","type":"switch","z":"39c0197e.ed9076","name":"On/Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":120,"wires":[["90e6f4fb.645d88","66a0a593.b0364c"],[]]},{"id":"6b68fa01.bbdff4","type":"api-call-service","z":"39c0197e.ed9076","name":"Notify Waltzy","server":"193decc2.f77053","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_oneplus_a6000","entityId":"","data":"{}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1430,"y":160,"wires":[[]]},{"id":"90e6f4fb.645d88","type":"ha-get-entities","z":"39c0197e.ed9076","server":"193decc2.f77053","name":"message","rules":[{"property":"entity_id","logic":"is","value":"input_text.msg_01","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"message","output_results_count":1,"x":740,"y":180,"wires":[["cf39b440.4c5428","93d1dae8.458ed8"]]},{"id":"66a0a593.b0364c","type":"ha-get-entities","z":"39c0197e.ed9076","server":"193decc2.f77053","name":"title","rules":[{"property":"entity_id","logic":"is","value":"input_text.title_01","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"title","output_results_count":1,"x":730,"y":120,"wires":[["cf39b440.4c5428","93d1dae8.458ed8"]]},{"id":"9cd8c553.f93058","type":"function","z":"39c0197e.ed9076","name":"Create Notification","func":"var title = msg.title\nvar message = msg.message\nvar target = msg.target\nvar payload = {\"data\":\n{\n    \"message\": `${message}`,\n    \"title\": `${title}`\n\n}\n}\nmsg.payload = payload\nmsg.topic = `${target}`\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1230,"y":160,"wires":[["6b68fa01.bbdff4"]]},{"id":"93d1dae8.458ed8","type":"debug","z":"39c0197e.ed9076","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":60,"wires":[]},{"id":"cf39b440.4c5428","type":"change","z":"39c0197e.ed9076","name":"Set Message Attributes","rules":[{"t":"set","p":"title","pt":"msg","to":"","tot":"str"},{"t":"set","p":"message","pt":"msg","to":"","tot":"str"},{"t":"set","p":"target","pt":"msg","to":"mobile_app_oneplus_a6000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":160,"wires":[["9cd8c553.f93058"]]},{"id":"193decc2.f77053","type":"server","z":"","name":"Home Assistant","addon":true}]

Change your get-entities nodes to current-state nodes:

1 Like

Thanks, already did it and i’m getting both title and message. Unfortunately I still getting empty notification. Current flow:

[{"id":"cf0f525.2b25cb","type":"server-state-changed","z":"39c0197e.ed9076","name":"","server":"193decc2.f77053","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.testswitch","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":180,"y":120,"wires":[["7d2aff83.419a9"]]},{"id":"7d2aff83.419a9","type":"switch","z":"39c0197e.ed9076","name":"On/Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":120,"wires":[["ca5d7045.603c2"],["ca5d7045.603c2"]]},{"id":"6b68fa01.bbdff4","type":"api-call-service","z":"39c0197e.ed9076","name":"Notify Waltzy","server":"193decc2.f77053","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_oneplus_a6000","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1430,"y":120,"wires":[[]]},{"id":"9cd8c553.f93058","type":"function","z":"39c0197e.ed9076","name":"Create Notification","func":"var title = msg.title\nvar message = msg.message\nvar target = msg.target\nvar payload = {\"data\":\n{\n    \"message\": `${message}`,\n    \"title\": `${title}`\n\n}\n}\nmsg.payload = payload\nmsg.topic = `${target}`\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1230,"y":120,"wires":[["6b68fa01.bbdff4"]]},{"id":"93d1dae8.458ed8","type":"debug","z":"39c0197e.ed9076","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":60,"wires":[]},{"id":"cf39b440.4c5428","type":"change","z":"39c0197e.ed9076","name":"Set Message Attributes","rules":[{"t":"set","p":"title","pt":"msg","to":"","tot":"str"},{"t":"set","p":"message","pt":"msg","to":"","tot":"str"},{"t":"set","p":"target","pt":"msg","to":"mobile_app_oneplus_a6000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":120,"wires":[["9cd8c553.f93058"]]},{"id":"ca5d7045.603c2","type":"api-current-state","z":"39c0197e.ed9076","name":"Get Title","server":"193decc2.f77053","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_text.title_01","state_type":"str","state_location":"title","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":580,"y":120,"wires":[["1d8c72b7.e2ee3d"]]},{"id":"1d8c72b7.e2ee3d","type":"api-current-state","z":"39c0197e.ed9076","name":"Get Message","server":"193decc2.f77053","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_text.msg_01","state_type":"str","state_location":"message","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":750,"y":120,"wires":[["cf39b440.4c5428","93d1dae8.458ed8"]]},{"id":"193decc2.f77053","type":"server","z":"","name":"Home Assistant","addon":true}]

Because your change node is wiping out the values: :smiley:

image

1 Like

AAAAAAAAAAA! Thanks a lot! Now is working as supposed :slight_smile:

1 Like

No problem! :slight_smile:

1 Like

Just an update if anyone would like to use my flow. I added switch to check if title is empty so in that case notification won’t be send.

[{"id":"97c93281.cae2d","type":"api-call-service","z":"e3c89320.4d1ee","name":"Notify Waltzy","server":"193decc2.f77053","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_oneplus_a6000","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1570,"y":100,"wires":[[]]},{"id":"6ab0b928.1a1908","type":"function","z":"e3c89320.4d1ee","name":"Create Notification","func":"var title = msg.title\nvar message = msg.message\nvar target = msg.target\nvar payload = {\"data\":\n{\n    \"message\": `${message}`,\n    \"title\": `${title}`\n\n}\n}\nmsg.payload = payload\nmsg.topic = `${target}`\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1230,"y":100,"wires":[["3b1e587a.8a6238"]]},{"id":"94f3369d.cfe3a8","type":"change","z":"e3c89320.4d1ee","name":"Set Message Attributes","rules":[{"t":"set","p":"target","pt":"msg","to":"mobile_app_oneplus_a6000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":100,"wires":[["6ab0b928.1a1908"]]},{"id":"e79586.24ea2a78","type":"api-current-state","z":"e3c89320.4d1ee","name":"Get Title","server":"193decc2.f77053","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_text.title_01","state_type":"str","state_location":"title","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":580,"y":100,"wires":[["ce331cb4.81b82"]]},{"id":"ce331cb4.81b82","type":"api-current-state","z":"e3c89320.4d1ee","name":"Get Message","server":"193decc2.f77053","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_text.msg_01","state_type":"str","state_location":"message","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":750,"y":100,"wires":[["94f3369d.cfe3a8"]]},{"id":"b04b8fec.fe649","type":"server-state-changed","z":"e3c89320.4d1ee","name":"Wojtek?","server":"193decc2.f77053","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"device_tracker.wojtek","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":70,"y":120,"wires":[["9d9b718d.26055"]]},{"id":"ebb103c2.c873c","type":"api-current-state","z":"e3c89320.4d1ee","name":"Gaba_Home --> Not Home","server":"193decc2.f77053","version":1,"outputs":2,"halt_if":"not_home","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"group.my_device_trackers","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":160,"wires":[[],[]]},{"id":"9d9b718d.26055","type":"api-current-state","z":"e3c89320.4d1ee","name":"Not Home -->  Gaba_Home","server":"193decc2.f77053","version":1,"outputs":2,"halt_if":"gaba_home","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"group.my_device_trackers","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":100,"wires":[["e79586.24ea2a78"],[]]},{"id":"3b1e587a.8a6238","type":"switch","z":"e3c89320.4d1ee","name":"","property":"title","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":100,"wires":[[],["97c93281.cae2d"]]},{"id":"193decc2.f77053","type":"server","z":"","name":"Home Assistant","addon":true}]

1 Like