Victron to ESP using SerialProxy plugin

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Victron to ESP using SerialProxy plugin

#1 Post by Affinite » 12 Oct 2024, 13:40

Has anyone managed to get data from a Victron SmartShunt or MPPT controller into ESPEASY ?
I have been trying to get data from my Victron SmartShunt for a few days but the received data stream has lots of errors and dropped bytes.
Ive tried using the SerialProxy plugin and example rules and settings exactly as per the plugin documentation but I cant get it to work.

I've also tried the SerialServer plugin as a way of monitoring the whole data stream and the resulting log shows lots of missing data:

Code: Select all

26325: EVENT: !Serial#:AA40100FFA7
26685: EVENT: !Serial#:A65EC0025C36F7F3BA4D98CF18BFFDD4E68B
26703: EVENT: !Serial#40A14
28843: EVENT: !Serial#CE 0
28846: EVENT: !Serial#SOC 1000
28846: EVENT: !Serial#TTG -1
28847: EVENT: !Serial#Alarm OFF
28847: EVENT: !Serial#AR
28863: EVENT: !Serial# 0
28863: EVENT: !Serial#BMV SmartShunt 500A/50mV
28864: EVENT: !Serial#FW 0416^
28882: EVENT: !Serial#MON 0
28883: EVENT: !Serial#Checksum D
30356: EVENT: !Serial#H10 3
30357: EVENT: !Serial#H
30374: EVENT: !Serial#11 0
30376: EVENT: !Serial#H12 0
30377: EVENT: !Serial#H15 -13
30377: EVENT: !Serial#H16 14645
30378: EVENT: !Serial#H17 1
30394: EVENT: !Serial#22
30396: EVENT: !Serial#H18 158
30396: EVENT: !Serial#Checksum �
31846: EVENT: !Serial#CE 0
31847: EVENT: !Serial#SOC 1000^
31864: EVENT: !Serial#TTG -1
31864: EVENT: !Serial#Alarm OFF
31865: EVENT: !Serial#AR 0
31865: EVENT: !Serial#BMV SmartShu
31886: EVENT: !Serial#nt 500A/50mV
31887: EVENT: !Serial#FW 0416
31887: EVENT: !Serial#MON 0
31888: EVENT: !Serial#Checksum C
32868: EVENT: !Serial#TTG -1
32868: EVENT: !Serial#Alarm OFF
32869: EVENT: !Serial#AR 0
32869: EVENT: !Serial#BMV SmartS
32887: EVENT: !Serial#hunt 500A/50mV
32888: EVENT: !Serial#FW 0416
32888: EVENT: !Serial#MON 0
32889: EVENT: !Serial#Checks
32906: EVENT: !Serial#um D
33328: EVENT: !Serial#H1 -16
33523: EVENT: !Serial#H8 14837
33523: EVENT: !Serial#H9 0
33524: EVENT: !Serial#H10 3
33524: EVENT: !Serial#H11 0
33525: EVENT: !Serial#H12 0
33525: EVENT: !Serial#H15 -13
33526: EVENT: !Serial#H16 14645
33526: EVENT: !Serial#H17 122
33527: EVENT: !Serial#H18 158
33527: EVENT: !Serial#Checksum �
33971: EVENT: !Serial#P 0
33972: EVENT: !Serial#CE 0
33972: EVENT: !Serial#SOC 1000
33973: EVENT: !Serial#TTG -1
33973: EVENT: !Serial#Alarm OFF
33974: EVENT: !Serial#AR 0
33974: EVENT: !Serial#BMV SmartShunt 500A/50mV
33975: EVENT: !Serial#FW 0416
33975: EVENT: !Serial#MON 0
33976: EVENT: !Serial#Checksum D
34340: EVENT: !Serial#H1 -16606
34341: EVENT: !Serial#H2 0
34341: EVENT: !Serial#H3 0
34360: EVENT: !Serial#H4 0
34361: EVENT: !Serial#H5 0
34361: EVENT: !Serial#H6 -96454
34362: EVENT: !Serial#H7 12272
34362: EVENT: !Serial#H8 1
34384: EVENT: !Serial#4837
34528: EVENT: !Serial#H9 0
34529: EVENT: !Serial#H10 3
34529: EVENT: !Serial#H11 0
34530: EVENT: !Serial#H12 0
34530: EVENT: !Serial#H15 -13
34531: EVENT: !Serial#H16 14645
34531: EVENT: !Serial#H17 122
34531: EVENT: !Serial#H18 158
34532: EVENT: !Serial#Checksum �
34866: EVENT: !Serial#SOC 1000
34867: EVENT: !Serial#TTG -1
34867: EVENT: !Serial#Alarm O
34885: EVENT: !Serial#FF
34886: EVENT: !Serial#AR 0
34887: EVENT: !Serial#BMV SmartShunt 500A/50mV
34887: EVENT: !Serial#FW 
34906: EVENT: !Serial#0416
34907: EVENT: !Serial#MON 0
34908: EVENT: !Serial#Checksum B
36379: EVENT: !Serial#H10 
36397: EVENT: !Serial#3
36398: EVENT: !Serial#H11 0
36399: EVENT: !Serial#H12 0
36399: EVENT: !Serial#H15 -13
36400: EVENT: !Serial#H16 14645
36400: EVENT: !Serial#H1
36417: EVENT: !Serial#7 122
36422: EVENT: !Serial#H18 158
36422: EVENT: !Serial#Checksum �
37873: EVENT: !Serial#CE 0
37874: EVENT: !Serial#SOC 1000
37874: EVENT: !Serial#TT
37890: EVENT: !Serial#G -1
37891: EVENT: !Serial#Alarm ON
37892: EVENT: !Serial#AR 8
37892: EVENT: !Serial#BMV SmartShunt 5
37911: EVENT: !Serial#00A/50mV
37912: EVENT: !Serial#FW 0416
37913: EVENT: !Serial#MON 0
38085: EVENT: !Serial#Checksum y
39387: EVENT: !Serial#H6 -96454
39388: EVENT: !Serial#H7 12272
39388: EVENT: !Serial#H8 14837
39389: EVENT: !Serial#H9 0
39409: EVENT: !Serial#H10 3
39410: EVENT: !Serial#H11 0
39410: EVENT: !Serial#H12 0
39411: EVENT: !Serial#H15 -13
39411: EVENT: !Serial#H16 14645
39429: EVENT: !Serial#H17 122
39576: EVENT: !Serial#H18 158
39578: EVENT: !Serial#Checksum �
39886: EVENT: !Serial#CE 0
39887: EVENT: !Serial#SOC 1000
39888: EVENT: !Serial#TTG -1
39888: EVENT: !Serial#Alarm ON
39906: EVENT: !Serial#AR 8
39907: EVENT: !Serial#BMV SmartShunt 500A/50mV
39908: EVENT: !Serial#FW 04
Because the Victron serial output is 3.3V I don't believe I need a level shifter and I have connected the shunts serial port directly to the ESPs RxD (GPIO3) & GND pins.

I have tested that the output from the Victron Shunt is good by connecting it to a PC using a TTL-USB converter and also using an "official" VE.Direct USB cable.
In both cases I get a clean data stream (using PuTTY) to monitor it like this.

Code: Select all

H1      -16606
H2      0
H3      0
H4      0
H5      0
H6      -96454
H7      12272
H8      14837
H9      0
H10     3
H11     0
H12     0
H15     -13
H16     14645
H17     122
H18     158
Checksum        ▒
PID     0xA389
V       12840
VS      -7
I       0
P       0
CE      0
SOC     1000
TTG     -1
Alarm   OFF
AR      0
BMV     SmartShunt 500A/50mV
FW      0416
MON     0
Checksum        E
H1      -16606
H2      0
H3      0
H4      0
H5      0
H6      -96454
H7      12272
H8      14837
H9      0
H10     3
H11     0
H12     0
H15     -13
H16     14645
H17     122
H18     158
Checksum        ▒
PID     0xA389
V       12840
VS      -8
I       0
P       0
CE      0
SOC     1000
TTG     -1
Alarm   OFF
AR      0
BMV     SmartShunt 500A/50mV
FW      0416
MON     0
Checksum        D
H1      -16606
H2      0
H3      0
H4      0
H5      0
H6      -96454
H7      12272
H8      14837
H9      0
H10     3
H11     0
H12     0
H15     -13
H16     14645
H17     122
H18     158
Checksum        ▒
PID     0xA389
V       12841
VS      -8
I       0
P       0
CE      0
SOC     1000
TTG     -1
Alarm   OFF
AR      0
BMV     SmartShunt 500A/50mV
I'm running Build: ESP_Easy_mega_20240822_collection_C_ESP8266_4M1M Aug 22 2024 on a Wemos D1Mini
I cant tell if I have a hardware interface problem or a config problem with the plugin so any ideas or suggestions would be welcomed.

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#2 Post by Ath » 12 Oct 2024, 17:05

- Have you turned OFF the Serial log on the Tools/Advanced page? ("Enable Serial Port Console" unchecked)
- You can also try to use Serial1 with Victron TX connected to GPIO 2, that way you can still have the serial log enabled, if desired

What is the serial baud rate in use there? (The same code can handle the 115200 baud ~1kbyte P1-data packets once a second from a DSM-5 meter using an ESP01S, so serial speed isn't expected to be the issue. P020 and P044 code has been merged somewhat recently).
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#3 Post by TD-er » 12 Oct 2024, 17:29

Also do not use SoftwareSerial for rather 'chatty' devices. (you didn't mention you did, but just to be sure it is not missed as a possible cause)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#4 Post by Affinite » 13 Oct 2024, 13:23

Ath,TD-er
Thanks for responses and suggestions.
I have tried:
turned off serial logging/port console
selected an alternate serial pin (GPIO-13) for the SerialServer (GPIO-2 did not work for serial in)
BTW - serial running at 19200 baud
Tried running on alternative device (ESP32S) - same loss of data
Connected USB-TTL device in parallel with ESP/GPIO and observed RAW data stream which is fine.

I cant think of a better way of observing the raw serial data received by the ESP other than the Serial Server plugin and the Event log but if you have any further suggestions Id be grateful.

Thanks

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#5 Post by TD-er » 13 Oct 2024, 13:58

Just to be sure we're talking about the same here...
Do you experience missing data or corrupted data?

The existing plugins may not be suitable for near continuous streams of data as they both try to process the received data and while processing may not fetch new data from the serial FIFO.

I think it may be better to create a new plugin for the Victron as the events you posted are probably too much to process for ESPEasy as events (thus starting rules parsing)
In your posted logs I see roughly 10 events in bursts every 300-ish msec.
This is too much to handle for rules parsing.

Do you have a description of the protocol?
And does Victron use this protocol also for other devices they sell? If so, then it makes sense to have some kind of universal Victron plugin for all of their products.

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#6 Post by Ath » 13 Oct 2024, 14:06

Ah, what setting did you enter for the RX Receive Timeout? Set it to at least 10 msec, so it will accept all input from the serial port, as 0 will continue immediately on the smallest delay, even if some more data is coming in.
/Ton (PayPal.me)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#7 Post by Affinite » 13 Oct 2024, 15:52

Hi Guys

Loss of data is the problem (compare my raw data capture in post #1 with what I captured in the ESPEASY log)
In the documentation for P087 there is an example at the end that is obviously taken from a Victron data stream so I assumed that the plugin P087 and P020 had been tested with this type of serial data source, but if they aren't designed to handle a continuous data stream then I can understand why Im loosing data.

BTW - I tried increasing the RX timeout and data loss did reduce however the ESP Event Log stopped after about 25 seconds - buffer full/overrun ?

The Victron VE.Direct protocol is common across their product range and the protocol is opensource so if someone is able to write a plugin I think it would be a great addition to ESPEASY for monitoring home Solar installations. (I've tried to attach a copy of the protocol specification as requested but the board wont allow me to so here is link to the VE.Direct protocol pdf instead https://www.victronenergy.com/support-a ... nformation

I would love to volunteer to write a plugin but I simply dont know how but would certainly be first in the queue for testing duty.
Thanks again for looking at this

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#8 Post by Ath » 13 Oct 2024, 16:52

Affinite wrote: 13 Oct 2024, 15:52 BTW - I tried increasing the RX timeout and data loss did reduce however the ESP Event Log stopped after about 25 seconds - buffer full/overrun ?
You can't (reliably) have the serial log active and also receive data via Serial0. That'll block at some time, as you've experienced.
Don't understand why it won't work on Serial1, do you have the WiFi Status LED enabled on the Hardware page? That should then be disabled for Serial1 to work.
As said, it's working for me on an ESP8266 at 115200 baud with 1k data bursts every second, but no rules handling the data.
NB: You can also disable the Serial Console log, and watch the logging from the Tools/Log page (though that also puts some extra load on the ESP while fetching these logs).
Affinite wrote: 13 Oct 2024, 15:52 The Victron VE.Direct protocol is common across their product range and the protocol is opensource so if someone is able to write a plugin I think it would be a great addition to ESPEASY for monitoring home Solar installations. (I've tried to attach a copy of the protocol specification as requested but the board wont allow me to so here is link to the VE.Direct protocol pdf instead https://www.victronenergy.com/support-a ... nformation
The protocol doesn't seem that complicated indeed, will have a look at it and see if a plugin is needed to properly handle this.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#9 Post by Ath » 13 Oct 2024, 17:26

I've reserved Plugin ID P176 for a Communication - Victron VE.Direct plugin. (Name may change during development).
/Ton (PayPal.me)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#10 Post by Affinite » 13 Oct 2024, 17:39

You guys are stars :D

Just ran another test using P020 on an ESP32S
Set Serial port to HW on GPIO16
Set Rxd timeout to 50mS and buffer to 2048 bytes
Received data with no losses for 3 minutes before event log hung

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#11 Post by TD-er » 13 Oct 2024, 17:52

Ton and I had a short discussion about how to handle this.
The idea is to make it absolutely as simple as possible at first:

- Receive data from serial and split per newline into a 'sentence'
- Split each 'sentence' into a key and value (type 'String')
- Check checksum
- When checksum is valid, copy each key/value into a std::map<String, String>
- When value has changed, generate an event with key/value pair
- Let user decide which 'key' is needed as one of 4 in the task by naming the taskvalue exactly as the requested 'key'
- Allow all other 'key' types be used as 'virtual' taskvalues. So [<taskname>#H2] can be used like any other task value, even though it is not set as one of the 4 taskvalues.

Since it is all stored as String in memory, you can even use the string-types when printing to a display for example (or in email or whenever you like to use it)

Next steps will be to use commands to set/clear watching for a 'key' to limit the number of events for those you're not interested in.

I think this will make it all a lot more manageble for the ESP with its limited resources.

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#12 Post by Affinite » 13 Oct 2024, 19:06

:shock: OK I think I understand ...
Standing by

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#13 Post by Affinite » 14 Oct 2024, 10:37

Ath, TD=er
Beer/Coffee vouchers sent via PayPal.
Thanks for your support

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#14 Post by Ath » 14 Oct 2024, 11:05

Thanks! 8-)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#15 Post by TD-er » 14 Oct 2024, 11:21

Yep thanks, that's quite a lot of coffee :)

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#16 Post by tomzis » 14 Oct 2024, 19:24

Hello, I was also looking to read the Victron MPPT with ESPEASY.
At the same time, I wanted to record the charge level of my Pylontech battery.

I read the serial port (MPPT) with the CUL Reader ( collection_D ) plugin and the HW Serial 1 - 19200 Baud.
For level shifter I only use a 2KOhm Resistor serial, no problems.
For the Pylontech, I read the RS485 output via SerialServer and Port HW Serial 0 - 9600 baud.
Here is my solution: Create a device - Communication - CUL Reader-, I called it VE_Direct.
Then create dummies for assignment. The rules for Victron, for example:

on VE_Direct#Value=`PPV* do // Energy Solar
Taskvalueset,1,1,{substring:3:7:%eventvalue%}
Endon

For Pylontech I created a second device -> Communication - Serial Server-

Rules for Pylontech request
On A1#Analog Do // Analog device as my timer
serialsend,~20024642E00202FD33%CR% // Akku
endon
Pylontech answer:
On !serial#0* do
Taskvalueset,3,1,{strtol:16:{substring:12:17:%eventvalue%}}/740 // capacity battery
endon
Perhaps my solution is helpful.
Thomas

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#17 Post by Affinite » 14 Oct 2024, 20:44

Thanks thats really interesting - How did you find that plugin ?

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#18 Post by tomzis » 14 Oct 2024, 21:48

Hi,
i downloaded the espeasy mega releases for esp32 from github.
https://github.com/letscontrolit/ESPEasy/releases
Then I tried all collection from A to F.
So I found that CUL Reader plugin is the best to decode serial info from Victron MPPT.
_VE.png
_VE.png (85.08 KiB) Viewed 5512 times
_Devices.png
_Devices.png (47.43 KiB) Viewed 5512 times
Communication.png
Communication.png (25.11 KiB) Viewed 5512 times
For more information, you can send me a message.

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#19 Post by TD-er » 14 Oct 2024, 22:06

Hmm funny that the CUL reader is used for this as that's a plugin written for interacting with a very specific setup using an ATmega processor running the CULfw to decode radio packets.

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#20 Post by Affinite » 15 Oct 2024, 13:07

tomzis,
Wow, I admire your persistence and effort to go through the whole library to find a plugin that works for you.
I will try your suggestion this afternoon and report if it works for me too but it would still be good to have a plugin specifically for Victron devices.
Also, I would not want to see ESPHome as the only ESP firmware to support Victron devices :?

Thanks again for the response and detailed explanation

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#21 Post by Affinite » 15 Oct 2024, 19:30

Yes that CUL plugin does seem to work.
The plugin is now in the "Max" build which wouldn't load OTA on my ESP32S so I pulled up a Collection_D in a previous release and found it.
Its strange that not all data fields appear in the event log (eg H1..18) but the important ones (to me) do ie V,VS,I,SOC.
Edit: Just realised the "I" field isn't being received ??
I just need to figure out how to distinguish between incoming "V" and "VS" data fields in rules.
Anyway, a good option to experiment with while the official Victron plugin is under development. (Hopefully to include support for ESP8266)
Thanks once again for the suggestion.

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#22 Post by Ath » 15 Oct 2024, 21:26

Affinite wrote: 15 Oct 2024, 19:30 Yes that CUL plugin does seem to work.
The plugin is now in the "Max" build which wouldn't load OTA on my ESP32S so I pulled up a Collection_D in a previous release and found it.
The MAX build will only work on an ESP32/ESP32-S3/ESP32-C6 with 16 MB Flash (or a few 8 MB models ESP32-S3 or ESP32-C6), you'll have to pick the correct build for that, preferably using LittleFS (Latest IDF 5.3/Arduino 3.1 frameworks)
Affinite wrote: 15 Oct 2024, 19:30 Its strange that not all data fields appear in the event log (eg H1..18) but the important ones (to me) do ie V,VS,I,SOC.
Edit: Just realised the "I" field isn't being received ??
Hmm, maybe the size of the rules slows processing and it misses some lines of data... and there's no setting for a receive buffer-size or similar :?
Affinite wrote: 15 Oct 2024, 19:30 I just need to figure out how to distinguish between incoming "V" and "VS" data fields in rules.
You'll have to check for the VS field before you handle the V field:

Code: Select all

on VE_Direct#Value=`VS* do
// Handle VS value
Endon
on VE_Direct#Value=`V* do
// Handle V value
Endon
Rules parsing stops once a matching rule is found
(my syntax probably isn't exactly correct, copy/adapted it from the post above, but I assume you already have some working code)
Affinite wrote: 15 Oct 2024, 19:30 Anyway, a good option to experiment with while the official Victron plugin is under development. (Hopefully to include support for ESP8266)
Thanks once again for the suggestion.
It won't be available in a standard ESP8266 build, but you'll most likely be able to create a Custom build that can include the plugin. (instructions available here)
/Ton (PayPal.me)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#23 Post by Affinite » 16 Oct 2024, 11:26

Ath
Thx

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#24 Post by Affinite » 16 Oct 2024, 12:39

@tomzis
I am trying to make your suggestion work for me.
I don't understand why but I consistently only see "SOC","TTG","Checksum","V","VS","CE" in the event log (same fields repeat every second) rather than the full package that the Victron Shunt is sending to the serial port.
Which Victron data fields are you reading with the CUL reader?
I assumed that you would want to see Charge Current "I" and perhaps Panel Power "PPV" ?

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#25 Post by tomzis » 16 Oct 2024, 14:28

@Affinite
Her a part of my LOG report.

EVENT: VE_Direct#Value=`V50700`
EVENT: VE_Direct#Value=`I26000`
EVENT: VE_Direct#Value=`VPV125430`
EVENT: VE_Direct#Value=`PPV1345`
EVENT: VE_Direct#Value=`ERR0`
EVENT: VE_Direct#Value=`LOADOFF`
EVENT: VE_Direct#Value=`RelayOFF`
EVENT: VE_Direct#Value=`H19 42559`
EVENT: VE_Direct#Value=`H20 308`
EVENT: VE_Direct#Value=`H21 1994`
EVENT: VE_Direct#Value=`H22 196`
EVENT: VE_Direct#Value=`H23 605
EVENT: VE_Direct#Value=`HSDS99`

I don't miss any information i need
For my solution I could not use serial server because
1.) I use 2 serial ports and I missed the possibility to adress like serialsend0 and serialsend1 or "on !serial0# do" and "on !serial1# do".
2.) Because the response begins with an apostroph, serialserver dont recognize the values
So this solution with CUL is the best and easiest for me.
Perhaps I could help you and other Victron users.

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#26 Post by Affinite » 16 Oct 2024, 15:38

Ok good to know it does work for you. I've just realised that my plugin GUI looks different to your screenshot so I obviously have a different version of the plugin. I'll sort that out first and then see if i start receiving the full data package.
Can you tell me which ESP32 you are using and which build of ESP_Easy ?
Thx

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#27 Post by tomzis » 16 Oct 2024, 16:55

Hi, it´s an ESP32 NodeMCU with build 20230508 - Mega32 Collection D

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#28 Post by tomzis » 16 Oct 2024, 16:57

Ooops, to fast
Aditional, I tried it with ESP32-S2 and ESP32-C3
Both OK

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#29 Post by Ath » 16 Oct 2024, 17:23

Same build configurations like Collection D are the same for different ESP configurations, ESP32, ESP32-S2 etc. But things have changed for newer builds, as Serial Server has had quite an overhaul, earlier this year, and P044 (P1 WiFi Gateway) has been integrated/re-merged into the code (P044 is still available as a separate plugin, but sharing ~95% of the code with P020, as it was once copy/pasted from P020).

For Serial Server, you now have the option of using the Serial port name as the event-name (and optionally include the task number) if you choose the "Event processing" option "Generic", as documented here: https://espeasy.readthedocs.io/en/lates ... #p020-page
/Ton (PayPal.me)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#30 Post by Affinite » 16 Oct 2024, 19:55

tomzis wrote: 16 Oct 2024, 16:55 Hi, it´s an ESP32 NodeMCU with build 20230508 - Mega32 Collection D
@tomzis Thanks, yours is quite an old build (2023) and I am running one from April 2024 so I'm surprised that mine doesn't pass all the Victron fields.
I may just try the same 2023 build as yours tomorrow and see what happens. ;)
@Ath - thanks for the information

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#31 Post by Affinite » 16 Oct 2024, 22:57

tomzis
I loaded the same build as you (Build: ESP_Easy_mega_20230508_collection_D_ESP32_4M316k May 8 2023)
The CUL reader plugin now works just fine and I see all Victron fields :D
Looks like whatever work was done on the plugin after 20230508 unintentionally filters out some of the fields.

Now that its working reasonably well, I'm happy to stick with the 2023 firmware for this project.

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#32 Post by Ath » 16 Oct 2024, 23:33

tomzis wrote: 16 Oct 2024, 14:28 1.) I use 2 serial ports and I missed the possibility to adress like serialsend0 and serialsend1 or "on !serial0# do" and "on !serial1# do".
A solution for that I've posted in message #29, there's a setting for that (now)
tomzis wrote: 16 Oct 2024, 14:28 2.) Because the response begins with an apostroph, serialserver dont recognize the values
The apostrophe is inserted by CUL reader plugin, AFAICS...

I've connected 2 ESP's via serial ports, both using Serial Server, where 1 is sending the data (using SendSerialMix command, that can insert the tab and newline characters via hex 0xNN notation).
Sending this (fixed) data (partial from your example, above):

Code: Select all

  serialsendmix,PID,0x09,0x3078,A389,0x0d0a,V,0x09,12840,0x0d0a,VS,0x09,-7,0x0d0a,I,0x09,0,0x0d0a,P,0x09,0,0x0d0a,CE,0x09,0,0x0d0a
(Have to use 0x3078 to send a string with '0x' prefix, because of how serialsendmix processes data..., using a single line with multiple data-lines to achieve max. send-speed, separated by CR/LF (0x0d0a) as sent by Victron)

The other ESP (ESP32-C6 (160 MHz) with 16M8M MAX build) is receiving, also via Serial Server, where I've set options: (not mentioned: unchecked/default)
Serial Port: HW Serial1
RX GPIO: GPIO-0
Baud Rate: 9600
Event processing: Generic
Use Serial Port as eventname: Checked
Process events without client: Checked
Multiple lines processing: Checked
RX Receive timeout: 20 msec

I am receiving the expected values, and using these rules I can parse the incoming values:

Code: Select all

on !Serial1#VS* do
  LogEntry,'Receiving VS: {substring:12:20:%eventvalue%}'
Endon
on !Serial1#V* do
  LogEntry,'Receiving V: {substring:11:20:%eventvalue%}'
Endon
Log output:

Code: Select all

00:01:33.034 : (160064) Info   : EVENT: !serial1#PID    0xA389
00:01:33.093 : (159680) Info   : EVENT: !serial1#V      12840
00:01:33.118 : (159404) Info   : ACT  : LogEntry,'Receiving V: 12840'
00:01:33.123 : (159320) Info   : Receiving V: 12840
00:01:33.158 : (159604) Info   : EVENT: !serial1#VS     -7
00:01:33.181 : (159452) Info   : ACT  : LogEntry,'Receiving VS: -7'
00:01:33.186 : (159380) Info   : Receiving VS: -7
00:01:33.216 : (159644) Info   : EVENT: !serial1#I      0
00:01:33.268 : (159688) Info   : EVENT: !serial1#P      0
00:01:33.320 : (159732) Info   : EVENT: !serial1#CE     0
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9360
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Victron to ESP using SerialProxy plugin

#33 Post by TD-er » 17 Oct 2024, 07:44

Still the main problem of overfeeding the event-queue isn't solved and as mentioned the CUL reader isn't written with this in mind as it is written to be used with an ATmega running the CULfw with a cc1101 RF module attached to it.
So I think there is still a use case for the proposed plugin to handle several short messages in a burst every 300-ish msec.

tomzis
New user
Posts: 6
Joined: 14 Oct 2024, 17:19
Location: Bavaria

Re: Victron to ESP using SerialProxy plugin

#34 Post by tomzis » 17 Oct 2024, 08:57

@Affinity,
what luck, I didn't test a newer release. Everything worked.
And once again: never change a running system
@ath
That sounds good.
I'll test it on my next projects.

Many thanks

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#35 Post by Affinite » 17 Oct 2024, 11:28

@tomzis :D

Ath & TD-er Like tomzis, I look forward to testing the new plugin when its released.

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#36 Post by bonti69 » 18 Oct 2024, 13:43

I'm also interested to add one small espeasy board to VE.direct of a Victron mppt controller
Seems like the data is read-only
https://github.com/KinDR007/VictronMPPT-ESPHOME
https://github.com/rin67630/Victron_VE_on_Steroids
https://www.youtube.com/watch?v=D08sjKWBW7o&t=0s

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#37 Post by Affinite » 20 Oct 2024, 11:46

bonti69 wrote: 18 Oct 2024, 13:43 I'm also interested to add one small espeasy board to VE.direct of a Victron mppt controller
Seems like the data is read-only
https://github.com/KinDR007/VictronMPPT-ESPHOME
https://github.com/rin67630/Victron_VE_on_Steroids
https://www.youtube.com/watch?v=D08sjKWBW7o&t=0s
The ESPEASY guys have agreed to put a Victron plugin on the development schedule but the solution we discussed above works just fine as a temporary fix with build
(Build: ESP_Easy_mega_20230508_collection_D_ESP32_4M316k May 8 2023)
Im not sure if the VE.Direct protocol allows for remote configuration but personally, all I want is read access (from my Victron devices to ESPEasy) - I prefer to control/configure the Victron kit using the VictronConnect app.

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#38 Post by Ath » 20 Oct 2024, 14:45

Affinite wrote: 20 Oct 2024, 11:46
Im not sure if the VE.Direct protocol allows for remote configuration but personally, all I want is read access (from my Victron devices to ESPEasy)
According to the documentation, and as suggested before, the VE.Direct protocol is one-way only.
/Ton (PayPal.me)

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#39 Post by bonti69 » 20 Oct 2024, 20:01

Solved with ESPHome. Victron sends burst of data every second. My victron 100/20 has 5V on VE.direct. I used an 10k/22k divider from mppt tx to Rx of an ESP12S board.
Screenshot 2024-10-20 at 20-55-47 Dashboard - ESPHome.png
Screenshot 2024-10-20 at 20-55-47 Dashboard - ESPHome.png (80.55 KiB) Viewed 4451 times
Attachments
Screenshot_20241020-205309_Chrome.jpg
Screenshot_20241020-205309_Chrome.jpg (610.5 KiB) Viewed 4451 times
Screenshot_20241020-205301_Chrome.jpg
Screenshot_20241020-205301_Chrome.jpg (443.66 KiB) Viewed 4451 times

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#40 Post by bonti69 » 20 Oct 2024, 20:08

Screenshot 2024-10-20 at 21-05-38 VictronMPPT.png
Screenshot 2024-10-20 at 21-05-38 VictronMPPT.png (870.2 KiB) Viewed 4449 times

giorgino
Normal user
Posts: 122
Joined: 24 Oct 2022, 21:06

Re: Victron to ESP using SerialProxy plugin

#41 Post by giorgino » 21 Oct 2024, 23:56

I'm playing with something like this from may times, but in a easier way:

on "VICTRON-SIDE" i have an ESP32 reading with this:

Code: Select all

on !Serial* do // Include * to process string values  -- if there is trafic on serial
  Publish,'VICTRON-ve','{substring:8:15:%eventvalue%}'   // public MQTT on topic VICTRON-ve all values from Victron
endon
and I obtain a flow like this:
(...........)
H17 109
H16 144
V 12755
SOC 987
(......etc etc...)
than I collect all data from Home Assistant and manage them with nodered

BUT NOW (and here comes the problems), I want to collect only some data to publish in local on a nextion display.

Is there a way to extract some data, for example SOC ?
Pherahps I can use the "PARSE JSON" in mqqt import of espeasy?

User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#42 Post by Ath » 22 Oct 2024, 07:44

giorgino wrote: 21 Oct 2024, 23:56 BUT NOW (and here comes the problems), I want to collect only some data to publish in local on a nextion display.

Is there a way to extract some data, for example SOC ?
Pherahps I can use the "PARSE JSON" in mqqt import of espeasy?
That's exactly what I've started work on: A plugin that receives all values from the VE.Direct output, so you can use/publish any value you need ;)
Please allow me some time to build and test this :?
/Ton (PayPal.me)

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#43 Post by bonti69 » 22 Oct 2024, 14:51

giorgino wrote: 21 Oct 2024, 23:56 I'm playing with something like this from may times, but in a easier way:

on "VICTRON-SIDE" i have an ESP32 reading with this:

Code: Select all

on !Serial* do // Include * to process string values  -- if there is trafic on serial
  Publish,'VICTRON-ve','{substring:8:15:%eventvalue%}'   // public MQTT on topic VICTRON-ve all values from Victron
endon
and I obtain a flow like this:
(...........)
H17 109
H16 144
V 12755
SOC 987
(......etc etc...)
Hi, can you post a complete burst of data from a victron mppt charger?
On repository from here (https://github.com/KinDR007/VictronMPPT-ESPHOME) it's missing a parameter " panel current" , I'm wonder if the developper forget to read it or the victron does't send at all. In Victron app it is ...
Screenshot_20241022-154931.jpg
Screenshot_20241022-154931.jpg (386.92 KiB) Viewed 4013 times

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#44 Post by bonti69 » 22 Oct 2024, 14:55

I tried to modify the yaml file and sensor.py but no luck...I.m doing something wrong, but I expect to be that string, panel current
Screenshot 2024-10-22 at 15-55-22 VictronMPPT.png
Screenshot 2024-10-22 at 15-55-22 VictronMPPT.png (155.28 KiB) Viewed 4012 times

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#45 Post by bonti69 » 22 Oct 2024, 15:04


User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#46 Post by Ath » 22 Oct 2024, 15:54

bonti69 wrote: 22 Oct 2024, 15:04 Something to read
https://dspace.cvut.cz/bitstream/handle ... 20(10).pdf
Interesting, but unfortunately his GH repo is no longer available :o
/Ton (PayPal.me)

bonti69
Normal user
Posts: 159
Joined: 08 Apr 2021, 12:16
Location: Romania

Re: Victron to ESP using SerialProxy plugin

#47 Post by bonti69 » 24 Oct 2024, 16:38


User avatar
Ath
Normal user
Posts: 4007
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Victron to ESP using SerialProxy plugin

#48 Post by Ath » 25 Oct 2024, 22:44

I've created a pull request in Github #5148 for P176 Communication - Victron VE.Direct

Can you please test using a build from this GH Actions run (only available in ESP32 Energy and MAX builds for now because of size issues on ESP8266 builds, you can create a Custom build for ESP8266 if required)

Any feedback is welcome, either here or in the GH Pull request.
/Ton (PayPal.me)

Affinite
Normal user
Posts: 121
Joined: 03 Apr 2018, 18:46
Location: United Kingdom

Re: Victron to ESP using SerialProxy plugin

#49 Post by Affinite » 26 Oct 2024, 08:29

Ath wrote: 25 Oct 2024, 22:44 I've created a pull request in Github #5148 for P176 Communication - Victron VE.Direct

Can you please test using a build from this GH Actions run (only available in ESP32 Energy and MAX builds for now because of size issues on ESP8266 builds, you can create a Custom build for ESP8266 if required)

Any feedback is welcome, either here or in the GH Pull request.
Ath
Thanks I will try but this is new territory for me :D

giorgino
Normal user
Posts: 122
Joined: 24 Oct 2022, 21:06

Re: Victron to ESP using SerialProxy plugin

#50 Post by giorgino » 26 Oct 2024, 16:31

Ath wrote: 25 Oct 2024, 22:44 I've created a pull request in Github #5148 for P176 Communication - Victron VE.Direct

Can you please test using a build from this GH Actions run (only available in ESP32 Energy and MAX builds for now because of size issues on ESP8266 builds, you can create a Custom build for ESP8266 if required)

Any feedback is welcome, either here or in the GH Pull request.
so you mean that here is a BUILD that I can dowload, update the firmware of my ESP32 and find the way to connect my Victron?

This, I think: Bin-ESP32-energy_ESP32_4M316k-20241025_PR_5148_11525114630

where is this build?
in that build could I find Nextion display available? and GPS?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests