danielwippermann / resol-vbus

A JavaScript library for processing RESOL VBus data
MIT License
67 stars 34 forks source link

delta therm fk pumpendrehzahl #46

Closed bwesemann closed 3 years ago

bwesemann commented 3 years ago

hi daniel,

i need the pwm pump speed. i think it is in the standard infos 0x0015. because "id": "00_0010_5611_10_0100_008_1_0", "name": "Pump speed relay 1", "rawValue": 100 always shows 100% if the pump is running. i use your sample live json server. can you please help me to get the right data?

image

best regards from germany ben

danielwippermann commented 3 years ago

Hi Ben,

to access the "Standard Informationen" packet you can use the JavaScript function getBlockTypeSectionsForHeaders on a Specification object.

If your code currently looks something like this: https://github.com/danielwippermann/resol-vbus/blob/3423881580e7dc30d862871385d15bc249049253/examples/vbustouch-proxy/index.js#L85 you can add something like this:

const blockTypeSections = specification.getBlockTypeSectionsForHeaders(headerSet.getHeaders());

and inspect the returned blockTypeSections array. According to your screenshot it should contain 6 elements (Smart Display, pump speeds, error mask, temperatures, heat and operating hours). The information you seek will most likely be in blockTypeSections [1] [0].

bwesemann commented 3 years ago

hi daniel,

thanks for your fast reply.

i've added the following: const blockTypeSections = spec.getBlockTypeSectionsForHeaders(headerSet.getHeaders()); logger.debug(JSON.stringify(blockTypeSections, null, 4));

and get this, but packet fields are empty. could you please help me again?

debug: [ { "sectionId": "00_0015_5611_10_0100_02_0A_1", "surrogatePacketId": "00_8015_F76C_10_3ECC", "packet": { "destinationAddress": 21, "sourceAddress": 22033, "timestamp": "2020-10-22T21:19:17.447Z", "command": 256, "frameCount": 15, "frameData": { "type": "Buffer", "data": [ 2, 10, 0, 0, 55, 1, 152, 1, 0, 0, 0, 0, 1, 8, 0, 0, 0, 100, 255, 255, 1, 11, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 55, 1, 152, 1, 188, 1, 224, 0, 1, 5, 0, 0, 0, 0, 0, 0, 2, 9, 0, 0, 50, 0, 0, 0, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, "channel": 0 }, "packetSpec": { "packetId": "00_0015_5611_10_0100", "channel": 0, "destinationAddress": 21, "sourceAddress": 22033, "protocolVersion": 16, "command": 256, "info": 0, "destinationDevice": { "name": "Standard-Infos", "deviceId": "00_0015_5611", "channel": 0, "selfAddress": 21, "peerAddress": 22033, "fullName": "Standard-Infos" }, "sourceDevice": { "name": "DeltaTherm FK", "deviceId": "00_5611_0015", "channel": 0, "selfAddress": 22033, "peerAddress": 21, "fullName": "DeltaTherm FK" }, "fullName": "DeltaTherm FK => Standard-Infos", "packetFields": [] }, "startOffset": 0, "endOffset": 12, "type": 10, "payloadCount": 1, "frameCount": 2, "frameData": { "type": "Buffer", "data": [ 2, 10, 0, 0, 55, 1, 152, 1, 0, 0, 0, 0 ] } }, ... ... ...

danielwippermann commented 3 years ago

Thanks for that dump. I was able to reconstruct a small demo application from the data it contained:

const vbus = require('resol-vbus');

const spec = vbus.Specification.getDefaultSpecification();

const frameData = Buffer.from([
  2,
  10,
  0,
  0,

  55,
  1,
  152,
  1,

  0,
  0,
  0,
  0,

  1,
  8,
  0,
  0,

  0,
  100,
  255,
  255,

  1,
  11,
  0,
  0,

  0,
  0,
  0,
  0,

  2,
  1,
  0,
  0,

  55,
  1,
  152,
  1,

  188,
  1,
  224,
  0,

  1,
  5,
  0,
  0,

  0,
  0,
  0,
  0,

  2,
  9,
  0,
  0,

  50,
  0,
  0,
  0,

  117,
  0,
  0,
  0,
]);

// Create a dummy packet
const packet = new vbus.Packet({
  channel: 0,
  destinationAddress: 0x0015,
  sourceAddress: 0x5611,
  command: 0x0100,
  frameCount: 15,
  frameData,
});

// Search for Block-Type sections in the packet above
const sections = spec.getBlockTypeSectionsForHeaders([ packet ]);
// console.log(sections);

// Optionally print the PacketSpecifications that are generated on-the-fly for those sections
// const packetSpecs = spec.getBlockTypePacketSpecificationsForSections(sections);
// console.log(packetSpecs);

// Extract the fields from the sections parsed aboves
const packetFields = spec.getBlockTypeFieldsForSections(sections);
// console.log(packetFields);

// Print a list of packet-field-IDs found in the sections
for (const packetField of packetFields) {
  console.log(`${packetField.id}: ${packetField.name}`);
}

const packetFieldById = packetFields.reduce((memo, packetField) => {
  memo [packetField.id] = packetField;
  return memo;
}, {});

// Print "Pump speed relay 1"'s raw value
console.log(packetFieldById ['00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_004_1_0'].rawValue);

As you can see my previous reply was only part of the way. After you use getBlockTypeFieldsForSections on the returned sections you get similar data structures as in the getPacketFieldsForHeaders case. My example above only accesses the rawValue component to get the pump speed of relay 1.

Hope this helps. If you have any other question do not hesitate to ask again! :)

danielwippermann commented 3 years ago

I forgot one piece of information: if you look at the list of packet fields you will find some fields that are not supported by your controller:

00_8015_F76C_10_3ECC_00_0015_5611_10_0100_02_0A_1_004_2_0: Temperatur Kollektor
00_8015_F76C_10_3ECC_00_0015_5611_10_0100_02_0A_1_006_2_0: Temperatur Speicher
00_8015_F76C_10_3ECC_00_0015_5611_10_0100_02_0A_1_008_4_0: Heat quantity
00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_004_1_0: Pump speed relay 1
00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_005_1_0: Pump speed relay 2
00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_006_1_0: Pump speed relay 3 <--
00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_007_1_0: Pump speed relay 4 <--
00_8015_37C3_10_234F_00_0015_5611_10_0100_01_0B_1_004_4_0: Error mask
00_8015_22F9_10_E0B3_00_0015_5611_10_0100_02_01_4_004_2_0: Temperature sensor 1
00_8015_22F9_10_E0B3_00_0015_5611_10_0100_02_01_4_006_2_0: Temperature sensor 2
00_8015_22F9_10_E0B3_00_0015_5611_10_0100_02_01_4_008_2_0: Temperature sensor 3
00_8015_22F9_10_E0B3_00_0015_5611_10_0100_02_01_4_010_2_0: Temperature sensor 4
00_8015_4AF9_10_A85F_00_0015_5611_10_0100_01_05_1_004_4_0: Heat quantity

Since your controller only has 2 relays the fields for "Pump speed relay 3 + 4" are irritating. Please ignore those fields. The controller sends "255" as the raw value for those fields to indicate that they are not available. But the resol-vbus library currently does not respect that information and decodes them anyway.

bwesemann commented 3 years ago

hi daniel,

thank you so much for your help. quick and dirty my code:

const generateJsonData = async function() { const packetFields = spec.getPacketFieldsForHeaders(headerSet.getSortedHeaders()); const blockTypeSections = spec.getBlockTypeSectionsForHeaders(headerSet.getHeaders()); //logger.debug(JSON.stringify(blockTypeSections, null, 4)); //logger.debug(JSON.stringify(packetFields, null, 4));

const packetFields2 = spec.getBlockTypeFieldsForSections(blockTypeSections);
for (const packetField of packetFields2) {
  //logger.debug(`${packetField.id}: ${packetField.name}`);
}

const packetFieldById = packetFields2.reduce((memo, packetField) => {
  memo [packetField.id] = packetField;
  return memo;
}, {});

//logger.debug(packetFieldById ['00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_004_1_0'].rawValue);
//logger.debug(packetFieldById ['00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_005_1_0'].rawValue);

const data2 = {
   'id' : '00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_004_1_0',
   'name' : "Pump speed relay1", 
   'rawValue' : packetFieldById ['00_8015_F54C_10_5AD5_00_0015_5611_10_0100_01_08_4_004_1_0'].rawValue
};

//logger.debug(JSON.stringify(data2, null, 4));

const data = packetFields.map((pf) => {
    return {
        id: pf.id,
        name: pf.name,
        rawValue: pf.rawValue,
    };
});

const newData = data.concat(data2);

return JSON.stringify(newData, null, 4);

};

Unbenannt

best regards ben

danielwippermann commented 3 years ago

Closing this stale issue. If you need additional help don't hesitate to open a new issue.