# Issue configuring MQTT "AI on the edge" with Node-Red

**URL:** <https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215>\
**Category:** General\
**Tags:** node-red-dashboard, mqtt\
**Created:** [14 December 2022 17:40 UTC](https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215 "2022-12-14T17:40:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mimijojo](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mimijojo](https://discourse.nodered.org/u/mimijojo)\
**Post date:** [14 December 2022 17:40 UTC](https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215/1 "2022-12-14T17:40:09Z")

</div>

I'm using "AI on the edge" (Release: v13.0.7 (Commit: 304b9e0)) on my ESP32-CAM. Here the config.ini file including the MQTT parameters :

```auto
[MakeImage]
;LogImageLocation = /log/source
WaitBeforeTakingPicture = 5
;LogfileRetentionInDays = 15
Brightness = 0
Contrast = 0
Saturation = 0
LEDIntensity = 10
ImageQuality = 12
ImageSize = VGA
FixedExposure = false

[Alignment]
InitialRotate = 185
InitialMirror = false
SearchFieldX = 20
SearchFieldY = 20
AlignmentAlgo = default
FlipImageSize = false
/config/ref0.jpg 34 83
/config/ref1.jpg 404 246

[Digits]
Model = /config/dig-class100-0140_s2_q.tflite
CNNGoodThreshold = 0.5
LogImageLocation = /log/digit
LogfileRetentionInDays = 3
main.dig1 84 245 22 38 0
main.dig2 122 245 22 38 0
main.dig3 160 245 22 38 0
main.dig4 198 245 22 38 0
main.dig5 236 245 22 38 0
main.aft1 274 245 22 38 0
main.aft2 312 245 22 38 0
main.aft3 350 245 22 38 0

;[Analog]
Model = /config/ana-class100_0130_s1_q.tflite
;LogImageLocation = /log/analog
;LogfileRetentionInDays = 3
main.ana1 432 230 92 92 false
main.ana2 379 332 92 92 false
main.ana3 283 374 92 92 false
main.ana4 155 328 92 92 false

[PostProcessing]
main.DecimalShift = -3
main.AnalogDigitalTransitionStart = 9.2
PreValueUse = true
PreValueAgeStartup = 720
AllowNegativeRates = false
main.MaxRateValue = 0.05
main.MaxRateType = AbsoluteChange
;main.ExtendedResolution = false
;main.IgnoreLeadingNaN = true
ErrorMessage = true
CheckDigitIncreaseConsistency = false

[MQTT]
Uri = mqtt://aaa.bbb.ccc.ddd:1883
MainTopic = gazmeter
;ClientID = gaz
;user = USERNAME
;password = PASSWORD
;SetRetainFlag = true
;HomeassistantDiscovery = true
;MeterType = gas_m3

;[InfluxDB]
;Uri = http://aaa.bbb.ccc.ddd:8086
;Database = TEMPERATURES
;Measurement = GAZ
;user = 
;password = 

;[GPIO]
;IO0 = input disabled 10 false false 
;IO1 = input disabled 10 false false 
;IO3 = input disabled 10 false false 
;IO4 = built-in-led disabled 10 false false 
;IO12 = input-pullup disabled 10 false false 
;IO13 = input-pullup disabled 10 false false 
LEDType = WS2812
LEDNumbers = 2
LEDColor = 150 150 150

[AutoTimer]
AutoStart = true
Intervall = 5

[DataLogging]
DataLogActive = true
DataLogRetentionInDays = 10

[Debug]
Logfile = 4
LogfileRetentionInDays = 3

[System]
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
;TimeServer = undefined
;AutoAdjustSummertime = false
;Hostname = undefined
SetupMode = false

```

NodeRed 1.3.4 is active on my Raspberry PI. Here the configuration :

```auto
[{"id":"48c00b80.4b3ba4","type":"mqtt in","z":"fff138d6.dd0458","name":"","topic":"gazmeter","qos":"2","datatype":"auto","broker":"f7fe95c9.07ba4","nl":false,"rap":true,"rh":0,"x":160,"y":940,"wires":[["ac972b42.5bf5e8"]]},{"id":"ac972b42.5bf5e8","type":"debug","z":"fff138d6.dd0458","name":"mqqq","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":940,"wires":[]},{"id":"f7fe95c9.07ba4","type":"mqtt-broker","name":"Compteur_GAZ","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"true","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"true","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

Mosquitto MQTT is also active. "mqtt in"-node tested successfully. Both "mosquitto\_pub -t gazmeter -m "test" " command, as well as [http://mqtt-explorer.com/](http://mqtt-explorer.com/) tool display expected payload msg (="test").

Issue : For some reason, I'm unable to send counter value from my "AI on the edge" system to my NodeRed using MQTT. I suspect a config issue on Node-Red MQTT node. Please find below the logfile of my "AI on the edge" setup. I assume it contains part of the solution.

[log.AI.on.the.edge.txt](https://discourse.nodered.org/uploads/short-url/hoYrbEHchTxfNBnFv8TDstHBPw0.txt) (84.1 KB)

Any hint ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 December 2022 21:20 UTC](https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215/2 "2022-12-14T21:20:21Z")

</div>

Welcome to the forum @mimijojo

> [@mimijojo](#):
>
> `Uri = mqtt://aaa.bbb.ccc.ddd:1883`

Is that what you actually have in the config?

Where is mosquitto installed?

Looking at the log it appears to be publishing to subtopics of gazmeter, so I suggest setting your mqtt In node to subscribe to `gazmeter/#`

---

<div class="post-metadata">

**Author:** ![mimijojo](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mimijojo](https://discourse.nodered.org/u/mimijojo)\
**Post date:** [20 December 2022 12:38 UTC](https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215/3 "2022-12-20T12:38:56Z")

</div>

> [@mimijojo](#):
>
> `gazmeter`

Hi,  
There was no communication issue between the devices.

I could fix the issue by replacing `MainTopic = gazmeter` by `MainTopic = gazmeter/main/value`.

I struggled a bit receiving data as `gazmeter/main/value` sometimes contains no data. I figured out by first configuring `gazmeter/main/raw`, as this always contains data.

Thanks !  
Brgds,  
Michael

---

<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:** [3 January 2023 12:39 UTC](https://discourse.nodered.org/t/issue-configuring-mqtt-ai-on-the-edge-with-node-red/72215/4 "2023-01-03T12:39:54Z")

</div>

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