Community
OpenEnergyMonitor

Community

Emonhub fails to connect to MQTT broker

mqtt
Tags: #<Tag:0x00007f16b07105c0>

(Sven Kopetzki) #1

I struggle to connect emonhub v2.0.0 to an mosquitto MQTT broker,
running on a separate emonpi installation.
The firewall on the MQTT host has been disabled.
I’m able to connect to the broker with other tools.

emonhub’s configuration is derived from the default template:

    [[MQTT]]
        Type = EmonHubMqttInterfacer
        [[[init_settings]]]
            mqtt_host = 192.168.0.29
            mqtt_port = 1883
            mqtt_user = emonpi
            mqtt_passwd = MYSECRETPASSWORD

        [[[runtimesettings]]]
            pubchannels = ToRFM12,
            subchannels = ToEmonCMS,

            # emonhub/rx/10/values format
            # Use with emoncms Nodes module
            node_format_enable = 1
            node_format_basetopic = emonhub/

            # emon/emontx/power1 format - use with Emoncms MQTT input
            # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
            nodevar_format_enable = 1
            nodevar_format_basetopic = emon/

The log shows periodic connection attemps, without any error message.
It seems there is no exception being thrown, but the connection is not established.

2018-01-30 19:33:30,687 INFO     MainThread EmonHub emonHub emon-pi variant v2.0.0
2018-01-30 19:33:30,687 INFO     MainThread Opening hub...
2018-01-30 19:33:30,688 INFO     MainThread Logging level set to DEBUG
2018-01-30 19:33:30,688 INFO     MainThread Creating EmonHubSerialInterfacer 'Pulse2Pi' 
2018-01-30 19:33:30,692 DEBUG    MainThread Opening serial port: /dev/ttyUSB1 @ 38400 bits/s
2018-01-30 19:33:30,693 DEBUG    MainThread Setting Pulse2Pi subchannels: ['ToRFM12']
2018-01-30 19:33:30,693 DEBUG    MainThread Setting Pulse2Pi pubchannels: ['ToEmonCMS']
2018-01-30 19:33:30,694 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT' 
2018-01-30 19:33:30,695 INFO     MainThread MQTT Init mqtt_host=192.168.0.29 mqtt_port=1883 mqtt_user=emonpi
2018-01-30 19:33:30,798 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:30,904 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,008 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,111 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,217 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,324 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,433 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,539 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:31,646 INFO     MQTT       Connecting to MQTT Server
...
2018-01-30 19:33:42,267 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,375 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,489 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,595 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,699 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,803 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:42,907 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,014 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,121 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,252 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,359 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,417 DEBUG    MainThread SIGINT received.
2018-01-30 19:33:43,418 INFO     MainThread Exiting hub...
2018-01-30 19:33:43,466 INFO     MQTT       Connecting to MQTT Server
2018-01-30 19:33:43,471 INFO     MainThread Exit completed

Any ides? How may I debug the issue?