-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
1,881 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/frame/ErrorCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.api.frame | ||
|
||
/** | ||
* Possible error codes that can be in data blocks of type [DataType.ERROR] | ||
* | ||
* @param rscpCode Code in the data block that identifies the error type | ||
* | ||
* @since 2.1 | ||
*/ | ||
enum class ErrorCode(val rscpCode: Byte) { | ||
/** | ||
* Empty data block. Usually used for request frames; code = 0x00 | ||
*/ | ||
NOT_HANDLED(rscpCode = 0x00.toByte()), | ||
/** | ||
* Boolean typ. 1 for true, 0 for false; code = 0x01 | ||
*/ | ||
ACCESS_DENIED(rscpCode = 0x01.toByte()), | ||
|
||
/** | ||
* Contains a 1byte number; code = 0x02 | ||
*/ | ||
FORMAT(rscpCode = 0x02.toByte()), | ||
/** | ||
* Contains a 1byte number (unsigned); code = 0x03 | ||
*/ | ||
AGAIN(rscpCode = 0x03.toByte()), | ||
|
||
UNKNOWN(rscpCode = 0xFF.toByte()); | ||
|
||
|
||
companion object { | ||
|
||
/** | ||
* Returns the [ErrorCode] object for the given code. | ||
* | ||
* If the code is not known, [UNKNOWN] is supplied. | ||
* | ||
* @return [ErrorCode] object to the given code | ||
* | ||
* @since 2.1 | ||
*/ | ||
fun byRscpCode(code: Int) = | ||
entries | ||
.find { it.rscpCode.toInt() == code } | ||
?: UNKNOWN | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,580 changes: 1,435 additions & 145 deletions
1,580
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/frame/tags/BatTag.kt
Large diffs are not rendered by default.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/service/BatteryService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.api.service | ||
|
||
import de.jnkconsulting.e3dc.easyrscp.api.service.model.BatterySpec | ||
import de.jnkconsulting.e3dc.easyrscp.api.service.model.BatteryStatus | ||
import de.jnkconsulting.e3dc.easyrscp.api.service.model.PowerState | ||
|
||
/** | ||
* Service to query the battery specification and status data | ||
* | ||
* @since 2.1 | ||
*/ | ||
interface BatteryService { | ||
|
||
/** | ||
* Liest die Batteriespezifikation aus dem E3DC Hauskraftwerk | ||
* | ||
* @return Specification of the battery. As a rule, the list contains only one element. Theoretically, however, a home power station can have several batteries | ||
* | ||
* @since 2.1 | ||
*/ | ||
fun readSpecification(): List<BatterySpec> | ||
|
||
/** | ||
* Reads the current status data of the battery | ||
* | ||
* @return Current monitoring data. As a rule, the list contains only one element. Theoretically, however, a home power station can have several batteries | ||
* | ||
* @since 2.1 | ||
*/ | ||
fun readMonitoringData(): List<BatteryStatus> | ||
} |
107 changes: 107 additions & 0 deletions
107
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/service/model/Battery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.api.service.model | ||
|
||
/** | ||
* Contains the specification data of the battery | ||
* | ||
* @param index ID of the battery in the E3DC system | ||
* @param name Name of the battery stored in the E3DC system | ||
* @param maxChargingTempCelsius Maximum possible charging temperature in Celsius. fyi: I don't know why the temperature is an Int value for the battery and a float for the DCB module ... BUT, it is like this in the protocol | ||
* @param minChargingTempCelsius Maximum possible discharging temperature in Celsius. fyi: I don't know why the temperature is an Int value for the battery and a float for the DCB module ... BUT, it is like this in the protocol | ||
* @param voltage Voltage for which the battery was specified in volts | ||
* @param capacityAh Capacity in Ah. Supplied by the system and NOT calculated. May therefore deviate slightly from the theoretically calculated value | ||
* @param capacityWh Kapazität in Wh. Supplied by the system and NOT calculated. May therefore deviate slightly from the theoretically calculated value | ||
* @param maxChargeCurrentA Maximum charging current in A | ||
* @param maxDischargeCurrentA Maximum discharging current in A | ||
* @param dcbSpecs List of specifications for the individual modules | ||
* | ||
* @since 2.1 | ||
*/ | ||
data class BatterySpec( | ||
val index: Short, | ||
val name: String, | ||
val maxChargingTempCelsius: Int, | ||
val minChargingTempCelsius: Int, | ||
val voltage: Float, | ||
val capacityAh: Float, | ||
val capacityWh: Percentage, | ||
val maxChargeCurrentA: Float, | ||
val maxDischargeCurrentA: Float, | ||
val dcbSpecs: List<DCBSpec> | ||
) | ||
|
||
/** | ||
* Contains the specification of a battery module | ||
* | ||
* @param index ID of the module in the battery | ||
* @param capacityAh Capacity of the module in Ah. Supplied by the system and NOT calculated. May therefore deviate slightly from the theoretically calculated value | ||
* @param maxChargeCurrentA Maximum charging current in A | ||
* @param maxDischargeCurrentA Maximum discharging current in A | ||
* @param fullChargeCapacityAh Capacity of the module in Ah, from when the system displays 100% charge status | ||
* @param voltage Voltage for which the module was specified in volts | ||
* @param maxChargingTempCelsius Maximum possible charging temperature in Celsius. . fyi: I don't know why the temperature is an Int value for the battery and a float for the DCB module ... BUT, it is like this in the protocol | ||
* @param minChargingTempCelsius Maximum possible discharging temperature in Celsius. . fyi: I don't know why the temperature is an Int value for the battery and a float for the DCB module ... BUT, it is like this in the protocol | ||
* @param serialCells Series-connected cells of the module | ||
* @param parallelCells Cells of the module connected in parallel | ||
* | ||
* @since 2.1 | ||
*/ | ||
data class DCBSpec( | ||
val index: Int, | ||
val capacityAh: Float, | ||
val maxChargeCurrentA: Float, | ||
val maxDischargeCurrentA: Float, | ||
val fullChargeCapacityAh: Float, | ||
val voltage: Float, | ||
val maxChargingTempCelsius: Float, | ||
val minChargingTempCelsius: Float, | ||
val serialCells: Int, | ||
val parallelCells: Int, | ||
) | ||
|
||
/** | ||
* Contains information on the current status of the battery | ||
* | ||
* @param index ID of the battery in the E3DC system | ||
* @param trainingModeActive Information on whether the battery is in training mode | ||
* @param connected Information on whether the battery is connected to the system (battery disconnect switch on the home power station) | ||
* @param working Information on whether the battery is working correctly | ||
* @param inService Information on whether the battery is in maintenance mode | ||
* @param asoc Percentage value that includes the condition of the battery taking ageing into account. A new battery theoretically has a value of 1.0 (100%) | ||
* @param realRsoc Current charge level as a percentage of the battery without taking into account the reserve for absolute deep discharge and theoretically possible full charge. The value should therefore never reach completely 0 and never completely 1 | ||
* @param voltage Current battery voltage | ||
* @param dcbStatus Status of the individual battery modules | ||
* | ||
* @since 2.1 | ||
*/ | ||
data class BatteryStatus( | ||
val index: Short, | ||
val trainingModeActive: Boolean, | ||
val connected: Boolean, | ||
val working: Boolean, | ||
val inService: Boolean, | ||
val asoc: Float, | ||
val realRsoc: Float, | ||
val voltage: Float, | ||
val dcbStatus: List<DCBStatus> | ||
) | ||
|
||
/** | ||
* Contains current status information on a battery module | ||
* | ||
* @param index ID of the module in the battery | ||
* @param voltage Current voltage | ||
* @param voltageAVG30s Average voltage of the last 30 seconds | ||
* @param currentA Current amperage in A | ||
* @param currentAVG30s Average current in the last 30 seconds | ||
* @param temperaturesCelsius Current temperature values of the respective sensors in Celsius | ||
* | ||
* @since 2.1 | ||
*/ | ||
data class DCBStatus( | ||
val index: Int, | ||
val voltage: Float, | ||
val voltageAVG30s: Float, | ||
val currentA: Float, | ||
val currentAVG30s: Float, | ||
val temperaturesCelsius: List<Float> | ||
) |
Oops, something went wrong.