Hi serkank, I’m just experimenting with node red. In this node I’m trying to get a notification when a light turn on or off, here is the flow.
[{"id":"36bc9e5b.8ab942","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"d103c0ea.e6883","type":"change","z":"36bc9e5b.8ab942","name":"","rules":[{"t":"set","p":"messages","pt":"msg","to":"[\"Hi\",\"Hello\",\"Hi Again\"]","tot":"json"},{"t":"set","p":"payload.data.message","pt":"msg","to":"something i need to notify you about","tot":"str"},{"t":"set","p":"payload.data.title","pt":"msg","to":"$shuffle(messages)[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":180,"wires":[["5e4a5218.ba5c0c"]]},{"id":"d948f2df.8e808","type":"inject","z":"36bc9e5b.8ab942","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":130,"y":120,"wires":[["d103c0ea.e6883"]]},{"id":"5e4a5218.ba5c0c","type":"api-call-service","z":"36bc9e5b.8ab942","name":"","server":"cc0674b6.29706","version":1,"debugenabled":true,"service_domain":"notify","service":"mobile_app_kerbin_xs","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":180,"wires":[[]]},{"id":"85b61fee.193e18","type":"server-state-changed","z":"36bc9e5b.8ab942","name":"check light status","server":"cc0674b6.29706","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.c1","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"x":100,"y":220,"wires":[["d103c0ea.e6883"],["d103c0ea.e6883"]]},{"id":"cc0674b6.29706","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false}]
Now the problem is that if I manually trigger the inject node, the notification is sent without problem, if i turn on or of the light I have this error:
{"domain":"notify","service":"mobile_app_kerbin_xs","data":{"message":"something i need to notify you about","title":"Hi Again"}}
Cannot set property of non-object type: payload.data.message