Mqtt interfacer gets no data

I start emonhub, I can see RFM2Pi getting data in the logs:

2023-03-10 17:38:27,099 DEBUG RFM2Pi 150 NEW FRAME : OK 6 2 0 0 0 0 0 0 0 156 88 (-52)
2023-03-10 17:38:27,107 DEBUG RFM2Pi 150 Timestamp : 1678469907.098667
2023-03-10 17:38:27,111 DEBUG RFM2Pi 150 From Node : 6
2023-03-10 17:38:27,115 DEBUG RFM2Pi 150 Values : [2, 0, 0, 0, 226.84]
2023-03-10 17:38:27,120 DEBUG RFM2Pi 150 RSSI : -52
2023-03-10 17:38:27,124 DEBUG RFM2Pi 150 Sent to channel(start)’ : ToEmonCMS
2023-03-10 17:38:27,129 DEBUG RFM2Pi 150 Sent to channel(end)’ : ToEmonCMS

But when trying to read data via mqtt I get no output, using command:
mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t 'emonhub/'

Issue seems for me to be in emonhub_interfacer.py line 121. My MQTT interfacer worker has following:
self._settings["subchannels"] is ['ToEmonCMS']
self._sub_channels is {}
So self._sub_channels is empty which causes line 126 not to run
self.add(frame)
This means MQTT interfacer gets no data to then push out to mosquitto

In my emonhub config I have:

[[RFM2Pi]]
pubchannels = ToEmonCMS,
…
[[MQTT]]
subchannels = ToEmonCMS,

I tried using github code for emonhub from branch stable, then also tried branch master. I get the same issue. I’m not sure where I’m going wrong?

Turns out my Emonhub was not running successfully, because emonhub_auto_conf.py line 49 was looking for a hardcoded file named “/opt/openenergymonitor/emonhub/conf/available.conf” which in my installation was not there. Changed it to where my install lives, and emonhub seems okay

PS. emonhub.py line 94 does not work as intended, calling sys.exit from here does not cause the main pid to exit. Is it waiting for interfacer threads to join maybe? I don’t know, but upon the an exception on line 92, emonhub stops running BUT interfacer threads continue to run.

1 Like

I suggest you raise a couple of issues in GitHub.

Did you use the installer, or just git clone?

Will make issue on github tomorrow for it, thanks.

I downloaded the zip from github and ran the installer script to install in both cases that I tried (master and stable branches)

1 Like

Just installing emonhub?

Yes correct, just installing emonhub. Is that not how it has to be done?

It should work as standalone, but rarely is so this is good feedback, thanks.

It might need pb66’s original version for it to work as stand-alone, rather than the OEM version?

Hi, it does work after I change that filename hardcode to where that file sits on my install. I’m not sure where the install script puts that file and why the hardcode doesn’t look for it where the script puts it. I’ll make a github issue for it.

My reason for running standalone, is that I will be keeping data local only, and not using emoncms locally either. I will be using emonhub and mqtt to push data into rrdtool using something similar to this:

1 Like

Turns out there is a github issue already for it:

1 Like

No, it should work.