- Platform information:
- Hardware: Raspberry Pi 3 Model B Rev 1.2_
- OS: Raspbian GNU/Linux 8 (stretch)
- OpenJDK Runtime Environment (Zulu 8.31.1.122-linux_aarch32hf) (build 1.8.0_181-b122)
- openHAB Version: OH2.4.0-1 (apt-get), text-based config
- binding = expire1,fritzboxtr0641,mqtt1,weather1,astro,exec,network,ntp,systeminfo,logreader
- ui = paper,basic,classic
- persistence = rrd4j,mapdb
- action = mail,mqtt
- transformation = map,javascript,xslt,scale,jsonpath
- misc = restdocs
I am receiving data from a battery management system via MQTT, like so:
09/11/19 20:25:17.010 40,0
09/11/19 20:25:17.052 40,0
09/11/19 20:25:17.116 30,0,2,4000,526,40
09/11/19 20:25:17.177 301,3300,3308,3310,3305
09/11/19 20:25:17.184 302,3261,3273,3283,3273
09/11/19 20:25:17.242 311,3300,3297,3281,3301
09/11/19 20:25:17.250 312,3297,3291,3300,3300
The timestamp is only there to document the âspeedâ of messages.
This rule:
rule "Zeva Cell sets values"
when
Item ZevaCellSetRaw received update
then
// ArgyleCourt/Shed/Tower/Zeva16/Voltages 301,3495,3491,3496,3495
// topic 0 1 2 3 4
val buffer = ZevaCellSetRaw.state.toString.split(",")
val cellSetId = Integer::parseInt(buffer.get(0))
logInfo("Zeva.1.1", "Zeva BMS: cellSet {}", cellSetId)
/*
the meaning of Zeva BMS cell values are as follows:
Set ID cell number
1 301: 16 15 14 13
2 302: 12 11 10 9
3 311: 8 7 6 5
4 312: 4 3 2 1
*/
switch (cellSetId) {
case 301: {
BattCell_16.postUpdate(Float::parseFloat(buffer.get(1)) / 1000)
BattCell_15.postUpdate(Float::parseFloat(buffer.get(2)) / 1000)
BattCell_14.postUpdate(Float::parseFloat(buffer.get(3)) / 1000)
BattCell_13.postUpdate(Float::parseFloat(buffer.get(4)) / 1000)
}
case 302: {
BattCell_12.postUpdate(Float::parseFloat(buffer.get(1)) / 1000)
BattCell_11.postUpdate(Float::parseFloat(buffer.get(2)) / 1000)
BattCell_10.postUpdate(Float::parseFloat(buffer.get(3)) / 1000)
BattCell_09.postUpdate(Float::parseFloat(buffer.get(4)) / 1000)
}
case 311: {
BattCell_08.postUpdate(Float::parseFloat(buffer.get(1)) / 1000)
BattCell_07.postUpdate(Float::parseFloat(buffer.get(2)) / 1000)
BattCell_06.postUpdate(Float::parseFloat(buffer.get(3)) / 1000)
BattCell_05.postUpdate(Float::parseFloat(buffer.get(4)) / 1000)
}
case 312: {
BattCell_04.postUpdate(Float::parseFloat(buffer.get(1)) / 1000)
BattCell_03.postUpdate(Float::parseFloat(buffer.get(2)) / 1000)
BattCell_02.postUpdate(Float::parseFloat(buffer.get(3)) / 1000)
BattCell_01.postUpdate(Float::parseFloat(buffer.get(4)) / 1000)
}
}
logInfo("Zeva.1.9", "Zeva BMS: raw V {}", ZevaCellSetRaw.state)
end
⊠takes the ârawâ string; separates the message ID (301, 302, 311, 312) and reshuffles, as in reverses the order to reflect the physical cells layout. OR more specific, the BMS counts the cell from right to left, while I numbered them from left to right.
However, the rule or more so openHAB does not seem to process all values⊠this following image of the sitemap does not match the data received (and shown above).
Cells 1 to 4 match the reverse of message ID 312, which is correct, but all others donât.
Is this because of delays with postUpdate()?
If so, why are cells 5 to 8 not always updated?
Is the data popping in too quickly for OH to process?
And yes, cell 11 and 6 are âdyingâ, as in approaching their end of life.
Any hints appreciated.
[edit #1] added some logInfo:
2019-09-11 20:56:47.087 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'bms_zeva.rules'
2019-09-11 20:56:59.045 [INFO ] [ipse.smarthome.model.script.Zeva.0.0] - System Start: Zeva BMS rules
2019-09-11 20:57:17.072 [INFO ] [ipse.smarthome.model.script.Zeva.1.1] - Zeva BMS: cellSet 302
2019-09-11 20:57:17.080 [INFO ] [ipse.smarthome.model.script.Zeva.1.1] - Zeva BMS: cellSet 302
2019-09-11 20:57:17.115 [INFO ] [ipse.smarthome.model.script.Zeva.1.9] - Zeva BMS: raw V 302,3266,3271,3275,3257
2019-09-11 20:57:17.167 [INFO ] [ipse.smarthome.model.script.Zeva.1.1] - Zeva BMS: cellSet 312
2019-09-11 20:57:17.173 [INFO ] [ipse.smarthome.model.script.Zeva.1.9] - Zeva BMS: raw V 312,3290,3281,3280,3277
2019-09-11 20:57:17.205 [INFO ] [ipse.smarthome.model.script.Zeva.1.1] - Zeva BMS: cellSet 312
2019-09-11 20:57:17.242 [INFO ] [ipse.smarthome.model.script.Zeva.1.9] - Zeva BMS: raw V 312,3290,3281,3280,3277
2019-09-11 20:57:17.290 [INFO ] [ipse.smarthome.model.script.Zeva.1.9] - Zeva BMS: raw V 312,3290,3281,3280,3277
matching this input:
09/11/19 20:58:17.044 301,3280,3286,3294,3287
09/11/19 20:58:17.051 302,3259,3270,3277,3268
09/11/19 20:58:17.106 311,3280,3275,3274,3281
09/11/19 20:58:17.114 312,3285,3277,3286,3285