Skip to content

Commit

Permalink
add missing undocumented tags for DCB
Browse files Browse the repository at this point in the history
fixes #26
  • Loading branch information
spali committed Jun 29, 2022
1 parent aa248aa commit ddd0de7
Show file tree
Hide file tree
Showing 4 changed files with 917 additions and 819 deletions.
58 changes: 40 additions & 18 deletions rscp/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,19 @@ const (
EMS_RES_POWERSAVE_ENABLED Tag = 0x01800104
EMS_WEATHER_REGULATED_CHARGE_ENABLED Tag = 0x01000105
EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED Tag = 0x01800105
// undocumented response tag
EMS_WEATHER_FORECAST_MODE Tag = 0x01000106
// undocumented response tag
EMS_RES_WEATHER_FORECAST_MODE Tag = 0x01800106
EMS_REQ_SETTINGS_CHANGE_MARKER Tag = 0x0100008D
EMS_SETTINGS_CHANGE_MARKER Tag = 0x0180008D
EMS_REQ_GET_MANUAL_CHARGE Tag = 0x0100008E
EMS_GET_MANUAL_CHARGE Tag = 0x0180008E
EMS_MANUAL_CHARGE_START_COUNTER Tag = 0x01000150
EMS_MANUAL_CHARGE_ACTIVE Tag = 0x01000151
EMS_MANUAL_CHARGE_ENERGY_COUNTER Tag = 0x01000152
EMS_MANUAL_CHARGE_LASTSTART Tag = 0x01000153
EMS_REQ_START_MANUAL_CHARGE Tag = 0x0100008F
EMS_START_MANUAL_CHARGE Tag = 0x0180008F
EMS_REQ_START_EMERGENCYPOWER_TEST Tag = 0x01000090
EMS_WEATHER_FORECAST_MODE Tag = 0x01000106 // undocumented response tag
EMS_RES_WEATHER_FORECAST_MODE Tag = 0x01800106 // undocumented response tag
EMS_REQ_SETTINGS_CHANGE_MARKER Tag = 0x0100008D
EMS_SETTINGS_CHANGE_MARKER Tag = 0x0180008D
EMS_REQ_GET_MANUAL_CHARGE Tag = 0x0100008E
EMS_GET_MANUAL_CHARGE Tag = 0x0180008E
EMS_MANUAL_CHARGE_START_COUNTER Tag = 0x01000150
EMS_MANUAL_CHARGE_ACTIVE Tag = 0x01000151
EMS_MANUAL_CHARGE_ENERGY_COUNTER Tag = 0x01000152
EMS_MANUAL_CHARGE_LASTSTART Tag = 0x01000153
EMS_REQ_START_MANUAL_CHARGE Tag = 0x0100008F
EMS_START_MANUAL_CHARGE Tag = 0x0180008F
EMS_REQ_START_EMERGENCYPOWER_TEST Tag = 0x01000090
// Gibt als Rückantwort die Anzahl der gestarteten Notstromtests zurück
EMS_START_EMERGENCYPOWER_TEST Tag = 0x01800090
EMS_REQ_GET_GENERATOR_STATE Tag = 0x01000091
Expand Down Expand Up @@ -363,7 +361,13 @@ const (
// Rückgabewert für Batteriebezeichnung
BAT_DEVICE_NAME Tag = 0x0380000C
// Rückgabewert für Anzahl der gefundenen DCBs
BAT_DCB_COUNT Tag = 0x0380000D
BAT_DCB_COUNT Tag = 0x0380000D

BAT_MAX_DCB_CELL_CURRENT Tag = 0x03800012 // source https://github.com/rxhan/RSCPGui
BAT_MIN_DCB_CELL_CURRENT Tag = 0x03800013 // source https://github.com/rxhan/RSCPGui
BAT_MAX_DCB_CELL_VOLTAGE Tag = 0x03800014 // source https://github.com/rxhan/RSCPGui
BAT_MIN_DCB_CELL_VOLTAGE Tag = 0x03800015 // source https://github.com/rxhan/RSCPGui

BAT_MAX_DCB_CELL_TEMPERATURE Tag = 0x03800016
// Ein Container mit allen Temperaturen für die angefragte DCB.
BAT_MIN_DCB_CELL_TEMPERATURE Tag = 0x03800017
Expand Down Expand Up @@ -414,13 +418,19 @@ const (
// Kann nur innerhalb eines REQ_BAT_DATA Container verwendet werden!
BAT_REQ_MAX_DCB_CELL_TEMPERATURE Tag = 0x03000016
// Kann nur innerhalb eines REQ_BAT_DATA Container verwendet werden!
BAT_REQ_MIN_DCB_CELL_TEMPERATURE Tag = 0x03000017
BAT_REQ_MIN_DCB_CELL_TEMPERATURE Tag = 0x03000017
BAT_REQ_DCB_ALL_CELL_TEMPERATURES Tag = 0x03000018 // source https://github.com/rxhan/RSCPGui
BAT_DCB_ALL_CELL_TEMPERATURES Tag = 0x03800018 // source https://github.com/rxhan/RSCPGui
BAT_REQ_DCB_ALL_CELL_VOLTAGES Tag = 0x0300001A // source https://github.com/rxhan/RSCPGui
BAT_DCB_ALL_CELL_VOLTAGES Tag = 0x0380001A // source https://github.com/rxhan/RSCPGui
// Kann nur innerhalb eines REQ_BAT_DATA Container verwendet werden!
BAT_REQ_READY_FOR_SHUTDOWN Tag = 0x0300001E
// Kann nur innerhalb eines REQ_BAT_DATA Container verwendet werden!
BAT_REQ_INFO Tag = 0x03000020
// Kann nur innerhalb eines REQ_BAT_DATA Container verwendet werden!
BAT_REQ_TRAINING_MODE Tag = 0x03000021
BAT_REQ_DCB_INFO Tag = 0x03000042 // source https://github.com/rxhan/RSCPGui
BAT_DCB_INFO Tag = 0x03800042 // source https://github.com/rxhan/RSCPGui
BAT_DCB_INDEX Tag = 0x03800100
BAT_DCB_LAST_MESSAGE_TIMESTAMP Tag = 0x03800101
BAT_DCB_MAX_CHARGE_VOLTAGE Tag = 0x03800102
Expand All @@ -446,7 +456,19 @@ const (
BAT_DCB_FW_VERSION Tag = 0x03800122
BAT_DCB_DATA_TABLE_VERSION Tag = 0x03800123
BAT_DCB_PCB_VERSION Tag = 0x03800124
BAT_REQ_DEVICE_STATE Tag = 0x03060000

BAT_DCB_NR_SERIES_CELL Tag = 0x03800300 // source https://github.com/rxhan/RSCPGui
BAT_DCB_NR_PARALLEL_CELL Tag = 0x03800301 // source https://github.com/rxhan/RSCPGui
BAT_DCB_MANUFACTURE_NAME Tag = 0x03800302 // source https://github.com/rxhan/RSCPGui
BAT_DCB_DEVICE_NAME Tag = 0x03800303 // source https://github.com/rxhan/RSCPGui
BAT_DCB_SERIALCODE Tag = 0x03800304 // source https://github.com/rxhan/RSCPGui
BAT_DCB_NR_SENSOR Tag = 0x03800305 // source https://github.com/rxhan/RSCPGui
BAT_DCB_STATUS Tag = 0x03800306 // source https://github.com/rxhan/RSCPGui
BAT_DCB_WARNING Tag = 0x03800307 // source https://github.com/rxhan/RSCPGui
BAT_DCB_ALARM Tag = 0x03800308 // source https://github.com/rxhan/RSCPGui
BAT_DCB_ERROR Tag = 0x03800309 // source https://github.com/rxhan/RSCPGui

BAT_REQ_DEVICE_STATE Tag = 0x03060000
// DEVICE_CONNECTED & DEVICE_WORKING & DEVICE_IN_SERVICE
BAT_DEVICE_STATE Tag = 0x03860000
// Kommt nur im BAT_DEVICE_STATE Antwort vor
Expand Down
23 changes: 22 additions & 1 deletion rscp/tag_datatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ var dataTypeMap = map[Tag]DataType{
EMS_DISCHARGE_START_POWER: Uint32,
EMS_POWERSAVE_ENABLED: Bool,
EMS_WEATHER_REGULATED_CHARGE_ENABLED: Bool,
EMS_WEATHER_FORECAST_MODE: Int32,
EMS_WEATHER_FORECAST_MODE: Int32, // undocumented
EMS_RES_WEATHER_FORECAST_MODE: Int32, // undocumented
EMS_MANUAL_CHARGE_START_COUNTER: Int64, // documented as Uint32, but got Int64
EMS_MANUAL_CHARGE_ACTIVE: Bool,
EMS_MANUAL_CHARGE_ENERGY_COUNTER: Double64, // documented as Uint32, but got Int64
Expand Down Expand Up @@ -286,6 +287,10 @@ var dataTypeMap = map[Tag]DataType{
BAT_REQ_DCB_COUNT: None,
BAT_REQ_MAX_DCB_CELL_TEMPERATURE: None,
BAT_REQ_MIN_DCB_CELL_TEMPERATURE: None,
BAT_REQ_DCB_ALL_CELL_TEMPERATURES: UInt16, // undocumented
BAT_DCB_ALL_CELL_TEMPERATURES: Float32, // undocumented
BAT_REQ_DCB_ALL_CELL_VOLTAGES: UInt16, // undocumented
BAT_DCB_ALL_CELL_VOLTAGES: Float32, // undocumented
BAT_REQ_READY_FOR_SHUTDOWN: None,
BAT_REQ_INFO: None,
BAT_REQ_TRAINING_MODE: None,
Expand All @@ -305,13 +310,19 @@ var dataTypeMap = map[Tag]DataType{
BAT_ERROR_CODE: Uint32,
BAT_DEVICE_NAME: CString,
BAT_DCB_COUNT: UChar8,
BAT_MAX_DCB_CELL_CURRENT: Float32, // undocumented
BAT_MIN_DCB_CELL_CURRENT: Float32, // undocumented
BAT_MAX_DCB_CELL_VOLTAGE: Float32, // undocumented
BAT_MIN_DCB_CELL_VOLTAGE: Float32, // undocumented
BAT_MAX_DCB_CELL_TEMPERATURE: Float32,
BAT_MIN_DCB_CELL_TEMPERATURE: Float32,
BAT_DCB_CELL_TEMPERATURE: Float32,
BAT_DCB_CELL_VOLTAGE: Float32,
BAT_READY_FOR_SHUTDOWN: Bool,
BAT_INFO: Container,
BAT_TRAINING_MODE: UChar8,
BAT_REQ_DCB_INFO: UInt16, // undocumented
BAT_DCB_INFO: Container, // undocumented
BAT_DCB_INDEX: UInt16,
BAT_DCB_LAST_MESSAGE_TIMESTAMP: Uint64,
BAT_DCB_MAX_CHARGE_VOLTAGE: Float32,
Expand All @@ -337,6 +348,16 @@ var dataTypeMap = map[Tag]DataType{
BAT_DCB_FW_VERSION: Uint32,
BAT_DCB_DATA_TABLE_VERSION: Uint32,
BAT_DCB_PCB_VERSION: Uint32,
BAT_DCB_NR_SERIES_CELL: Uint32, // undocumented
BAT_DCB_NR_PARALLEL_CELL: Uint32, // undocumented
BAT_DCB_MANUFACTURE_NAME: CString, // undocumented
BAT_DCB_DEVICE_NAME: CString, // undocumented
BAT_DCB_SERIALCODE: CString, // undocumented
BAT_DCB_NR_SENSOR: UChar8, // undocumented
BAT_DCB_STATUS: UInt16, // undocumented
BAT_DCB_WARNING: UInt16, // undocumented
BAT_DCB_ALARM: UInt16, // undocumented
BAT_DCB_ERROR: UInt16, // undocumented
BAT_DATA: Container,
BAT_DEVICE_STATE: Container,
BAT_DEVICE_CONNECTED: Bool,
Expand Down
15 changes: 15 additions & 0 deletions rscp/tag_datatype_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package rscp

import (
"testing"
)

func TestTag_DataTypeDefined(t *testing.T) {
for _, tag := range _TagValues {
t.Run(tag.String(), func(t *testing.T) {
if _, ok := dataTypeMap[tag]; !ok {
t.Errorf("tag %s has no datatype defined", tag)
}
})
}
}
Loading

0 comments on commit ddd0de7

Please sign in to comment.