ASHP with UFH advice sought

Yes. just define 2 different interfacer configs in the emonhub.config file.

Agreed

It is python, nothing to complie, you just change the code locally.

The code is located in the folders under /opt/openenergymonitor/emonhub

You need to restart the emonhub service if you make changes.

Thanks Brian, I eventually realised that I could do it myself by simply editing the file. So I embarked on creating two different interfacers… and killed my emonhub… it now refuses to restart… which is far from helpful as I can’t see what is going on, zero log information being produced :man_facepalming:

I had to get SSH working, and work out commands to copy and change the *interfacer.py file… so I guess something went wrong here or in my tweaking of the config file… I commented all my changes out to try to get back to where I was but no good. Anyway too tired to fix now, will sleep on it. :sleeping:

Is there a way to see why emonhub can’t start?

Note my SSH password is: emonpi2016 (unlike some posts suggest)

Run a second SSH window with sudo journalctl -f -u emonhub. because it may be a python error, that is where you will see the python errors not in the log file of the application.

You can easily restore the emonhub folder back to where it was using git.

Thanks Brian, just the command I needed. It really doesn’t like me adding in a new Interfacer file. I’m not sure why. If I take it out everything is fine, put it in and I get this:

Feb 11 15:41:58 emonpi emonhub[5084]: Traceback (most recent call last):
Feb 11 15:41:58 emonpi emonhub[5084]:   File "/usr/local/bin/emonhub/emonhub.py", line 40, in <module>
Feb 11 15:41:58 emonpi emonhub[5084]:     setattr(ehi, name, getattr(getattr(namespace, name), name))
Feb 11 15:41:58 emonpi emonhub[5084]: AttributeError: module '__main__' has no attribute 'EmonModbusTcpInputRegInterfacer'
Feb 11 15:41:58 emonpi systemd[1]: emonhub.service: Main process exited, code=exited, status=1/FAILURE
Feb 11 15:41:58 emonpi systemd[1]: emonhub.service: Failed with result 'exit-code'.
Feb 11 15:42:03 emonpi systemd[1]: emonhub.service: Service RestartSec=5s expired, scheduling restart.
Feb 11 15:42:03 emonpi systemd[1]: emonhub.service: Scheduled restart job, restart counter is at 145.
Feb 11 15:42:03 emonpi systemd[1]: Stopped emonHub data multiplexer.
Feb 11 15:42:03 emonpi systemd[1]: Starting emonHub data multiplexer...
Feb 11 15:42:03 emonpi systemd[1]: Started emonHub data multiplexer.

All I have done to create the new interfacer file is to copy EmonModbusTcpInterfacer.py and change:

  • Title to EmonModbusTcpInputRegInterfacer.py
  • Class name to EmonModbusTcpInputRegInterfacer
  • The read function to use Input Registers
  • And some comments

So I’m not sure if it the existence of another file or if there is something inside it that it doesn’t like… :thinking:

You need to add it here

Just to note, if emonhub gets updated, you won’t get the update as you have changes in the directory.

That fixed it! Thank you :grin:

Now I have no errors reported anywhere, yay!
But alas no new input signals appearing under Inputs either.

Emonhub is running happily enough, but it’s log is just absent of any reference to the new Interfacer. Time to make tea and mull it over again. I wonder if you can have two Modbus TCP connections to the same device? Is it thinking “oh, I’ve already done this” and just skips on…

Yes it would definitely be best if the pros built this extra functionality into the next update and I could return to a standard updateable configuration.

I’ve got it all working now. It just needed a restart to get the second Modbus TCP kicked into action. :grinning: Happy days.
Thank you for all your help Brian, very much appreciated!

1 Like

@glyn.hudson @TrystanLea - could we look at the best solution for this for the Modbus Interfacer.

Either it needs 2 interfacers as @Matthew_Lee has done, or an additional parameter to define the type of register, and the routines to read both (which is probably the better solution).