diff --git a/README.md b/README.md index 210d1cb..22bf44d 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,4 @@ This Node-RED node is capturing the packets from a SystaComfort II device and pr |Listen Port|Port of UDP Server to listen on. Useful on multiple devices| ## Connectivity -To capture the published data from your SysteComfort II device you have to redirect the traffic on your local network. If you have a local DNS Forwarder you can just create a static host override. The domain `pradigma.remoteportal.de` needs to be resolved to your internal Node-RED ip address. +To capture the published data from your SystaComfort II device you have to redirect the traffic on your local network. If you have a local DNS Forwarder you can just create a static host override. The domain `pradigma.remoteportal.de` needs to be resolved to your internal Node-RED ip address. diff --git a/systacomfort2/systacomfort2.js b/systacomfort2/systacomfort2.js index 5462503..3700127 100644 --- a/systacomfort2/systacomfort2.js +++ b/systacomfort2/systacomfort2.js @@ -23,7 +23,7 @@ const SYSTACOMFORT_VALUES = { BUFFER_TANK_TEMPERATURE_BOTTOM: { dataPosition: 44, topic: 'buffer/temperature-bottom/get', description: 'Temperatur Pufferspeicher unten (TPU)', unit: '°C', valueDivider: 10 }, SOLAR_YIELD_CURRENT: { dataPosition: 752, topic: 'solar/yield-current/get', description: 'Solargewinn aktuell', unit: 'kW', valueDivider: 10 }, SOLAR_YIELD_DAY: { dataPosition: 756, topic: 'solar/yield-day/get', description: 'Solargewinn pro Tag', unit: 'kWh', valueDivider: 1 }, - SOLAR_YIELD_TOTAL: { dataPosition: 760, topic: 'solar/yield-overall/get', description: 'Solargewinn gesamt', unit: 'kWh', valueDivider: 1 }, + SOLAR_YIELD_TOTAL: { dataPosition: 760, topic: 'solar/yield-total/get', description: 'Solargewinn gesamt', unit: 'kWh', valueDivider: 1 }, SOLAR_TEMPERATURE_COLLECTOR: { dataPosition: 68, topic: 'solar/temperature-collector/get', description: 'Kollektortemperatur', unit: '°C', valueDivider: 10 }, SYSTEM_TEMPERATURE_FLOW: { dataPosition: 28, topic: 'system/temperature-flow/get', description: 'Vorlauftemperatur Heizung (Ist)', unit: '°C', valueDivider: 10 }, SYSTEM_TEMPERATURE_FLOW_RETURN: { dataPosition: 32, topic: 'system/temperature-flowreturn/get', description: 'Rücklauftemperatur Heizung', unit: '°C', valueDivider: 10 }, @@ -68,9 +68,8 @@ module.exports = function(RED) { Object.entries(SYSTACOMFORT_VALUES).forEach( ([key, valueDescriptor]) => { let dataValue = null let startPosition = valueDescriptor.dataPosition - if ( data.length > startPosition ) { - let dataValueRaw = null - dataValueRaw = ((data[startPosition] & BITMASK_2_BYTES)) | + if ( data.length > startPosition ) { + let dataValueRaw = ((data[startPosition] & BITMASK_2_BYTES)) | ((data[startPosition+1] & BITMASK_2_BYTES) << 8 ) | ((data[startPosition+2] & BITMASK_2_BYTES) << 16 ) | ((data[startPosition+3] & BITMASK_2_BYTES) << 24 ) @@ -126,7 +125,7 @@ module.exports = function(RED) { const udpServer = DGRAM.createSocket('udp4') // Handle exceptions on server udpServer.on('error', (err) => { - node.error(`SysteComfort2: Error on udp server connection: ${err.stack}`) + node.error(`SystaComfort2: Error on udp server connection: ${err.stack}`) node.status({ fill: 'red', shape: 'ring', text: 'Error on udp server connection' }) udpServer.close() }) @@ -140,7 +139,7 @@ module.exports = function(RED) { client.send(responseData, rinfo.port, rinfo.address, (err) => { client.close() }) - // Parse data receieved from syste comfort device + // Parse data receieved from systa comfort device let msgData = parseData(data, config.topicPrefix) if ( msgData ) { msgData.deviceIP = rinfo.address