Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More custom attributes for Eurotronic SPZB0001 #270

Merged
merged 11 commits into from Feb 8, 2019
27 changes: 19 additions & 8 deletions converters/fromZigbee.js
Expand Up @@ -1496,20 +1496,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 @@ -1739,6 +1745,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 @@ -2356,14 +2356,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 @@ -2372,7 +2374,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