Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By sunbelt57
#91510 I've got mosquitto_sub running on a couple linux boxes on my network, and I'm compiling the example that comes with the ESP8266_RTOS_SDK examples in the mqtt section (ws & tcp). The 'Example Configuration' section of the menuconfig defaults to some cloud mqtt url but I want it to use the mosquitto broker running on one of my linux boxes. So I specify the broker url as 192.168.88.150 which works with mosquitto, but when I compile and flash the ESP8266 is says:
Code: Select allError parse uri: = 192.168.88.150
Client asked to stop, but was not started
Client was not initialized

I also had to hard code in setting the port number because I couldn't find where to set it in the menuconfig.
I'm digging threw the code right now in components/mqtt/esp-mqtt/mqtt_client.c but I don't want to go mucking around with it by hard-coding it in. Do I need to specify a DNS name for the linux box?
User avatar
By quackmore
#91529 I checked out that example some time ago

I'm using mosquitto too, so I went straight to the code and changed it like the following

Code: Select all     const esp_mqtt_client_config_t mqtt_cfg = {
        // .uri = "mqtts://mqtt.eclipse.org:8883",
        // .uri = CONFIG_BROKER_URI,
        .host = "192.168.88.50",
        .port = 1883,
        .transport = MQTT_TRANSPORT_OVER_SSL,


but I think you can get the same result setting your BROKER_URI to

Code: Select allmqtts://192.168.88.150:1883
User avatar
By quackmore
#91532 on second thought this is probably what you were looking for...

you can also change the file Kconfig.projbuild
and have your host and port configurable by menuconfig

Kconfig.projbuild
Code: Select all...
config BROKER_HOST
        string "Broker HOST"
        default "192.168.1.100"
        help
            The mqtt broker IP address.

config BROKER_PORT
        int "Broker PORT"
        default 1883
        help
            The mqtt broker port.
...


and then into the code

Code: Select allconst esp_mqtt_client_config_t mqtt_cfg = {
        // .uri = CONFIG_BROKER_URI,
        .host = CONFIG_BROKER_HOST,
        .port = CONFIG_BROKER_PORT,