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

Hmip drdi3 #354

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions homematic-devices/hmip-drdi3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/* eslint-disable no-new */

const Accessory = require('./lib/accessory');

function addService(type, name, channel) {
let service
this.node.debug("HMIP-DRDI3: "+ name +" "+channel);
switch (type) {
case 'ValveIrrigation':
// intentional fallthrough
case 'Valve':
// intentional fallthrough
case 'Lightbulb':
service=this.addService(type,name);
service.get('On', channel + '.LEVEL', value => {
this.node.debug("HMIPW-DRD3 get : "+channel);
valueBrightness = value;
return value > 0;
})

service.set('On', (value, callback) => {
this.node.debug("HMIPW-DRD3 set : "+channel);
if (value) {
setTimeout(() => {
if (valueBrightness === 0) {
value = 1;
} else {
value = valueBrightness / 100;
}

this.ccuSetValue(channel + '.LEVEL', value, callback);
}, 100);
} else {
this.ccuSetValue(channel + '.LEVEL', 0, callback);
}
})

service.get('Brightness', channel + '.LEVEL', value => {
valueBrightness = value * 100;
return value * 100;
})

service.set('Brightness', channel + '.LEVEL', value => {
valueBrightness = value;
return value / 100;
});
case 'Fan':
// intentional fallthrough
case 'Outlet':
// intentional fallthrough
default:
/*this.addService(type, name, type === 'Switch' ? '' : type)
.get('On', dp)
.set('On', dp);*/
}
}

class AccSingleService extends Accessory {
init(config, node) {
const {ccu} = node;
node.debug(config.accChannel + ' ' + "Lightbulb" + ' ');
addService.call(this, "Lightbulb", config.accChannelName, config.accChannel);
}
}

class AccMultiService extends Accessory {
init(config, node) {
const {ccu} = node;

for (let j = 0; j < 3; j++) {
for (let c = 0; c < 3; c++) {
const i = (j * 4) + (c + 2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da der erste verwertbare Kanal der 5. ist, müsste hier eine +5 statt einer +2 verwendet werden?

Copy link
Author

@sreinhold95 sreinhold95 Jan 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Durch die Virtual Channels sieht man auch die verdeckten Kanäle.
Der Dimmer hat auf 1,5,9 die Statuskanäle als Rückgabe. Deswegen ist der erste Kanal 2,6,10 für Ausgang 1,2,3
habe ein Bild meiner CCU3 gemacht dort erkennt man es.
drd3
Habe mich vertan ist der hmipw drd3. diesen habe ich als basis genommen, da ich leider kein drdi3 habe.
wenn Sie einen haben können Sie das verifizieren?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Du hast einen DRD3, ich einen DRDI3, sind die vielliecht unterschiedlich?
So sieht es bei mir aus:
grafik

Ohne die Anpassung in der Datei redmatic-homekit-homematic-devices.html lief es bei mir jedenfalls definitiv nicht. Den Code in dieser Datei verstehe ich allerdings nicht zu 100%.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das Kann sein.
Dein DRDI3 hat tastereingänge. hast du die virtuellen Kanäle an?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ich nutze zumindest bislang keine virtuellen Kanäle. Die Einstellung "Kanal aktiv / inaktiv" bei den Statusmitteilungs-Kanälen steht auf "Aktiv", falls du das meinst.

Copy link
Author

@sreinhold95 sreinhold95 Jan 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meinte das hier,
es gibt bei Homematic immer 3 Kanäle pro Aktor Ausgang. es wäre interessant wie es dann aussieht wenn dort die virtuellen Kanäle (erweiterter Verknüpfungsmodus an ist).
Wenn du nur den Start Kanal anpassen musstest. dann passt das. Die Tastereingänge werden aktuell nicht ausgewertet
erweitert

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Achso, das ist wie bei dir nicht angehakt.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also bei mir läuft jetzt alles wie es soll, an beiden Stellen muss für den DRDI3 aus der 2 eine 5 gemacht werden. Vielen Dank für die Vorarbeit!

if ((c === 0 && this.option(i)) || (c !== 0 && this.option(i, 'enabled'))) {
const channel = config.deviceAddress + ':' + i;
const name = ccu.channelNames[channel];
this.node.debug("HMIP-DRDI3 call MultiService Channel: "+name+" "+channel);
addService.call(this,"Lightbulb",name,channel)
}
}
}
}
}

module.exports = class HmipwDrd {
option(id, option) {
let addr = this.config.description.ADDRESS;
if (!addr.includes(':')) {
addr = addr + ':' + id;
}

let res;

if (option) {
res = this.config.options[addr] && this.config.options[addr][option];
} else {
res = !(this.config.options[addr] && this.config.options[addr].disabled);
}

this.node.debug('option ' + addr + ' ' + id + ' ' + option + ' ' + res);
return res;
}

constructor(config, node) {
const {ccu} = node;
this.node = node;
this.ccu = ccu;
this.config = config;
if (this.option('SingleAccessory')) {
new AccMultiService(config, node);
} else {
for (let j = 0; j < 3; j++) {
for (let c = 0; c < 3; c++) {
const i = (j * 4) + (c + 2);
if ((c === 0 && this.option(i)) || (c !== 0 && this.option(i, 'enabled'))) {
const channel = config.deviceAddress + ':' + i;
const name = ccu.channelNames[channel];
this.node.debug("HMIP-DRDI3 call SingleService Channel: "+name+" "+channel);

const chConfig = Object.assign({}, config, {accChannel: channel,accChannelName: name});
chConfig.description = Object.assign({}, config.description, {ADDRESS: channel});

new AccSingleService(chConfig, node);
}
}
}
}
}
};
4 changes: 4 additions & 0 deletions nodes/redmatic-homekit-homematic-devices.html
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@
addOption(addr, 'SingleAccessory');
addVirtualChannels(addr, 2, channelCount -1, 4);
break;
case 'hmip-drdi3':
addOption(addr, 'SingleAccessory');
addVirtualChannels(addr, 2, channelCount -1, 4);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich glaube, der erste Kanal müsste hier 5 und nicht 2 sein.

break;

case 'hmipw-drs4':
case 'hmipw-drs8':
Expand Down