My notification to phone is always empty

Hi

My notification to phone is always empty.
I don’t know why. I followed a guide from the internet but this changes so fast so it may be outdated.

my flow:

[{"id":"d618d685a2fbe41c","type":"server-state-changed","z":"2848e3b58bdc6fe5","name":"","server":"42b024d7.a9b76c","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.fridge_temperature","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"10","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":520,"wires":[["0b1720cccc02380b"],[]]},{"id":"0b1720cccc02380b","type":"function","z":"2848e3b58bdc6fe5","name":"","func":"msg.payload = \"The \"+msg.topic+\" is at \"+msg.payload+\"C\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":520,"wires":[["b9ef5b49ce610f4a","f8353b1a1b2a6670"]]},{"id":"b9ef5b49ce610f4a","type":"debug","z":"2848e3b58bdc6fe5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":580,"wires":[]},{"id":"d9ec15f89f31e893","type":"inject","z":"2848e3b58bdc6fe5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor","payload":"201","payloadType":"num","x":410,"y":620,"wires":[["0b1720cccc02380b"]]},{"id":"f8353b1a1b2a6670","type":"api-call-service","z":"2848e3b58bdc6fe5","name":"notify s20","server":"42b024d7.a9b76c","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_sm_g781b","entityId":"","data":"{\"message\":\"{{payload}}\"}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":520,"wires":[[]]},{"id":"42b024d7.a9b76c","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

You have the data field type set to JSONata, J: expression, but are trying to use mustache templates which only work when it’s set to JSON.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/call-service.html

image

[{"id":"d618d685a2fbe41c","type":"server-state-changed","z":"f61766ce.f85398","name":"","server":"","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.fridge_temperature","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"10","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":"1","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":208,"y":3392,"wires":[["f8353b1a1b2a6670"],[]]},{"id":"d9ec15f89f31e893","type":"inject","z":"f61766ce.f85398","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor","payload":"201","payloadType":"num","x":316,"y":3440,"wires":[["f8353b1a1b2a6670"]]},{"id":"f8353b1a1b2a6670","type":"api-call-service","z":"f61766ce.f85398","name":"notify s20","server":"","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_sm_g781b","entityId":"","data":"{\"message\": \"The \"+ data.attributes.friendly_name  + \" is at \" + payload +\"C\";}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":460,"y":3392,"wires":[[]]}]
1 Like

Thank You. this worked!

I can already send a “notify email” with a simple text from within Nodered and HomeAssistant

But how can I send a notification with a payload that I’ve prepared? See the payload in the image

image

This is not working:
image