Hi,
I have reached page 127 (Build a Home Automation System), in dashboard when i press buttons all work fine in node red but in arduino serial monitor get:
23:47:47.967 -> ………..
23:47:53.783 -> WiFi connected – ESP IP address: 192.168.1.8
23:47:53.783 -> Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
23:48:03.926 -> Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
Ι use macOS High Sierra and pi zero.
Hi.
That error means that your board is not able to establish an MQTT connection with the broker.
Can you double-check that you’ve inserted the right IP address of your MQTT server (raspberry pi)?
Regards,
Sara
Hi,
I connect to pi via ssd with the following IP:
….elos$ sudo ssh pi@192.168.1.8
and in arduino sketch:
const char* mqtt_server = “http://192.168.1.8/”;
Upload the sketch in esp8266 get from arduino IDE the massage:
Executable segment sizes:
IROM : 246364 – code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27260 / 32768 – code in IRAM (ICACHE_RAM_ATTR, ISRs…)
DATA : 1264 ) – initialized variables (global, static) in RAM/HEAP
RODATA : 1052 ) / 81920 – constants (global, static) in RAM/HEAP
BSS : 25096 ) – zeroed variables (global, static) in RAM/HEAP
Το σχέδιο χρησιμοποιεί 275940 bytes (26%) του χώρου αποθήκευσης του προγράμματος. Το μέγιστο είναι 1044464 bytes.
Οι καθολικές μεταβλητές χρησιμοποιούν 27412 bytes (33%) δυναμικής μνήμης, αφήνοντας 54508 bytes για τοπικές μεταβλητές. Το μέγιστο είναι 81920 bytes.
esptool.py v2.8
Serial port /dev/cu.SLAB_USBtoUART
Connecting….
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: a4:cf:12:c7:8c:bf
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 4MB
Compressed 280096 bytes to 205834…
Wrote 280096 bytes (205834 compressed) at 0x00000000 in 18.2 seconds (effective 123.2 kbit/s)…
Hash of data verified.
Leaving…
Hard resetting via RTS pin…
Βρέθηκε μη έγγυρη βιβλιοθήκη στο /Users/angelos/Documents/Arduino/libraries/hardware: Δεν βρέθηκαν αρχεία κεφαλίδας (.h) στο /Users/angelos/Documents/Arduino/libraries/hardware
Hi.
You should write your RPi IP address like this:
const char* mqtt_server = “192.168.1.8”;
Try it and tell me if it solves your problem.
Regards,
Sara