Hello,

I am new to MQTT and I wanted to test out flespi with my Arduino MKR1500. I am trying to publish change of sensor value from my website and that goes through flespi and then sent to my Arduino. Then the arduino will act based on what sensor value was sent through the website. I have attached my code here and wanted to know how could I test the pubsub communication using it. I want to connect without using SSL(so I am using port 1883). I am trying to test the subcritpion to a channel using: flespi/message/gw/devices/. How do I determine what is my device ID?

If my code doesnt make sense, can you direct me to a reference code for building and testing it.
Thanks a ton in advance!

https://drive.google.com/drive/folders/1XbxxYMi0UDi5rwlHDmXJ_A6Rgl6Sudwo?usp=sharing

    First, explain how you publish or want to publish data from the site to flespi. There are 2 simple methods for publishing data: http request or publish message using mqtt.
    In order to find out the id of the device, you need to create it. However, for this you need to understand how you want to transfer data from the site to flespi.

      I am planning on publishing the data using a http request

        I just thought. In general, you don't need to create a channel and device if you don't want to use them. You can use REST api methods to publish messages to the broker. However, remember that your topic to which you publish should not start with "flespi/"
        Use this method (https://flespi.io/docs/#/mqtt/messages/post_messages) to publish mqtt message to topic via mqtt broker api.

          6 days later

          HI, I was able to get the communiaction over to flepsi. but as soon as it subscribes to a topic(I left the topic blank, it closes connection after 10 seconds.
          12:36:15.792 -> INFO narrowband ready and gprs attached
          12:36:17.716 -> INFO socket connected
          12:36:18.049 -> INFO before connect request
          12:36:18.096 -> INFO sent connect request
          12:36:20.499 -> INFO before receive
          12:36:20.546 -> INFO connection accepted
          12:36:20.828 -> INFO before subscribe request
          12:36:20.875 -> INFO sent subscribe request
          12:36:30.841 -> INFO close socket
          .
          Is this beacuse I have not subscribed to a topics?

            dkanday Subscribe packet without topic is a protocol violation as defined in the specification. Either do not subscribe without the topic or subscribe to any valid topic, for example to "test".

            Hi shal : I tried subscribing to a topic test_mkr1500 and used MQTT.fx tool to publish and subscribe to data. But when I am using the Arduino Serial monitor, it doesn't receive any message(but the MQTT.fx tool does).

            Here is the output of the serial monitor:
            14:12:00.365 -> INFO narrowband ready and gprs attached
            14:12:02.153 -> INFO socket connected
            14:12:02.481 -> INFO before connect request
            14:12:02.528 -> INFO sent connect request
            14:12:03.974 -> INFO before receive
            14:12:03.974 -> INFO connection accepted
            14:12:04.253 -> INFO before subscribe request
            14:12:04.300 -> INFO sent subscribe request
            14:12:04.861 -> INFO before receive
            14:12:04.861 -> INFO subscription accepted

              Write a Reply...