-
-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Description
I'm currently configuring the eBusd for my Wolf system. I've made good progress with the ISM7. I'm still missing the BM2 date decoding.
The time is encoded in DAY. That works.
The date is encoded as follows. If the value is considered like a UIN with low bytes first, then it is:
ff355022035bb027 / 026d33
0x6d 0x33
0x336d = 13165
0x336d & 0x001f = 0x000d = 13
0x336d>>5 & 0x000f = 0x000b = 11
0x336d>>9 = 0x0019 = 25
(13+1).(11+1).(25+2000)
14.12.2025
Here's another example.
ff35502203b3a827 / 026933
0x69 0x33
0x3369 = 13161
0x3369 & 0x001f = 0x0009 = 9
0x3369>>5 & 0x000f = 0x000b = 11
0x3369>>9 = 0x0019 = 25
(9+1).(11+1).(25+2000)
10.12.2025
Is it possible to include this 2-byte BCD date decoding in ebusd?
Or is it already available?
Or can I implement the calculation via CSV?
It would also be good if there were an encoder, as the date can also be written, for example, for party mode.
The calculation can also be found here:
https://github.com/zivillian/ism7mqtt/blob/master/src/ism7mqtt/ISM7/Xml/BM2DateConverterTemplate.cs
protected override void AddTelegram(byte low, byte high)
{
var value = high << 8 | low;
var day = value & 0b1_1111;
var month = (value >> 5) & 0xf;
var year = value >> 9;
if (month > 11)
{
Console.Error.WriteLine($"received invalid date for {nameof(BM2DateConverterTemplate)}({TelegramNr}). Make sure you have a correct time set on your BM2");
return;
}
_value = new DateTime(2000 + year, month + 1, day + 1);
}