Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request and decode warning/alarms (0x44) frame #6

Open
syssi opened this issue Jun 19, 2022 · 8 comments
Open

Request and decode warning/alarms (0x44) frame #6

syssi opened this issue Jun 19, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@syssi
Copy link
Owner

syssi commented Jun 19, 2022

>>> "~20004644E00200FD35\r"
<<< "~20004600A06000010F000000000000000000000000000000060000000000000000140000000000000300000200000000000000000002EB74\r"
@syssi syssi changed the title Request and decode telesignalization frame Request and decode telecommand (0x44) frame Jun 19, 2022
@syssi syssi changed the title Request and decode telecommand (0x44) frame Request and decode warning/alarms (0x44) frame Jun 20, 2022
@syssi syssi added the enhancement New feature or request label Jun 20, 2022
@syssi syssi mentioned this issue Jun 20, 2022
@syssi
Copy link
Owner Author

syssi commented Aug 16, 2022

~2000
46
00
A0   LENID
60   LEN 96
00   1....2
01   3....4   1
0F   5....6   15 cells
00   7....8   Voltage 1
00   9...10   Voltage 2   
00   11..12   Voltage 3
00   13..14   Voltage 4
00   15..16   Voltage 5
00   17..18   Voltage 6
00   19..20   Voltage 7
00   21..22   Voltage 8
00   23..24   Voltage 9
00   25..26   Voltage 10
00   27..28   Voltage 11
00   29..30   Voltage 12
00   31..32   Voltage 13
00   33..34   Voltage 14
00   35..36   Voltage 15
06   37..38   6 temperatures
00   39..40   Temperature 1
00   41..42   Temperature 2
00   43..44   Temperature 3
00   45..46   Temperature 4
00   47..48   Temperature 5
00   49..50   Temperature 6
00   51..52   Charge current?
00   53..54   Pack voltage?
14   55..56   Discharge current?
00   57..58   Status 1?
00   59..60   Status 2?
00   61..62   Status 3?
00   63..64   Status 4?
00   65..66   Status 5?
00   67..68
03   69..70
00   71..72
00   73..74
02   75..76
00   77..78
00   79..80
00   81..82  Unused 1
00   83..84  Unused 2
00   85..86  Unused 3
00   87..88  Unused 4
00   89..90  Unused 5
00   91..92  Unused 6
00   93..94  Unused 7
02   95..96  Unused 8
EB74

@syssi
Copy link
Owner Author

syssi commented Aug 16, 2022

@chmutoff
Copy link

Hi! I managed to decode the alarms, but I can't send two messages to modbus. I've tried to send 2 commands in the update method in seplos_bms.cpp but this seems to break down the first command as i get no data in the response. Could you advice how to process two commands? I guess the code need to be changed to send one command, wait for response, process it and then send a second command and process it.

@syssi
Copy link
Owner Author

syssi commented Aug 22, 2023

Could you share some more details? In best case some could. So it's easier for me to provide a good solution.

@chmutoff
Copy link

Yes, what i'm trying to do is to send 0x42 packet and then 0x44. In the file seplos_bms.cpp i've tried the following:

void SeplosBms::update() { this->send(0x42, this->pack_); this->send(0x44, this->pack_); }

After that, i'm getting the following response from the bms:
[10:43:04][W][seplos_bms:021]: Unhandled data received (data_len: 0x00): 20.00.46.03.00.00 (6)
This looks like the BMS received one single malformed packet.

I think that the update method should be something like:

void SeplosBms::update() {
   this->send(0x42, this->pack_); 
   this>read(); // Get the response and process it
   this->send(0x44, this->pack_); 
   this->read(); // Get the response and process it
}

@syssi
Copy link
Owner Author

syssi commented Aug 22, 2023

Please add a delay between the two calls just for poking around:

#include "esphome/core/hal.h"

this->send(0x42, this->pack_); 
delay(150);  // NOLINT
this->send(0x44, this->pack_);

All responses will be reported as the mentioned warning because there is no decoder available at the moment for this kind of response.

[10:43:04][W][seplos_bms:021]: Unhandled data received (data_len: 0x00): 20.00.46.03.00.00 (6)

@chmutoff
Copy link

The delay option is working! Right now the differentiation between telemetry and non telemetry frames is done by this condition

data.size() >= 44 && data[8] >= 8 && data[8] <= 16

Which is basically looking at size of the response and the number of cells, but the telecommand frames also have this data, so the on_telemetry_data_ method is triggered by both frames. There is no identification of the response frame. All the frames have the same header, except the lengh field, but that is not very precise to differentiate between frame types. For now, I think that reading and processing the response after sending it is the best approach.

@syssi
Copy link
Owner Author

syssi commented Aug 22, 2023

For now, I think that reading and processing the response after sending it is the best approach.

Yes. The implementation must be improved on the long run here. We have to remember the last transmitted request and expect the dedicated response to avoid guessing the frame type by length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants