diff --git a/simulations/simulation_mbus.txt b/simulations/simulation_mbus.txt index 94a63a8..b70cd56 100644 --- a/simulations/simulation_mbus.txt +++ b/simulations/simulation_mbus.txt @@ -9,3 +9,8 @@ telegram=|6893936808007275404810C514000431270000#04786BF99F00046D040F632B0415E02 telegram=|68F8F86808007200464470A7320404270000000974040970040C0E082303000C14079519000B2D0500000B3B0808000A5B52000A5F51000A6206004C14061818004C0E490603000C7800464470891071609B102D020100DB102D0201009B103B6009009A105B78009A105F74000C22726701003C22000000007C2200000000426C01018C2006000000008C3006000000008C80100600000000CC200600000000CC300600000000CC801006000000009A115B64009A115F63009B113B5208009B112D020100BC0122000000008C010E490603008C2106000000008C3106000000008C811006000000008C011406181800046D310ACA210F21040010A0C116| {"media":"heat","meter":"ultraheat","name":"MyUltra","id":"70444600","heat_kwh":8974.444444,"volume_m3":1995.07,"power_kw":0.5,"flow_m3h":0.808,"flow_c":52,"return_c":51,"timestamp":"1111-11-11T11:11:11Z"} + +# Test multical 403 heat meter sent over mbus. + +telegram=|68464668084a72447744772d2c3404060000000406ce86000004ff073444020004ff08f8ce0100041411680300043B0f02000002593c19025da41104ff220000000004a5ff21c7d02700d916| +{"forward_energy_m3c": 148532,"id": "77447744","media": "heat","meter": "kamheat","name": "MyKamHeat","return_energy_m3c": 118520,"status": "OK","t1_temperature_c": 64.6,"t2_temperature_c": 45.16,"timestamp": "1111-11-11T11:11:11Z","total_energy_consumption_kwh": 34510,"total_volume_m3": 2232.49,"volume_flow_m3h": 0.527 } diff --git a/src/wmbus.cc b/src/wmbus.cc index 67e9f70..4da2436 100644 --- a/src/wmbus.cc +++ b/src/wmbus.cc @@ -4802,6 +4802,11 @@ FrameStatus checkWMBusFrame(vector &data, int type = data[1]; int offset = 1; + if (data[0] == 0x68 && data[3] == 0x68 && data[1] == data[2]) + { + // Ooups this is not a wmbus frame. Its clearly an mbus frame. + return PartialFrame; + } if (!isValidWMBusCField(type)) { // Ouch, we are out of sync with the wmbus frames that we expect! diff --git a/tests/test_mbus.sh b/tests/test_mbus.sh index d2bd7a4..dc1dbf7 100755 --- a/tests/test_mbus.sh +++ b/tests/test_mbus.sh @@ -13,6 +13,7 @@ cat simulations/simulation_mbus.txt | grep '^{' | jq --sort-keys . > $TEST/test_ $PROG --format=json simulations/simulation_mbus.txt \ MyUltra ultraheat 70444600 NOKEY \ MySenso sensostar 10484075 NOKEY \ + MyKamHeat kamheat 77447744 NOKEY \ 2> $TEST/test_stderr.txt | jq --sort-keys . > $TEST/test_output.txt if [ "$?" = "0" ]