# Publishing Foto from ESP32Cam to Dashboard via mqtt

**URL:** <https://discourse.nodered.org/t/publishing-foto-from-esp32cam-to-dashboard-via-mqtt/59594>\
**Category:** General\
**Tags:** mqtt\
**Created:** [9 March 2022 13:34 UTC](https://discourse.nodered.org/t/publishing-foto-from-esp32cam-to-dashboard-via-mqtt/59594 "2022-03-09T13:34:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxmueller50](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maxmueller50/32/2621_2.png) [@maxmueller50](https://discourse.nodered.org/u/maxmueller50)\
**Post date:** [9 March 2022 13:34 UTC](https://discourse.nodered.org/t/publishing-foto-from-esp32cam-to-dashboard-via-mqtt/59594/1 "2022-03-09T13:34:04Z")

</div>

Hi

what is wrong on my flow???

```auto
    {
        "id": "1e03ce048d71e10b",
        "type": "ui_template",
        "z": "fcb20266.ce938",
        "group": "",
        "name": "show image",
        "order": 4,
        "width": "0",
        "height": "0",
        "format": "<img height=\"100%\" src=\"data:image/jpeg;base64,{{msg.payload}}\" />",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "x": 790,
        "y": 600,
        "wires": [
            []
        ]
    },
    {
        "id": "5e8b13a9fea4b33e",
        "type": "base64",
        "z": "fcb20266.ce938",
        "name": "",
        "action": "",
        "property": "payload",
        "x": 520,
        "y": 600,
        "wires": [
            [
                "1e03ce048d71e10b"
            ]
        ]
    },
    {
        "id": "c3c37cbc9b948369",
        "type": "debug",
        "z": "fcb20266.ce938",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 550,
        "y": 660,
        "wires": []
    },
    {
        "id": "a6b455bd1ca3d44a",
        "type": "mqtt in",
        "z": "fcb20266.ce938",
        "name": "Photo",
        "topic": "door/photo",
        "qos": "2",
        "datatype": "auto",
        "broker": "07d3db087409f398",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 190,
        "y": 600,
        "wires": [
            [
                "5e8b13a9fea4b33e",
                "c3c37cbc9b948369"
            ]
        ]
    },
    {
        "id": "07d3db087409f398",
        "type": "mqtt-broker",
        "name": "Door",
        "broker": "192.168.1.101",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
] 

```

the ESP32-Cam sent a foto with the following sketch:

void take\_picture() {  
camera\_fb\_t \* fb = NULL; // pointer  
Serial.println("Taking a photo...");  
fb = esp\_camera\_fb\_get();  
if (!fb) {  
Serial.println("Camera capture failed");  
return;  
}  
if (MQTT\_MAX\_PACKET\_SIZE == 128) {  
//SLOW MODE (increase MQTT\_MAX\_PACKET\_SIZE)  
client.publish\_P("door/photo", fb-\>buf, fb-\>len, false);  
Serial.print("SLOW MODE ");  
}  
else {  
//FAST MODE (increase MQTT\_MAX\_PACKET\_SIZE)  
client.publish("door/photo", fb-\>buf, fb-\>len, false);  
Serial.print("FAST MODE ");  
}  
Serial.print(" message and Foto sent... ");  
esp\_camera\_fb\_return(fb);  
}

the ESP-Cam show's in the serial-monitor a successful capture and sending

18:44:40.788 -\> Connecting to WiFi...  
18:44:40.788 -\> Initializing the camera module...init Cam..1..  
18:44:41.100 -\> Camera init successfully  
18:44:41.100 -\> Ok!  
18:44:41.100 -\> IP Address: http//192.168.1.69  
18:44:41.100 -\> Attempting MQTT connection...connected  
18:44:51.319 -\> Ring-Button Pressed  
18:44:51.319 -\> Taking a photo...  
18:44:51.387 -\> FAST MODE message and Foto sent... Message arrived on topic: door/comming. Message: on

no item will be listed in the Node-Red-Log and no message are given in the Node-Red Debug-list !!!  
Node-Red-Log:  
6 Mar 17:58:00 - [info] Started flows  
6 Mar 17:58:01 - [info] [mqtt-broker:Door] Connected to broker: mqtt://192.168.1.101:1883  
6 Mar 17:58:01 - [info] [mqtt-broker:0a052b42825e3cd5] Connected to broker: mqtt://192.168.1.101:1883

the ESP32-Cam ist tested, as a http-Webserver he are sending normal pictures

Examples in Github: [botabotlab](https://github.com/botabotlab)/ **[ESP32CAM-MQTT](https://github.com/botabotlab/ESP32CAM-MQTT)** also doesn't show's a picture in the Dashboard/Template - and - tested by an independent body with the same result, no photo in the template!

many thanks in advance for further informations

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 May 2022 13:34 UTC](https://discourse.nodered.org/t/publishing-foto-from-esp32cam-to-dashboard-via-mqtt/59594/2 "2022-05-08T13:34:40Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
