windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
264 stars 117 forks source link

Part off message.payload.content is not sent #255

Closed adizag closed 2 years ago

adizag commented 2 years ago

Hi,

I have a strange problem. I'm using a join flow in order to combine a few filled into one message. when trying to send it to telegram, only the one part of the message is sent while the other part is just being ignored... In the following example, the "Occupancy" entity is present while the "Contact" entity is ignored in the TELEGRAM SENDER node while both present in the DEBUG node:

image

if I put the whole message into message.payload.content manually it sends the full message...

these are the nodes for creating the combined message:

[
    {
        "id": "655162c3f9269529",
        "type": "ha-get-entities",
        "z": "55038c8d4ab549dc",
        "name": "",
        "server": "1883410b.33b08f",
        "version": 0,
        "rules": [
            {
                "property": "entity_id",
                "logic": "is",
                "value": "binary_sensor.alarm",
                "valueType": "re"
            },
            {
                "property": "state",
                "logic": "is",
                "value": "on",
                "valueType": "str"
            }
        ],
        "output_type": "split",
        "output_empty_results": false,
        "output_location_type": "msg",
        "output_location": "payload",
        "output_results_count": 1,
        "x": 1630,
        "y": 1180,
        "wires": [
            [
                "18537f3923756189"
            ]
        ]
    },
    {
        "id": "18537f3923756189",
        "type": "template",
        "z": "55038c8d4ab549dc",
        "name": "Format Friendly Name",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "{{payload.attributes.friendly_name}}",
        "output": "str",
        "x": 1840,
        "y": 1180,
        "wires": [
            [
                "f9be469fc5960217"
            ]
        ]
    },
    {
        "id": "9d1027665a6b2b77",
        "type": "join",
        "z": "55038c8d4ab549dc",
        "name": "",
        "mode": "custom",
        "build": "string",
        "property": "message",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n ",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 2270,
        "y": 1180,
        "wires": [
            [
                "545baa11019e1277"
            ]
        ]
    },
    {
        "id": "f9be469fc5960217",
        "type": "change",
        "z": "55038c8d4ab549dc",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "message",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2090,
        "y": 1180,
        "wires": [
            [
                "9d1027665a6b2b77"
            ]
        ]
    },
    {
        "id": "7214f412fc9173a5",
        "type": "inject",
        "z": "55038c8d4ab549dc",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1440,
        "y": 1180,
        "wires": [
            [
                "655162c3f9269529"
            ]
        ]
    },
    {
        "id": "545baa11019e1277",
        "type": "change",
        "z": "55038c8d4ab549dc",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.content",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "payload.type",
                "pt": "msg",
                "to": "message",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload.chatId",
                "pt": "msg",
                "to": "-792573601",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2440,
        "y": 1180,
        "wires": [
            [
                "917f462d490c43b7"
            ]
        ]
    },
    {
        "id": "917f462d490c43b7",
        "type": "telegram sender",
        "z": "55038c8d4ab549dc",
        "name": "",
        "bot": "d88602aaf02b92b3",
        "haserroroutput": false,
        "outputs": 1,
        "x": 2650,
        "y": 1180,
        "wires": [
            []
        ]
    },
    {
        "id": "1883410b.33b08f",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30"
    },
    {
        "id": "d88602aaf02b92b3",
        "type": "telegram bot",
        "botname": "Alter1987_bot",
        "usernames": "",
        "chatids": "",
        "baseapiurl": "",
        "updatemode": "polling",
        "pollinterval": "300",
        "usesocks": false,
        "sockshost": "",
        "socksport": "6667",
        "socksusername": "anonymous",
        "sockspassword": "",
        "bothost": "",
        "botpath": "",
        "localbotport": "8443",
        "publicbotport": "8443",
        "privatekey": "",
        "certificate": "",
        "useselfsignedcertificate": false,
        "sslterminated": false,
        "verboselogging": false
    }
]
windkh commented 2 years ago

Hi @adizag I can only speculate what is going on in your flow as I can not reproduce it as I do not have home-assistant. In my eyes it seems that your flow does something wrong here not the telegram nodes.

A first quick hint could be that the last message contains a payload and a message which differ from each other. Does the group node just send the payload instead of message?

image

adizag commented 2 years ago

You were right. That's what happens when you debug to late into the night.... The payload and message were different.

Tnx, sorry for the unnecessary issue i started. It can be deleted if possible.

Adi