ValueError: invalid literal for int() with base 10: '#'

I have built a new Emoncms system using a RPi 2B with the emonSD-10Nov22 image and using a LeChacal RPICT3V1 board to collect readings from 3 CTs around our solar installation.
I configured Emonhub based on information provided by LeChacal and it basically appears to be working as expected. However, the message above appears after 5 successfully received/processed packets and the SerialDirect thread restarts - as a result the ‘errored’ packet is lost.
I appreciate that this is similar to a recent topic, but I think it is somewhat different.
I’ve attached an excerpt from the log showing what’s happening and would appreciate any advice.
emonhub_log.txt (8.6 KB)

Thanks, Martin

error text

2023-02-14 17:25:17,535 WARNING  SerialDirect Exception caught in SerialDirect thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 31, in wrapper
    return func(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 103, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubSerialInterfacer.py", line 95, in read
    c.nodeid = int(f[0])
ValueError: invalid literal for int() with base 10: '#'

Can you rule out the serial is actually sending a # as that is what the error seems to think has been sent.

Try stopping emonhub and see what is being sent by the serial input.

Oops, I really should have checked that first - I’ll take a look in the morning.
Thanks Brian.

1 Like

It seems the CT board was being reset periodically from the Pi causing it to send spurious data.
The 1-wire interface is enabled in the emonSD build; I’ve now disabled it and all is well.
(The guys at LeChacal pointed me to the relevant section of their FAQ to confirm and resolve this).

Apologies for this and thanks again; I can now get on with configuring the logging I am looking for.

1 Like

Try using the OEM interfacer, it may deal with bad strings better.

I’d also enable JSON format for the MQTT data. Too many individual topics can cause issues for emoncms. It looks the same at the other end (you then get the same time for all the items of data).

Thanks Brian, I’ll take a look at these options.