emonHub starts ok but then then interfacers do ... nothing

Hi,

I have been using a very old (5 years or so) version of emonHub, which still runs and sends data from my smart meter to emonCMS.

Now I wanted to build a second one on another RPi to monitor my SMA Inverter by using the SMA Interfacer. I have followed the installation guidelines for emonpi, which went ok. I put in the correct bluetooth address in the config file. The hub finds the config file, starts properly and creates the interfacers (SMASolar, but then nothing happens at all. Nothing in the log after the interfacers started… what could I be doing wrong? I suspect it has to do with the config file. I paste the config file here below. I am not using any hardware other than the RPi. Advice is very much appreciated!

[interfacers]
### This interfacer manages the SMA module

[[SMASolar]]
    Type = EmonHubSMASolarInterfacer
    [[[init_settings]]]
        inverteraddress= 00:80:25:A4:B9:45
        inverterpincode = 0000
        timeinverval = 5
        nodeid = 29
        packettrace = 0
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,

[[MQTT]]
    Type = EmonHubMqttInterfacer
    [[[init_settings]]]
        mqtt_host = 127.0.0.1
        mqtt_port = 1883
        mqtt_user = emonpi
        mqtt_passwd = emonpimqtt2016

    [[[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/

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
#        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey = MYAPIKEY
        senddata = 1                    # Enable sending data to Emoncms.org
        sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 30                # Bulk send interval to Emoncms.org in seconds

Hello @franknfurther, the SMA interfacer was developed by Stuart Pittaway, would you mind creating an issue on emonhub github here Issues · openenergymonitor/emonhub · GitHub and mentioning @stuartpittaway who may then see you message and be able to help?

timeinverval = 5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf

That line doesn’t look right to me.

Hi Paul, you are right. But this error only happened when I copied the file onto the community site. Its not included in the config file I used. I have corrected the post now.

Hi Trystan, will do but I first want to check if my config file and general setup are ok. Because I am not clear how the subchannels and pubchannels are supposed to be set up i this case where there is only the SMA and EmonCMS interfacers. And do I need the nodes section? I left it out.

Is there a way to track what the interfacers are doing if they are not doing anything?

Hello @franknfurther, the pub and sub channels look fine.

You could try setting packettrace = 1 that enables one line of logging here: emonhub/EmonHubSMASolarInterfacer.py at emon-pi · openenergymonitor/emonhub · GitHub

Hi @franknfurther

Have you enabled bluetooth on the Rasp PI ?

There is also a rogue comma after the “pubchannels = ToEmonCMS,” may be worth removing.

Can you provide the output of the emonhub logs to see any errors etc?

I also needed to run these commands

sudo aptitude install bluez python-bluetooth
sudo service bluetooth start
sudo service bluetooth status
sudo hciconfig hci0 up
hcitool scan

After this, you should see the bluetooth address of your SMA inverter show up like this
00:80:25:19:58:0C SMA004d SN: 2001781110 SN2001781110

Hi Stuart, this is embarrassing to say but I simply forgot to install the bluetooth the second time round. The first time I did install BT but then the SD card became corrupt, so I had to do everything from scratch again. And the second time I apparently forgot to install the bluetooth part. Sorry for the commotion.

In my defence though … I would propose that the SMASolarInterfacer gives out an error or warning if the bluetooth module is not installed.

try:
    import bluetooth
    bluetooth_found = True
except ImportError:ater on 
    bluetooth_found = False

The import section of the interfacer does catch the error, but then seems to do nothing with the bluetooth_found flag later on other than returning a false in the read method.

#Override base read code from emonhub_interfacer
def read(self):
    """Read data from inverter and process"""
    if not bluetooth_found: return False

Anyway, its working beautifully now. Thanks!

2 Likes

Opening an issue / PR is the bast way to give something back :smile:

2 Likes

I like the easy fixes :slight_smile:

As @borpin mentions, feel free to submit changes to the code through GITHUB (its not difficult to do!)

I would love to contribute and will see if I can be of use in this case, however, my programming experience is rather limited.

One more question though: on the config website it says I don’ t have to edit the nodes section (node 29). However, if I did create a node section with Node 29, could I pass the variable names in this way so they get automatically registered in emonCMS?

There is also a rogue comma after the “pubchannels = ToEmonCMS,” may be worth removing.

I did, and it stopped working. I put it back and now it works again.