Skip to content

Commit

Permalink
More custom attributes for Eurotronic SPZB0001 (#270)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mhelff authored and Koenkk committed Feb 8, 2019
1 parent 47d0b35 commit e6254ac
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 16 deletions.
27 changes: 19 additions & 8 deletions converters/fromZigbee.js
Expand Up @@ -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;
},
Expand Down Expand Up @@ -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',
Expand Down
81 changes: 77 additions & 4 deletions converters/toZigbee.js
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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) => {
Expand Down
10 changes: 6 additions & 4 deletions devices.js
Expand Up @@ -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);
Expand All @@ -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),
];

Expand Down

0 comments on commit e6254ac

Please sign in to comment.