Node Red externo ao HA

Galera,

Tenho um servidor proxmox onde tenho instalado o HA e o NodeRed, ambos separados. Estou com um fluxo onde faço a snapshot de uma câmera no HA e depois envio para o Telegram via Node Red, só que quando chega no Nó para ler o snapshot, dar erro, pois o HA e NR são máquinas diferentes, abaixo está meu fluxo, caso alguém possa me ajudar, fico grato.

[
{
    "id": "59facbe0d303684e",
    "type": "telegram sender",
    "z": "33bd0b0e4554971f",
    "name": "",
    "bot": "f89fe02f9bfaccec",
    "haserroroutput": false,
    "outputs": 1,
    "x": 650,
    "y": 500,
    "wires": [
        []
    ]
},
{
    "id": "d32b734823a953c9",
    "type": "api-call-service",
    "z": "33bd0b0e4554971f",
    "name": "",
    "server": "f0ddc8d1966dbcf6",
    "version": 7,
    "debugenabled": false,
    "action": "camera.snapshot",
    "floorId": [],
    "areaId": [],
    "deviceId": [],
    "entityId": [
        "camera.garagem_2_main"
    ],
    "labelId": [],
    "data": "{\t    \"filename\": \"/config/www/tmp/garagem_2_janela_quarto.jpg\"\t}",
    "dataType": "jsonata",
    "mergeContext": "",
    "mustacheAltTags": false,
    "outputProperties": [],
    "queue": "none",
    "blockInputOverrides": false,
    "domain": "camera",
    "service": "snapshot",
    "x": 810,
    "y": 440,
    "wires": [
        [
            "239832b944554fb4"
        ]
    ]
},
{
    "id": "5fae0d2ca57d095b",
    "type": "file in",
    "z": "33bd0b0e4554971f",
    "name": "Ler Snapshot",
    "filename": "/homeassistant/www/tmp/garagem_2_janela_quarto.jpg",
    "filenameType": "str",
    "format": "",
    "chunk": false,
    "sendError": false,
    "encoding": "none",
    "allProps": false,
    "x": 270,
    "y": 500,
    "wires": [
        [
            "30c4806e3bdeacfd"
        ]
    ]
},
{
    "id": "30c4806e3bdeacfd",
    "type": "function",
    "z": "33bd0b0e4554971f",
    "name": "Criar Payload",
    "func": "// Definir mensagem\nconst gateEmoji = '🪟';\n\n\nconst message = `${gateEmoji} A janela do quarto social foi aberta!!!`;\n\n\nmsg.payload = {\n    chatId: \"xxxxxx\",\n    type: \"photo\",\n    content: msg.filename,\n    options: {\n        caption: message,\n        parse_mode: \"HTML\",\n        reply_markup: {}\n    }\n};\n\nreturn msg;",
    "outputs": 1,
    "timeout": "",
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 460,
    "y": 500,
    "wires": [
        [
            "59facbe0d303684e"
        ]
    ]
},
{
    "id": "239832b944554fb4",
    "type": "delay",
    "z": "33bd0b0e4554971f",
    "name": "",
    "pauseType": "delay",
    "timeout": "5",
    "timeoutUnits": "seconds",
    "rate": "1",
    "nbRateUnits": "1",
    "rateUnits": "second",
    "randomFirst": "1",
    "randomLast": "5",
    "randomUnits": "seconds",
    "drop": false,
    "allowrate": false,
    "outputs": 1,
    "x": 120,
    "y": 500,
    "wires": [
        [
            "5fae0d2ca57d095b"
        ]
    ]
},
{
    "id": "10f73885599fdcad",
    "type": "server-state-changed",
    "z": "33bd0b0e4554971f",
    "name": "Verificar quarto social",
    "server": "86154999dfdae5ec",
    "version": 6,
    "outputs": 2,
    "exposeAsEntityConfig": "",
    "entities": {
        "entity": [
            "binary_sensor.janela_quarto_social"
        ],
        "substring": [],
        "regex": []
    },
    "outputInitially": false,
    "stateType": "str",
    "ifState": "on",
    "ifStateType": "str",
    "ifStateOperator": "is",
    "outputOnlyOnStateChange": 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": 140,
    "y": 440,
    "wires": [
        [
            "7f56e43baf784d21"
        ],
        []
    ]
},
{
    "id": "7f56e43baf784d21",
    "type": "switch",
    "z": "33bd0b0e4554971f",
    "name": "",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "on",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 1,
    "x": 310,
    "y": 440,
    "wires": [
        [
            "a2b0945ab4072d94"
        ]
    ]
},
{
    "id": "a2b0945ab4072d94",
    "type": "api-current-state",
    "z": "33bd0b0e4554971f",
    "name": "Verificar Alarme",
    "server": "f0ddc8d1966dbcf6",
    "version": 3,
    "outputs": 1,
    "halt_if": "",
    "halt_if_type": "str",
    "halt_if_compare": "is",
    "entity_id": "alarm_control_panel.home_alarm",
    "state_type": "str",
    "blockInputOverrides": false,
    "outputProperties": [
        {
            "property": "payload",
            "propertyType": "msg",
            "value": "",
            "valueType": "entityState"
        },
        {
            "property": "data",
            "propertyType": "msg",
            "value": "",
            "valueType": "entity"
        }
    ],
    "for": "0",
    "forType": "num",
    "forUnits": "minutes",
    "override_topic": false,
    "state_location": "payload",
    "override_payload": "msg",
    "entity_location": "data",
    "override_data": "msg",
    "x": 460,
    "y": 440,
    "wires": [
        [
            "18815a4913883082"
        ]
    ]
},
{
    "id": "18815a4913883082",
    "type": "switch",
    "z": "33bd0b0e4554971f",
    "name": "",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "armed_away",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "armed_vacation",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "armed_custom_bypass",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 3,
    "x": 610,
    "y": 440,
    "wires": [
        [
            "d32b734823a953c9"
        ],
        [
            "d32b734823a953c9"
        ],
        [
            "d32b734823a953c9"
        ]
    ]
},
{
    "id": "f89fe02f9bfaccec",
    "type": "telegram bot",
    "botname": "teste",
    "usernames": "",
    "chatids": "",
    "baseapiurl": "",
    "testenvironment": false,
    "updatemode": "polling",
    "addressfamily": "",
    "pollinterval": "300",
    "usesocks": false,
    "sockshost": "",
    "socksprotocol": "socks5",
    "socksport": "6667",
    "socksusername": "anonymous",
    "sockspassword": "",
    "bothost": "",
    "botpath": "",
    "localbotport": "8443",
    "publicbotport": "8443",
    "privatekey": "",
    "certificate": "",
    "useselfsignedcertificate": false,
    "sslterminated": false,
    "verboselogging": false
},
{
    "id": "f0ddc8d1966dbcf6",
    "type": "server",
    "name": "Home Assistant",
    "version": 5,
    "addon": false,
    "rejectUnauthorizedCerts": true,
    "ha_boolean": "y|yes|true|on|home|open",
    "connectionDelay": true,
    "cacheJson": true,
    "heartbeat": false,
    "heartbeatInterval": "30",
    "areaSelector": "friendlyName",
    "deviceSelector": "friendlyName",
    "entitySelector": "friendlyName",
    "statusSeparator": ": ",
    "statusYear": "hidden",
    "statusMonth": "short",
    "statusDay": "numeric",
    "statusHourCycle": "default",
    "statusTimeFormat": "h:m",
    "enableGlobalContextStore": false
},
{
    "id": "86154999dfdae5ec",
    "type": "server",
    "name": "Home Assistant teste",
    "version": 5,
    "addon": false,
    "rejectUnauthorizedCerts": true,
    "ha_boolean": "y|yes|true|on|home|open",
    "connectionDelay": true,
    "cacheJson": true,
    "heartbeat": false,
    "heartbeatInterval": "30",
    "areaSelector": "friendlyName",
    "deviceSelector": "friendlyName",
    "entitySelector": "friendlyName",
    "statusSeparator": ": ",
    "statusYear": "hidden",
    "statusMonth": "short",
    "statusDay": "numeric",
    "statusHourCycle": "default",
    "statusTimeFormat": "h:m",
    "enableGlobalContextStore": false
}

]

Como são “máquinas” diferentes vc vai ter que acessar o arquivo de outra forma.
Da maneira que vc colocou vai procurar o caminho dentro do lxc/docker do node red.

Aqui consigo acesso externo via browser com o endereço:

https://meudomino.com.br/local/avatar.png

Onde “local” é a pasta www.

Provavelmente deve funcionar dentro do node red usando apenas o IP: porta

Talvez tenha uma forma de vc acessar via samba ou FTP

Já tentei usando o link externo do meu HA, mas a imagem mesmo que sendo salva sempre na pasta, o link não atualiza a imagem, ele sempre manda a mesma imagem, sendo que já foi atualizada na pasta, mas não pega a imagem atualizada, o telegram mostra a mesma imagem, mas se eu colar o link no navegador a imagem está atualizada.

Não sei como vc fez para pegar a imagem usando o nó read file com endereço http, aqui não funcionou.

Usando o nó http funcionou normal e não teve problema com a imagem não ser atualizada.

[
    {
        "id": "2058d729.1a3a48",
        "type": "function",
        "z": "d7c04cecba19925c",
        "name": "send image",
        "func": "// Definir mensagem\nconst gateEmoji = '🪟';\nvar buffer = msg.payload;\n\n\nconst message = `${gateEmoji} A janela do quarto social foi aberta!!!`;\n\n\nmsg.payload = {\n    chatId: \"xxxxx\",\n    type: \"photo\",\n    content: buffer,\n    options: {\n        caption: message,\n        parse_mode: \"HTML\",\n        reply_markup: {}\n    }\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 570,
        "y": 340,
        "wires": [
            [
                "99ee972c.22d088"
            ]
        ]
    },
    {
        "id": "dec15032.19344",
        "type": "http request",
        "z": "d7c04cecba19925c",
        "name": "",
        "method": "GET",
        "ret": "bin",
        "paytoqs": "ignore",
        "url": "http://192.168.0.6:3815/local/snapshot2/snapshot.jpg",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 390,
        "y": 340,
        "wires": [
            [
                "2058d729.1a3a48"
            ]
        ]
    }
]

Agora sim, deu certo, estava tentanto usar o método POST no nó HTTP. Muito obrigado pela ajuda.

Como seria para os casos de vídeos? Tentei alterar aqui e não consegui. No Nó Action mudei para record e no nó telegram defini como video, mas mesmo assim da erro.

Caught exception in sender node:

Error: EFATAL: Unsupported Buffer file-type
when processing message:
{“_msgid”:“5ef139854410203f”,“payload”:{“chatId”:“-100XXXXXXXXXXX”,“type”:“video”,“content”:{“type”:“Buffer”,“data”:[0,0,0,36,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,54,105,115,111,50,97,118,99,49,109,112,52,49,0,0,4,191,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,230,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,10,0,0,0,7,128,0,0,0,0,1,130,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,1,95,144,0,0,0,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,…