Issue with emoncms VEdirect cable after upgrade

Hello All,

After running emoncms update, I found that my VEdirect was generating an error. this lead to inability of emonhub to read the data from my victron battery monitor.

below is the error generated.

2020-09-24 20:17:08,201 DEBUG VEDirect Starting Serial read
2020-09-24 20:17:08,228 ERROR VEDirect ‘utf-8’ codec can’t decode byte 0xac in position 0: invalid start byte

Can anyone help me check look into this issue,

Wilfred

Hello @wilfrik this is probably resulting from this recent update Merge branch 'vedirect-fixes' of https://github.com/bwduncan/emonhub … · openenergymonitor/emonhub@04dd7a3 · GitHub @bwduncan can you see the solution to this?

@wilfrik if you want to get it working straight away, it might be worth switching to the emonhub stable branch.

It’s possible to do this via SSH if you are running the standard image:

cd /opt/openenergymonitor/emonhub
git checkout stable
sudo service emonhub restart

Often need to do a git pull after the checkout.

cd /opt/openenergymonitor/emonhub
git checkout stable
git pull
sudo service emonhub restart

Thanks a lot for your response.

I did exactly same and found i was already up to date.

see output of the script

cd /opt/openenergymonitor/emonhub
pi@emonpi:/opt/openenergymonitor/emonhub $ git checkout stable
Already on ‘stable’
Your branch is up to date with ‘origin/stable’.
pi@emonpi:/opt/openenergymonitor/emonhub $ git pull
Already up to date.
pi@emonpi:/opt/openenergymonitor/emonhub $

to be sure i still have the correct config, below is my emonhub config

[[VEDirect]]
Type = EmonHubVEDirectInterfacer
[[[init_settings]]]
com_port = /dev/ttyUSB0
com_baud = 19200
toextract = SOC,CE,TTG,V,I,Relay,Alarm,P,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H17,H18,DM,VM,PID,FW # These are the fields we wish to extract
poll_interval = 10 # More fields can be found in datalist.py
[[[runtimesettings]]]
nodeoffset = 27 #make sure this matches with nodename below
pubchannels = ToEmonCMS,
subchannels = ToBMV,
basetopic = emonhub/

[[27]]
nodename = DCSystem
firmware = V1_6_emonTxV3_4_DiscreteSampling
hardware = emonTx_(NodeID_DIP_Switch1:ON)
[[[rx]]]
names = SOC,CE,TTG,V,I,Relay,Alarm,P,H1,H2,H3,H4,H5,H6,H7,H8,H9,H10,H17,H18,DM,VM,PID,FW
datacode = 0
scales = 0.1,0.001,0.01666667,0.001,0.001,1,1,1,0.001,0.001,0.001,1,1,0.001,0.001,0.001,0.0167,1,0.01,0.01,0.1,0.1,1,1
units = %,Ah,H,V,A,S,S,W,Ah,Ah,Ah,S,S,Ah,V,V,s,S,KWh,KWh,%,V,S,S #FirmwareV1.6

Dears,

I tried to also update the encoding scheme of utf-8 under
/opt/openenergymonitor/emonhub/src/interfacers/EmonHubVEDirectInterfacer.py
while self._rx_buf == ‘’:
byte = self._ser.read(1).decode(‘utf-8’)
packet = self.input(byte)
if packet is not None:
self._rx_buf = packet

Thank you all for your support in advance

The code in Master is quite different. You could try that.

cd /opt/openenergymonitor/emonhub
git checkout master
git pull
sudo systemctl restart emonhub.service

The utf-8 should be in double quotes I think "utf-8" but I am not sure if that will help.

Hello Brian,

What did the magic was using “ISO-8859-1” character encoding scheme in place of utf-8. it has been reading data effortlessly since then.

Thanks you so much for your time and support.

Kind regards,

Wilfred

So this line

Is now…

byte = self._ser.read(1).decode("ISO-8859-1")

Correct?