MQTT keeps reconnecting [solved]



  • My GatewayESP8266MQTTClient keeps connecting to the MQTT connection, these messages appear really fast (several per second):

    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    

    The MQTT log show the following:

    1494858022: New client connected from 192.168.0.164 as mpp-1 (c1, k15).
    1494858022: New connection from 192.168.0.177 on port 1883.
    1494858022: Client mpp-1 already connected, closing old connection.
    1494858022: New client connected from 192.168.0.177 as mpp-1 (c1, k5000).
    1494858022: New connection from 192.168.0.164 on port 1883.
    1494858022: Client mpp-1 already connected, closing old connection.
    1494858022: New client connected from 192.168.0.164 as mpp-1 (c1, k15).
    1494858022: New connection from 192.168.0.177 on port 1883.
    1494858022: Client mpp-1 already connected, closing old connection.
    

    So it appears that the Gateway tries to connect but is then immediately being kicked out.

    Could it be that it is being kicked out by its own (previous) attempt to connect OR is there a problem with the controller?

    Is there a setting to configure the connection timeout?


  • Mod

    @mpp could it be related to the problem experienced in https://forum.mysensors.org/post/25269 ?



  • @mfalkvidd, I only have one Gateway with the ID "mpp-1".

    "mpp-1" is both the client id in the gateway sketch:

    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mpp-1"
    

    and the "Client id" in the gateway setting on mycontroller, but I assume this is correct?

    As soon as I change the latter the loop drops and the Gateway is connected to MQTT but then I no longer have that Gateway configured in mycontroller?


  • Plugin Developer

    @mpp What is the version of MyController are you using? Are you using inbuilt MQTT broker?

    Check the topic to-subscribe and to-publish.



  • Hi @jkandasa, I'm using the latest 0.0.3.Alpha2 release. I tested both with mosquitto and the built in broker.
    As soon as I enable the Gateway in the UI I keep getting connections very fast (10 per second).

    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQT0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    0;255;3;0;9;Attempting MQTT connection...
    0;255;3;0;9;MQTT connected
    0;255;3;0;9;Sending message on topic: mpp1-out/0/255/0/0/18
    IP: 192.168.0.164
    

    This happens both with mosquitto as with moquette.

    These are the topics I'm using: mpp1-in and mpp1-out

    I also noticed a java.lang.NullPointerException in the log, see https://github.com/mycontroller-org/mycontroller/issues/245

    2017-05-15 15:28:22,570 INFO [MQTT Rec: mpp-1] [org.mycontroller.standalone.gateway.mqtt.MqttCallbackListener:115] MQTT Gateway[tcp://192.168.0.177:1883] Reconnected successfully...
    2017-05-15 15:28:22,653 ERROR [nioEventLoopGroup-5-1] [io.moquette.server.netty.NettyMQTTHandler:84] Bad error in processing the message
    java.lang.NullPointerException: null
    	at io.moquette.spi.impl.ProtocolProcessor.route2Subscribers(ProtocolProcessor.java:460) ~[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.moquette.spi.impl.ProtocolProcessor.processPublish(ProtocolProcessor.java:310) ~[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.moquette.server.netty.NettyMQTTHandler.channelRead(NettyMQTTHandler.java:61) ~[mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.moquette.server.netty.metrics.MessageMetricsHandler.channelRead(MessageMetricsHandler.java:46) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.moquette.server.netty.metrics.BytesMetricsHandler.channelRead(BytesMetricsHandler.java:47) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [mycontroller-dist-standalone-0.0.3.Alpha2-single.jar:0.0.3.Alpha2]
    	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
    2017-05-15 15:28:22,788 ERROR [MQTT Rec: mpp-1] [org.mycontroller.standalone.gateway.mqtt.MqttCallbackListener:55] MQTT Gateway[id:6, Name:MPP, serverURI:tcp://192.168.0.177:1883] connection lost! Error:Connection lost
    2017-05-15 15:28:22,927 INFO [MQTT Rec: mpp-1] [org.mycontroller.standalone.gateway.mqtt.MqttCallbackListener:115] MQTT Gateway[tcp://192.168.0.177:1883] Reconnected successfully...
    

  • Plugin Developer

    @mpp use different MQTT client id on your gateway sketch and MyController gateway configuration page. In the recent version, 3 random chars will be appended on MyController to avoid this kind of issue. If you want to try recent SNAPSHOT version have a look on >> http://forum.mycontroller.org/topic/58/download-snapshot-build



  • I added abc to the id (mpp-1abc) and it behaves the same as if no gateway has been configured.

    What I don't understand now is how the nodes could be detected by mycontrolled (now the client id is different)?


  • Plugin Developer

    @mpp can you post your gateway sketch and MyController gateway configuration page(select gateway, click edit and post that page)



  • @jkandasa here's the sketch

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     *
     * DESCRIPTION
     * The ESP8266 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
     * The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
     *
     * LED purposes:
     * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch
     * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
     * nRF24L01+  ESP8266
     * VCC        VCC
     * CE         GPIO4
     * CSN/CS     GPIO15
     * SCK        GPIO14
     * MISO       GPIO12
     * MOSI       GPIO13
     *
     * Not all ESP8266 modules have all pins available on their external interface.
     * This code has been tested on an ESP-12 module.
     * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
     * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
     * - Connect GPIO15 via 10K pulldown resistor to GND
     * - Connect CH_PD via 10K resistor to VCC
     * - Connect GPIO2 via 10K resistor to VCC
     * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
     *
      * Inclusion mode button:
     * - Connect GPIO5 via switch to GND ('inclusion switch')
     *
     * Hardware SHA204 signing is currently not supported!
     *
     * Make sure to fill in your ssid and WiFi password below for ssid & pass.
     */
    
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 9600
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_433MHZ
    #define MY_IS_RFM69HW
    #define MY_RF69_IRQ_PIN D1
    #define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    #define MY_RF69_SPI_CS D8
    #define MY_RFM69_NETWORKID 99
    
    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266
    
    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mpp1-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mpp1-in"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mpp-1"
    
    // Enable these if your MQTT broker requires usenrame/password
    //#define MY_MQTT_USER "username"
    //#define MY_MQTT_PASSWORD "password"
    
    // Set WIFI SSID and password
    #define MY_ESP8266_SSID "Airport"
    #define MY_ESP8266_PASSWORD "********"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    // #define MY_ESP8266_HOSTNAME "mqtt-sensor-gateway"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    //#define MY_IP_ADDRESS 192,168,178,87
    
    // If using static ip you need to define Gateway and Subnet address as well
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    
    // MQTT broker ip address.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 177
    
    // The MQTT broker port to to open
    #define MY_PORT 1883
    
    /*
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    #define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    */
    
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    
    void setup()
    {
    }
    
    void presentation()
    {
    	// Present locally attached sensors here
    }
    
    
    void loop()
    {
    	// Send locally attech sensors data here
    }
    

    This is the UI
    0_1494863047372_Schermafdruk 2017-05-15 17.43.36.png



  • upgrading to the latest build fixed my issues.

    Thanks guys for the support!


Log in to reply
 

Suggested Topics

  • 3
  • 1
  • 2
  • 3
  • 24
  • 15

22
Online

11.2k
Users

11.1k
Topics

112.5k
Posts