How to send the part of the msg object value into an notification with node-red?

I am trying to get notified of updates on my phone. I have this node sequence where I get the data needed to build the notification:

{"entity_id":"update.mosquitto_broker_update","old_state":{"entity_id":"update.mosquitto_broker_update","state":"on","attributes":{"auto_update":false,"installed_version":"6.1.3","in_progress":true,"latest_version":"6.2.0","release_summary":"# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n#","release_url":null,"skipped_version":null,"title":"Mosquitto broker","entity_picture":"/api/hassio/addons/core_mosquitto/icon","friendly_name":"Mosquitto broker Update","supported_features":25},"last_changed":"2023-03-28T11:02:52.715080+00:00","last_updated":"2023-03-28T13:55:56.139161+00:00","context":{"id":"01GWM820K9SFGW0CKMHSVDF7CP","parent_id":null,"user_id":"2958b2a38fdf487694e401cc6e50ce79"},"original_state":"on"},"new_state":{"entity_id":"update.mosquitto_broker_update","state":"off","attributes":{"auto_update":false,"installed_version":"6.2.0","in_progress":true,"latest_version":"6.2.0","release_summary":"# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n## 6.1.3\n\n- Change timestamp format in logs\n\n## 6.1.2\n\n- Add debug option to help with issues\n\n## 6.1.1\n\n- Don't purge openss","release_url":null,"skipped_version":null,"title":"Mosquitto broker","entity_picture":"/api/hassio/addons/core_mosquitto/icon","friendly_name":"Mosquitto broker Update","supported_features":25},"last_changed":"2023-03-28T13:56:20.366291+00:00","last_updated":"2023-03-28T13:56:20.366291+00:00","context":{"id":"01GWM82R8EB57PN01HATMEKJK8","parent_id":null,"user_id":null},"original_state":"off","timeSinceChangedMs":3},"_msgid":"80599e8c79891b8f"}

But when I tried to send it as notification, all the msg.something are empty.


"data": "{\"message\":\"Update exists for {{{msg}}} ({{{msg.new_state.attributes.installed_version}}} ➡ {{{msg.new_state.attributes.latest_version}}})\"}",

this is the full flow

[{"id":"735dc33062cb97db","type":"tab","label":"Notify on updates","disabled":false,"info":"","env":[]},{"id":"d81f91852ae0c245","type":"debug","z":"735dc33062cb97db","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":900,"y":480,"wires":[]},{"id":"f8d90c1a90c3d7a6","type":"server-state-changed","z":"735dc33062cb97db","name":"","server":"1265decc.ac6211","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"update.","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","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":160,"y":260,"wires":[["269ea2a6777b7ff7"]]},{"id":"a72253ba9a2c17a2","type":"api-call-service","z":"735dc33062cb97db","name":"","server":"1265decc.ac6211","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_poco_saninn_app","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"Update exists for {{{msg}}} ({{{msg.new_state.attributes.installed_version}}} ➡ {{{msg.new_state.attributes.latest_version}}})\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":870,"y":260,"wires":[[]],"info":"The data comes as\n\n```\n{\n  \"payload\": \"off\",\n  \"data\": {\n    \"entity_id\": \"update.mosquitto_broker_update\",\n    \"old_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"on\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.1.3\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T11:02:52.715080+00:00\",\n      \"last_updated\": \"2023-03-28T13:55:56.139161+00:00\",\n      \"context\": {\n        \"id\": \"01GWM820K9SFGW0CKMHSVDF7CP\",\n        \"parent_id\": null,\n        \"user_id\": \"2958b2a38fdf487694e401cc6e50ce79\"\n      },\n      \"original_state\": \"on\"\n    },\n    \"new_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"off\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.2.0\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"last_updated\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"context\": {\n        \"id\": \"01GWM82R8EB57PN01HATMEKJK8\",\n        \"parent_id\": null,\n        \"user_id\": null\n      },\n      \"original_state\": \"off\",\n      \"timeSinceChangedMs\": 3\n    }\n  },\n  \"topic\": \"update.mosquitto_broker_update\",\n  \"_msgid\": \"3215480a351ad1af\"\n}\n```"},{"id":"3d8eb15214cf93ed","type":"inject","z":"735dc33062cb97db","name":"","props":[{"p":"payload"},{"p":"data","v":"{\"payload\":\"off\",\"data\":{\"entity_id\":\"update.mosquitto_broker_update\",\"old_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"on\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.1.3\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T11:02:52.715080+00:00\",\"last_updated\":\"2023-03-28T13:55:56.139161+00:00\",\"context\":{\"id\":\"01GWM820K9SFGW0CKMHSVDF7CP\",\"parent_id\":null,\"user_id\":\"2958b2a38fdf487694e401cc6e50ce79\"},\"original_state\":\"on\"},\"new_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"off\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.2.0\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T13:56:20.366291+00:00\",\"last_updated\":\"2023-03-28T13:56:20.366291+00:00\",\"context\":{\"id\":\"01GWM82R8EB57PN01HATMEKJK8\",\"parent_id\":null,\"user_id\":null},\"original_state\":\"off\",\"timeSinceChangedMs\":3}},\"topic\":\"update.mosquitto_broker_update\",\"_msgid\":\"3215480a351ad1af\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":110,"y":580,"wires":[["269ea2a6777b7ff7"]]},{"id":"269ea2a6777b7ff7","type":"switch","z":"735dc33062cb97db","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":260,"wires":[["50bfb0c6abe45141"]]},{"id":"50bfb0c6abe45141","type":"function","z":"735dc33062cb97db","name":"Extract Data","func":"// const info = msg.data.data;\n// const message = `Update exists for ${info.new_state.attributes.title} (${info.new_state.attributes.installed_version} ➡ ${info.new_state.attributes.latest_version})`\n// return {message}\n\nreturn msg.data.data","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":260,"wires":[["a72253ba9a2c17a2","d81f91852ae0c245"]]},{"id":"1265decc.ac6211","type":"server","name":"Home Assistant","addon":true}]

I have also tried with two { instead of three.

What I am doing wrong?

thanks!

What is the Debug-Output from the switch-node?

What I put on the first code comment

{"entity_id":"update.mosquitto_broker_update","old_state":{"entity_id":"update.mosquitto_broker_update","state":"on","attributes":{"auto_update":false,"installed_version":"6.1.3","in_progress":true,"latest_version":"6.2.0","release_summary":"# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n#","release_url":null,"skipped_version":null,"title":"Mosquitto broker","entity_picture":"/api/hassio/addons/core_mosquitto/icon","friendly_name":"Mosquitto broker Update","supported_features":25},"last_changed":"2023-03-28T11:02:52.715080+00:00","last_updated":"2023-03-28T13:55:56.139161+00:00","context":{"id":"01GWM820K9SFGW0CKMHSVDF7CP","parent_id":null,"user_id":"2958b2a38fdf487694e401cc6e50ce79"},"original_state":"on"},"new_state":{"entity_id":"update.mosquitto_broker_update","state":"off","attributes":{"auto_update":false,"installed_version":"6.2.0","in_progress":true,"latest_version":"6.2.0","release_summary":"# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n## 6.1.3\n\n- Change timestamp format in logs\n\n## 6.1.2\n\n- Add debug option to help with issues\n\n## 6.1.1\n\n- Don't purge openss","release_url":null,"skipped_version":null,"title":"Mosquitto broker","entity_picture":"/api/hassio/addons/core_mosquitto/icon","friendly_name":"Mosquitto broker Update","supported_features":25},"last_changed":"2023-03-28T13:56:20.366291+00:00","last_updated":"2023-03-28T13:56:20.366291+00:00","context":{"id":"01GWM82R8EB57PN01HATMEKJK8","parent_id":null,"user_id":null},"original_state":"off","timeSinceChangedMs":3},"_msgid":"80599e8c79891b8f"}

Also, in the full flow I had wrote and inject node with the real data I get from HA

There is no dataObject inside the payload! So the function will return nothing!
Try this function:

msg.updateExists = msg.payload.new_state.entity_id
msg.installedVersion = msg.payload.new_state.attributes.installed_version
msg.latestVersion = msg.payload.new_state.attributes.latest_version

return msg;

then u can use them in your Message.

[
    {
        "id": "d81f91852ae0c245",
        "type": "debug",
        "z": "735dc33062cb97db",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 620,
        "wires": []
    },
    {
        "id": "9803e203e77a6ecc",
        "type": "inject",
        "z": "735dc33062cb97db",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"entity_id\":\"update.mosquitto_broker_update\",\"old_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"on\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.1.3\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T11:02:52.715080+00:00\",\"last_updated\":\"2023-03-28T13:55:56.139161+00:00\",\"context\":{\"id\":\"01GWM820K9SFGW0CKMHSVDF7CP\",\"parent_id\":null,\"user_id\":\"2958b2a38fdf487694e401cc6e50ce79\"},\"original_state\":\"on\"},\"new_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"off\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.2.0\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T13:56:20.366291+00:00\",\"last_updated\":\"2023-03-28T13:56:20.366291+00:00\",\"context\":{\"id\":\"01GWM82R8EB57PN01HATMEKJK8\",\"parent_id\":null,\"user_id\":null},\"original_state\":\"off\",\"timeSinceChangedMs\":3},\"_msgid\":\"80599e8c79891b8f\"}",
        "payloadType": "json",
        "x": 330,
        "y": 620,
        "wires": [
            [
                "756579790b9bce14"
            ]
        ]
    },
    {
        "id": "756579790b9bce14",
        "type": "function",
        "z": "735dc33062cb97db",
        "name": "Extract Data",
        "func": "// const info = msg.data.data;\n// const message = `Update exists for ${info.new_state.attributes.title} (${info.new_state.attributes.installed_version} ➡ ${info.new_state.attributes.latest_version})`\n// return {message}\nmsg.updateExists = msg.payload.new_state.entity_id\nmsg.installedVersion = msg.payload.new_state.attributes.installed_version\nmsg.latestVersion = msg.payload.new_state.attributes.latest_version\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 620,
        "wires": [
            [
                "d81f91852ae0c245"
            ]
        ]
    }
]

And u have to change the switch node to see where the “on”-State is:

[
    {
        "id": "269ea2a6777b7ff7",
        "type": "switch",
        "z": "735dc33062cb97db",
        "name": "",
        "property": "payload.new_state.state",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 390,
        "y": 260,
        "wires": [
            [
                "50bfb0c6abe45141"
            ]
        ]
    }
]

The inject-node from ur flow is different to the the inject-node in post #1 .

So the function should look like this:

[
    {
        "id": "3d8eb15214cf93ed",
        "type": "inject",
        "z": "735dc33062cb97db",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "data",
                "v": "{\"payload\":\"off\",\"data\":{\"entity_id\":\"update.mosquitto_broker_update\",\"old_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"on\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.1.3\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T11:02:52.715080+00:00\",\"last_updated\":\"2023-03-28T13:55:56.139161+00:00\",\"context\":{\"id\":\"01GWM820K9SFGW0CKMHSVDF7CP\",\"parent_id\":null,\"user_id\":\"2958b2a38fdf487694e401cc6e50ce79\"},\"original_state\":\"on\"},\"new_state\":{\"entity_id\":\"update.mosquitto_broker_update\",\"state\":\"off\",\"attributes\":{\"auto_update\":false,\"installed_version\":\"6.2.0\",\"in_progress\":true,\"latest_version\":\"6.2.0\",\"release_summary\":\"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\"release_url\":null,\"skipped_version\":null,\"title\":\"Mosquitto broker\",\"entity_picture\":\"/api/hassio/addons/core_mosquitto/icon\",\"friendly_name\":\"Mosquitto broker Update\",\"supported_features\":25},\"last_changed\":\"2023-03-28T13:56:20.366291+00:00\",\"last_updated\":\"2023-03-28T13:56:20.366291+00:00\",\"context\":{\"id\":\"01GWM82R8EB57PN01HATMEKJK8\",\"parent_id\":null,\"user_id\":null},\"original_state\":\"off\",\"timeSinceChangedMs\":3}},\"topic\":\"update.mosquitto_broker_update\",\"_msgid\":\"3215480a351ad1af\"}",
                "vt": "json"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "on",
        "payloadType": "str",
        "x": 310,
        "y": 740,
        "wires": [
            [
                "00fbcad61cdebbe6"
            ]
        ]
    },
    {
        "id": "bccc838f3ec73c34",
        "type": "debug",
        "z": "735dc33062cb97db",
        "name": "debug 49",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 740,
        "wires": []
    },
    {
        "id": "00fbcad61cdebbe6",
        "type": "function",
        "z": "735dc33062cb97db",
        "name": "Extract Data",
        "func": "// const info = msg.data.data;\n// const message = `Update exists for ${info.new_state.attributes.title} (${info.new_state.attributes.installed_version} ➡ ${info.new_state.attributes.latest_version})`\n// return {message}\nmsg.updateExists = msg.data.data.new_state.entity_id\nmsg.installedVersion = msg.data.data.new_state.attributes.installed_version\nmsg.latestVersion = msg.data.data.new_state.attributes.latest_version\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 740,
        "wires": [
            [
                "bccc838f3ec73c34"
            ]
        ]
    }
]

Oh sorry, I responded really fast from my phone and I answered you wrongly.

This is the initial data (that comes from HA)

{
  "_msgid": "9a78c9f5f01822aa",
  "payload": "on",
  "data": {
    "payload": "off",
    "data": {
      "entity_id": "update.mosquitto_broker_update",
      "old_state": {
        "entity_id": "update.mosquitto_broker_update",
        "state": "on",
        "attributes": {
          "auto_update": false,
          "installed_version": "6.1.3",
          "in_progress": true,
          "latest_version": "6.2.0",
          "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n#",
          "release_url": null,
          "skipped_version": null,
          "title": "Mosquitto broker",
          "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
          "friendly_name": "Mosquitto broker Update",
          "supported_features": 25
        },
        "last_changed": "2023-03-28T11:02:52.715080+00:00",
        "last_updated": "2023-03-28T13:55:56.139161+00:00",
        "context": {
          "id": "01GWM820K9SFGW0CKMHSVDF7CP",
          "parent_id": null,
          "user_id": "2958b2a38fdf487694e401cc6e50ce79"
        },
        "original_state": "on"
      },
      "new_state": {
        "entity_id": "update.mosquitto_broker_update",
        "state": "off",
        "attributes": {
          "auto_update": false,
          "installed_version": "6.2.0",
          "in_progress": true,
          "latest_version": "6.2.0",
          "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n## 6.1.3\n\n- Change timestamp format in logs\n\n## 6.1.2\n\n- Add debug option to help with issues\n\n## 6.1.1\n\n- Don't purge openss",
          "release_url": null,
          "skipped_version": null,
          "title": "Mosquitto broker",
          "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
          "friendly_name": "Mosquitto broker Update",
          "supported_features": 25
        },
        "last_changed": "2023-03-28T13:56:20.366291+00:00",
        "last_updated": "2023-03-28T13:56:20.366291+00:00",
        "context": {
          "id": "01GWM82R8EB57PN01HATMEKJK8",
          "parent_id": null,
          "user_id": null
        },
        "original_state": "off",
        "timeSinceChangedMs": 3
      }
    },
    "topic": "update.mosquitto_broker_update",
    "_msgid": "3215480a351ad1af"
  }
}

then this is what comes as out of the switch node

{
  "_msgid": "c32a5f47cb0a7e3a",
  "payload": "on",
  "data": {
    "payload": "off",
    "data": {
      "entity_id": "update.mosquitto_broker_update",
      "old_state": {
        "entity_id": "update.mosquitto_broker_update",
        "state": "on",
        "attributes": {
          "auto_update": false,
          "installed_version": "6.1.3",
          "in_progress": true,
          "latest_version": "6.2.0",
          "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n#",
          "release_url": null,
          "skipped_version": null,
          "title": "Mosquitto broker",
          "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
          "friendly_name": "Mosquitto broker Update",
          "supported_features": 25
        },
        "last_changed": "2023-03-28T11:02:52.715080+00:00",
        "last_updated": "2023-03-28T13:55:56.139161+00:00",
        "context": {
          "id": "01GWM820K9SFGW0CKMHSVDF7CP",
          "parent_id": null,
          "user_id": "2958b2a38fdf487694e401cc6e50ce79"
        },
        "original_state": "on"
      },
      "new_state": {
        "entity_id": "update.mosquitto_broker_update",
        "state": "off",
        "attributes": {
          "auto_update": false,
          "installed_version": "6.2.0",
          "in_progress": true,
          "latest_version": "6.2.0",
          "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n## 6.1.3\n\n- Change timestamp format in logs\n\n## 6.1.2\n\n- Add debug option to help with issues\n\n## 6.1.1\n\n- Don't purge openss",
          "release_url": null,
          "skipped_version": null,
          "title": "Mosquitto broker",
          "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
          "friendly_name": "Mosquitto broker Update",
          "supported_features": 25
        },
        "last_changed": "2023-03-28T13:56:20.366291+00:00",
        "last_updated": "2023-03-28T13:56:20.366291+00:00",
        "context": {
          "id": "01GWM82R8EB57PN01HATMEKJK8",
          "parent_id": null,
          "user_id": null
        },
        "original_state": "off",
        "timeSinceChangedMs": 3
      }
    },
    "topic": "update.mosquitto_broker_update",
    "_msgid": "3215480a351ad1af"
  }
}

and this is what comes after the Extract data function node

{
  "entity_id": "update.mosquitto_broker_update",
  "old_state": {
    "entity_id": "update.mosquitto_broker_update",
    "state": "on",
    "attributes": {
      "auto_update": false,
      "installed_version": "6.1.3",
      "in_progress": true,
      "latest_version": "6.2.0",
      "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n#",
      "release_url": null,
      "skipped_version": null,
      "title": "Mosquitto broker",
      "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
      "friendly_name": "Mosquitto broker Update",
      "supported_features": 25
    },
    "last_changed": "2023-03-28T11:02:52.715080+00:00",
    "last_updated": "2023-03-28T13:55:56.139161+00:00",
    "context": {
      "id": "01GWM820K9SFGW0CKMHSVDF7CP",
      "parent_id": null,
      "user_id": "2958b2a38fdf487694e401cc6e50ce79"
    },
    "original_state": "on"
  },
  "new_state": {
    "entity_id": "update.mosquitto_broker_update",
    "state": "off",
    "attributes": {
      "auto_update": false,
      "installed_version": "6.2.0",
      "in_progress": true,
      "latest_version": "6.2.0",
      "release_summary": "# Changelog\n\n## 6.2.0\n\n- Update mosquitto to 2.0.15\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\n\n## 6.1.3\n\n- Change timestamp format in logs\n\n## 6.1.2\n\n- Add debug option to help with issues\n\n## 6.1.1\n\n- Don't purge openss",
      "release_url": null,
      "skipped_version": null,
      "title": "Mosquitto broker",
      "entity_picture": "/api/hassio/addons/core_mosquitto/icon",
      "friendly_name": "Mosquitto broker Update",
      "supported_features": 25
    },
    "last_changed": "2023-03-28T13:56:20.366291+00:00",
    "last_updated": "2023-03-28T13:56:20.366291+00:00",
    "context": {
      "id": "01GWM82R8EB57PN01HATMEKJK8",
      "parent_id": null,
      "user_id": null
    },
    "original_state": "off",
    "timeSinceChangedMs": 3
  },
  "_msgid": "951bd69f40133847"
}

Then is this the corrected function:

[
    {
        "id": "756579790b9bce14",
        "type": "function",
        "z": "735dc33062cb97db",
        "name": "Extract Data",
        "func": "// const info = msg.data.data;\n// const message = `Update exists for ${info.new_state.attributes.title} (${info.new_state.attributes.installed_version} ➡ ${info.new_state.attributes.latest_version})`\n// return {message}\nmsg.updateExists = msg.payload.data.data.new_state.entity_id\nmsg.installedVersion = msg.payload.data.data.new_state.attributes.installed_version\nmsg.latestVersion = msg.payload.data.data.new_state.attributes.latest_version\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 620,
        "wires": [
            [
                "d81f91852ae0c245"
            ]
        ]
    }
]

The problem I haev, is that the message does not render correctly.

For example, this is now what I get using your code:

But those values are not being parsed to my message

[
  {
    "id": "a72253ba9a2c17a2",
    "type": "api-call-service",
    "z": "735dc33062cb97db",
    "name": "",
    "server": "1265decc.ac6211",
    "version": 5,
    "debugenabled": true,
    "domain": "notify",
    "service": "mobile_app_poco_saninn_app",
    "areaId": [],
    "deviceId": [],
    "entityId": [],
    "data": "{\"message\":\"Update exists for {{msg.updateExists}} ({{{msg.installedVersion}}} ➡ {{{msg. latestVersion}}})\"}",
    "dataType": "json",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [],
    "queue": "none",
    "x": 850,
    "y": 200,
    "wires": [[]],
    "info": "The data comes as\n\n```\n{\n  \"payload\": \"off\",\n  \"data\": {\n    \"entity_id\": \"update.mosquitto_broker_update\",\n    \"old_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"on\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.1.3\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T11:02:52.715080+00:00\",\n      \"last_updated\": \"2023-03-28T13:55:56.139161+00:00\",\n      \"context\": {\n        \"id\": \"01GWM820K9SFGW0CKMHSVDF7CP\",\n        \"parent_id\": null,\n        \"user_id\": \"2958b2a38fdf487694e401cc6e50ce79\"\n      },\n      \"original_state\": \"on\"\n    },\n    \"new_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"off\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.2.0\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"last_updated\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"context\": {\n        \"id\": \"01GWM82R8EB57PN01HATMEKJK8\",\n        \"parent_id\": null,\n        \"user_id\": null\n      },\n      \"original_state\": \"off\",\n      \"timeSinceChangedMs\": 3\n    }\n  },\n  \"topic\": \"update.mosquitto_broker_update\",\n  \"_msgid\": \"3215480a351ad1af\"\n}\n```"
  },
  {
    "id": "1265decc.ac6211",
    "type": "server",
    "name": "Home Assistant",
    "addon": true
  }
]

I am assuming that info has something to do with the problem…

Thank you for your help!

This works for me (u need to replace the Service to ur mobile!)

[
    {
        "id": "d81f91852ae0c245",
        "type": "debug",
        "z": "735dc33062cb97db",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 580,
        "wires": []
    },
    {
        "id": "a72253ba9a2c17a2",
        "type": "api-call-service",
        "z": "735dc33062cb97db",
        "name": "",
        "server": "1265decc.ac6211",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "mobile_app_kphone14promax",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"message\":\"{{payload.message}}\",\"title\":\"{{payload.title}}\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 750,
        "y": 740,
        "wires": [
            []
        ],
        "info": "The data comes as\n\n```\n{\n  \"payload\": \"off\",\n  \"data\": {\n    \"entity_id\": \"update.mosquitto_broker_update\",\n    \"old_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"on\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.1.3\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T11:02:52.715080+00:00\",\n      \"last_updated\": \"2023-03-28T13:55:56.139161+00:00\",\n      \"context\": {\n        \"id\": \"01GWM820K9SFGW0CKMHSVDF7CP\",\n        \"parent_id\": null,\n        \"user_id\": \"2958b2a38fdf487694e401cc6e50ce79\"\n      },\n      \"original_state\": \"on\"\n    },\n    \"new_state\": {\n      \"entity_id\": \"update.mosquitto_broker_update\",\n      \"state\": \"off\",\n      \"attributes\": {\n        \"auto_update\": false,\n        \"installed_version\": \"6.2.0\",\n        \"in_progress\": true,\n        \"latest_version\": \"6.2.0\",\n        \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",\n        \"release_url\": null,\n        \"skipped_version\": null,\n        \"title\": \"Mosquitto broker\",\n        \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",\n        \"friendly_name\": \"Mosquitto broker Update\",\n        \"supported_features\": 25\n      },\n      \"last_changed\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"last_updated\": \"2023-03-28T13:56:20.366291+00:00\",\n      \"context\": {\n        \"id\": \"01GWM82R8EB57PN01HATMEKJK8\",\n        \"parent_id\": null,\n        \"user_id\": null\n      },\n      \"original_state\": \"off\",\n      \"timeSinceChangedMs\": 3\n    }\n  },\n  \"topic\": \"update.mosquitto_broker_update\",\n  \"_msgid\": \"3215480a351ad1af\"\n}\n```"
    },
    {
        "id": "756579790b9bce14",
        "type": "function",
        "z": "735dc33062cb97db",
        "name": "Extract Data",
        "func": "// const info = msg.data.data;\n// const message = `Update exists for ${info.new_state.attributes.title} (${info.new_state.attributes.installed_version} ➡ ${info.new_state.attributes.latest_version})`\n// return {message}\nmsg.payload.title = msg.payload.data.data.new_state.entity_id\nmsg.payload.message = msg.payload.data.data.new_state.attributes.installed_version + \" ➡ \" + msg.payload.data.data.new_state.attributes.latest_version\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 580,
        "wires": [
            [
                "6fd018b4a7c5f4e0"
            ]
        ]
    },
    {
        "id": "e5d8937ba0e0c7ea",
        "type": "inject",
        "z": "735dc33062cb97db",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{   \"_msgid\": \"9a78c9f5f01822aa\",   \"payload\": \"on\",   \"data\": {     \"payload\": \"off\",     \"data\": {       \"entity_id\": \"update.mosquitto_broker_update\",       \"old_state\": {         \"entity_id\": \"update.mosquitto_broker_update\",         \"state\": \"on\",         \"attributes\": {           \"auto_update\": false,           \"installed_version\": \"6.1.3\",           \"in_progress\": true,           \"latest_version\": \"6.2.0\",           \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n#\",           \"release_url\": null,           \"skipped_version\": null,           \"title\": \"Mosquitto broker\",           \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",           \"friendly_name\": \"Mosquitto broker Update\",           \"supported_features\": 25         },         \"last_changed\": \"2023-03-28T11:02:52.715080+00:00\",         \"last_updated\": \"2023-03-28T13:55:56.139161+00:00\",         \"context\": {           \"id\": \"01GWM820K9SFGW0CKMHSVDF7CP\",           \"parent_id\": null,           \"user_id\": \"2958b2a38fdf487694e401cc6e50ce79\"         },         \"original_state\": \"on\"       },       \"new_state\": {         \"entity_id\": \"update.mosquitto_broker_update\",         \"state\": \"off\",         \"attributes\": {           \"auto_update\": false,           \"installed_version\": \"6.2.0\",           \"in_progress\": true,           \"latest_version\": \"6.2.0\",           \"release_summary\": \"# Changelog\\n\\n## 6.2.0\\n\\n- Update mosquitto to 2.0.15\\n- Update libwebsockets to 4.3.2 (fixes Unable to create websockets listener)\\n\\n## 6.1.3\\n\\n- Change timestamp format in logs\\n\\n## 6.1.2\\n\\n- Add debug option to help with issues\\n\\n## 6.1.1\\n\\n- Don't purge openss\",           \"release_url\": null,           \"skipped_version\": null,           \"title\": \"Mosquitto broker\",           \"entity_picture\": \"/api/hassio/addons/core_mosquitto/icon\",           \"friendly_name\": \"Mosquitto broker Update\",           \"supported_features\": 25         },         \"last_changed\": \"2023-03-28T13:56:20.366291+00:00\",         \"last_updated\": \"2023-03-28T13:56:20.366291+00:00\",         \"context\": {           \"id\": \"01GWM82R8EB57PN01HATMEKJK8\",           \"parent_id\": null,           \"user_id\": null         },         \"original_state\": \"off\",         \"timeSinceChangedMs\": 3       }     },     \"topic\": \"update.mosquitto_broker_update\",     \"_msgid\": \"3215480a351ad1af\"   } }",
        "payloadType": "json",
        "x": 310,
        "y": 580,
        "wires": [
            [
                "756579790b9bce14"
            ]
        ]
    },
    {
        "id": "6fd018b4a7c5f4e0",
        "type": "change",
        "z": "735dc33062cb97db",
        "name": "DeleteUneededStuff",
        "rules": [
            {
                "t": "delete",
                "p": "payload.payload",
                "pt": "msg"
            },
            {
                "t": "delete",
                "p": "payload.data",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 680,
        "y": 580,
        "wires": [
            [
                "d81f91852ae0c245",
                "a72253ba9a2c17a2"
            ]
        ]
    },
    {
        "id": "1265decc.ac6211",
        "type": "server",
        "name": "Home Assistant",
        "addon": true
    }
]
1 Like

HA seems to need a ‘clean’ Payload. So u have to delete everything else in the payload (look at the changeNode).
:blush:

thanks a lot!

Now I think I understand how the data passes to the call service node, the input object becomes available in the template context. So for example, If my function-node returns

return {
    title: 'my title',
    message: 'my message' 
}

I can use in the notification node directly {{title}} and {{message}}`