From e6254acef6614b94e85a660a5d465887a7604615 Mon Sep 17 00:00:00 2001 From: Martin Helff Date: Fri, 8 Feb 2019 18:25:42 +0100 Subject: [PATCH] More custom attributes for Eurotronic SPZB0001 (#270) * Added Eurotronic Spirit Zigbee thermostat * adjust Spirit Zigbee thermostat binding due to pr comments * fix linter errors * renamed specific attributes with eurotronic prefix, cleanup converters * update model and description to match convention for documentation * remove trailing space * remove trailing space * added postfix parameter to eurotronic converters * Eurotronic SPZB0001: more custom attribtes, listen to devChange instead of attReport, rename eurotronic_16386 --- converters/fromZigbee.js | 27 ++++++++++---- converters/toZigbee.js | 81 ++++++++++++++++++++++++++++++++++++++-- devices.js | 10 +++-- 3 files changed, 102 insertions(+), 16 deletions(-) diff --git a/converters/fromZigbee.js b/converters/fromZigbee.js index b95db29e9e33a..5d034774f5a79 100644 --- a/converters/fromZigbee.js +++ b/converters/fromZigbee.js @@ -1508,20 +1508,26 @@ const converters = { return result; }, }, - eurotronic_thermostat_att_report: { + eurotronic_thermostat_dev_change: { cid: 'hvacThermostat', - type: 'attReport', + type: 'devChange', convert: (model, msg, publish, options) => { const result = {}; - if (typeof msg.data.data[16387] == 'number') { + if (typeof msg.data.data[0x4003] == 'number') { result.current_heating_setpoint = - precisionRound(msg.data.data[16387], 2) / 100; + precisionRound(msg.data.data[0x4003], 2) / 100; + } + if (typeof msg.data.data[0x4008] == 'number') { + result.eurotronic_system_mode = msg.data.data[0x4008]; + } + if (typeof msg.data.data[0x4002] == 'number') { + result.eurotronic_error_status = msg.data.data[0x4002]; } - if (typeof msg.data.data[16392] == 'number') { - result.eurotronic_system_mode = msg.data.data[16392]; + if (typeof msg.data.data[0x4000] == 'number') { + result.eurotronic_trv_mode = msg.data.data[0x4000]; } - if (typeof msg.data.data[16386] == 'number') { - result.eurotronic_16386 = msg.data.data[16386]; + if (typeof msg.data.data[0x4001] == 'number') { + result.eurotronic_valve_position = msg.data.data[0x4001]; } return result; }, @@ -1751,6 +1757,11 @@ const converters = { type: 'devChange', convert: (model, msg, publish, options) => null, }, + ignore_thermostat_report: { + cid: 'hvacThermostat', + type: 'attReport', + convert: (model, msg, publish, options) => null, + }, ignore_genGroups_devChange: { cid: 'genGroups', type: 'devChange', diff --git a/converters/toZigbee.js b/converters/toZigbee.js index ee920fe151b18..19150069e50c0 100644 --- a/converters/toZigbee.js +++ b/converters/toZigbee.js @@ -926,7 +926,7 @@ const converters = { key: 'eurotronic_system_mode', convert: (key, value, message, type, postfix) => { const cid = 'hvacThermostat'; - const attrId = 16392; + const attrId = 0x4008; if (type === 'set') { return { cid: cid, @@ -935,6 +935,7 @@ const converters = { zclData: [{ // Bit 0 = ? (default 1) // Bit 2 = Boost + // Bit 4 = Window open // Bit 7 = Child protection attrId: attrId, dataType: 0x22, @@ -953,11 +954,55 @@ const converters = { } }, }, - eurotronic_16386: { - key: 'eurotronic_16386', + eurotronic_error_status: { + key: 'eurotronic_error_status', convert: (key, value, message, type, postfix) => { const cid = 'hvacThermostat'; - const attrId = 16386; + const attrId = 0x4002; + if (type === 'get') { + return { + cid: cid, + cmd: 'read', + cmdType: 'foundation', + zclData: [{attrId: attrId}], + cfg: cfg.eurotronic, + }; + } + }, + }, + eurotronic_current_heating_setpoint: { + key: 'current_heating_setpoint', + convert: (key, value, message, type, postfix) => { + const cid = 'hvacThermostat'; + const attrId = 0x4003; + if (type === 'set') { + return { + cid: cid, + cmd: 'write', + cmdType: 'foundation', + zclData: [{ + attrId: attrId, + dataType: 0x29, + attrData: (Math.round((value * 2).toFixed(1))/2).toFixed(1) * 100, + }], + cfg: cfg.eurotronic, + }; + } else if (type === 'get') { + return { + cid: cid, + cmd: 'read', + cmdType: 'foundation', + zclData: [{attrId: attrId}], + cfg: cfg.eurotronic, + }; + } + }, + }, + eurotronic_valve_position: { + key: 'eurotronic_valve_position', + convert: (key, value, message, type, postfix) => { + const cid = 'hvacThermostat'; + const attrId = 0x4001; if (type === 'set') { return { cid: cid, @@ -981,6 +1026,34 @@ const converters = { } }, }, + eurotronic_trv_mode: { + key: 'eurotronic_trv_mode', + convert: (key, value, message, type, postfix) => { + const cid = 'hvacThermostat'; + const attrId = 0x4000; + if (type === 'set') { + return { + cid: cid, + cmd: 'write', + cmdType: 'foundation', + zclData: [{ + attrId: attrId, + dataType: 0x30, + attrData: value, + }], + cfg: cfg.eurotronic, + }; + } else if (type === 'get') { + return { + cid: cid, + cmd: 'read', + cmdType: 'foundation', + zclData: [{attrId: attrId}], + cfg: cfg.eurotronic, + }; + } + }, + }, livolo_switch_on_off: { key: ['state'], convert: (key, value, message, type, postfix) => { diff --git a/devices.js b/devices.js index 288d91c68b193..3469157196a66 100644 --- a/devices.js +++ b/devices.js @@ -2363,14 +2363,16 @@ const devices = [ description: 'Spirit Zigbee wireless heater thermostat', supports: 'temperature, heating system control', fromZigbee: [ - fz.thermostat_att_report, fz.eurotronic_thermostat_att_report, - fz.ignore_thermostat_change, fz.hue_battery, fz.ignore_power_change, + fz.thermostat_dev_change, + fz.eurotronic_thermostat_dev_change, + fz.ignore_thermostat_report, fz.hue_battery, fz.ignore_power_change, ], toZigbee: [ tz.thermostat_occupied_heating_setpoint, tz.thermostat_unoccupied_heating_setpoint, tz.thermostat_local_temperature_calibration, tz.thermostat_system_mode, - tz.eurotronic_system_mode, tz.eurotronic_16386, tz.thermostat_setpoint_raise_lower, + tz.eurotronic_system_mode, tz.eurotronic_error_status, tz.thermostat_setpoint_raise_lower, tz.thermostat_control_sequence_of_operation, tz.thermostat_remote_sensing, + tz.eurotronic_current_heating_setpoint, tz.eurotronic_trv_mode, tz.eurotronic_valve_position, ], configure: (ieeeAddr, shepherd, coordinator, callback) => { const device = shepherd.find(ieeeAddr, 1); @@ -2379,7 +2381,7 @@ const devices = [ (cb) => device.bind('hvacThermostat', coordinator, cb), (cb) => device.report('hvacThermostat', 'localTemp', 1, 1200, 25, cb), (cb) => device.foundation('hvacThermostat', 'configReport', [{ - direction: 0, attrId: 16387, dataType: 41, minRepIntval: 0, + direction: 0, attrId: 0x4003, dataType: 41, minRepIntval: 0, maxRepIntval: 600, repChange: 25}], {manufSpec: 1, manufCode: 4151}, cb), ];