Skip to content

Commit

Permalink
Support HmIP-BSL (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Feb 16, 2019
1 parent 19bf228 commit 0d288f1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
11 changes: 8 additions & 3 deletions nodes/ccu-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,21 @@ module.exports = function (RED) {
].includes(devices[addr].TYPE)) {
obj[addr] = {
name: config.channelNames[addr],
type: devices[addr].TYPE
type: devices[addr].TYPE,
deviceType: devices[addr].PARENT_TYPE
};
}
if (devices[addr].PARENT_TYPE === 'HmIP-MP3P' && [
if ([
'HmIP-MP3P',
'HmIP-BSL'
].includes(devices[addr].PARENT_TYPE) && [
'ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER',
'DIMMER_VIRTUAL_RECEIVER'
].includes(devices[addr].TYPE)) {
obj[addr] = {
name: config.channelNames[addr],
type: devices[addr].TYPE
type: devices[addr].TYPE,
deviceType: devices[addr].PARENT_TYPE
};
}
});
Expand Down
31 changes: 26 additions & 5 deletions nodes/ccu-signal.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
ramp_time_unit: {value: 'S'},
ramp_time_value: {value: 0},
repetitions: {value: 0},
dimmer_color: {value: 0},
dimmer_level: {value: 100},
dimmer_list: {value: []},
sound_level: {value: 50},
sound_list: {value: []},
acoustic_level: {value: 50},
optical_alarm_selection: {value: 'DISABLE_OPTICAL_SIGNAL'},
ccuConfig: {value: 'localhost', type: 'ccu-connection', required: true}
},
Expand Down Expand Up @@ -188,7 +188,11 @@
const channel = n.shift();
$nodeInputChannel.val(channel);
if (data && data[channel]) {
$nodeInputChannelType.val(data[channel].type).trigger('change');
let {type, deviceType} = data[channel];
if (deviceType === 'HmIP-BSL') {
type = 'BSL_' + type;
}
$nodeInputChannelType.val(type).trigger('change');
}
if (!$nodeInputName.val()) {
$nodeInputName.val(n.join(' '));
Expand Down Expand Up @@ -326,6 +330,8 @@
this.dimmer_list.forEach(item => {
$('#node-input-dimmer-container').editableList('addItem', item);
});
} else if (this.channelType === 'BSL_DIMMER_VIRTUAL_RECEIVER') {
// ...
} else {
console.error('unknown channelType', this.channelType);
}
Expand Down Expand Up @@ -412,6 +418,7 @@
<option value="ALARM_SWITCH_VIRTUAL_RECEIVER">ALARM (HmIP-ASIR)</option>
<option value="ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER">ACOUSTIC_SIGNAL (HmIP-MP3P)</option>
<option value="DIMMER_VIRTUAL_RECEIVER">DIMMER (HmIP-MP3P)</option>
<option value="BSL_DIMMER_VIRTUAL_RECEIVER">DIMMER (HmIP-BSL)</option>
</select>
</div>

Expand Down Expand Up @@ -511,13 +518,27 @@
<input id="node-input-sound_level" type="number" min="0" max="100">
</div>

<div class="form-row SUBMIT DIMMER_VIRTUAL_RECEIVER ">
<div class="form-row SUBMIT BSL_DIMMER_VIRTUAL_RECEIVER">
<label for="node-input-dimmer_color"><i class=""></i> Farbe </label>
<select id="node-input-dimmer_color">
<option value="0">Aus</option>
<option value="1">Blau</option>
<option value="2">Grün</option>
<option value="3">Türkis</option>
<option value="4">Rot</option>
<option value="5">Violett</option>
<option value="6">Gelb</option>
<option value="7">Weiss</option>
</select>
</div>

<div class="form-row SUBMIT DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
<label for="node-input-dimmer_level"><i class=""></i> Helligkeit </label>
<input id="node-input-dimmer_level" type="number" min="0" max="100">
</div>


<div class="form-row SUBMIT ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER">
<div class="form-row SUBMIT ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
<label for="node-input-ramp_time_unit"><i class=""></i> Rampenzeit </label>
<select id="node-input-ramp_time_unit" style="width: calc(35% - 5px)">
<option value="S">Sekunden</option>
Expand All @@ -528,7 +549,7 @@
</div>


<div class="form-row SUBMIT ALARM_SWITCH_VIRTUAL_RECEIVER ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER">
<div class="form-row SUBMIT ALARM_SWITCH_VIRTUAL_RECEIVER ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
<label for="node-input-duration_unit"><i class=""></i> Dauer </label>
<select id="node-input-duration_unit" style="width: calc(35% - 5px)">
<option value="S">Sekunden</option>
Expand Down
11 changes: 11 additions & 0 deletions nodes/ccu-signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ module.exports = function (RED) {
this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', params]);
break;
}
case 'BSL_DIMMER_VIRTUAL_RECEIVER': {
this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', {
LEVEL: config.dimmer_level / 100,
RAMP_TIME_UNIT: config.ramp_time_unit,
RAMP_TIME_VALUE: Number(config.ramp_time_value),
DURATION_UNIT: config.duration_unit,
DURATION_VALUE: parseInt(config.duration_value, 10) || 0,
COLOR: Number(config.dimmer_color)
}]);
break;
}
case 'ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER': {
const params = {
LEVEL: config.sound_level / 100,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-ccu",
"version": "1.15.0",
"version": "1.16.0",
"description": "Node-RED Nodes for the Homematic CCU",
"repository": "https://github.com/hobbyquaker/node-red-contrib-ccu",
"keywords": [
Expand Down

0 comments on commit 0d288f1

Please sign in to comment.