Skip to content

Instantly share code, notes, and snippets.

Created Nov 23, 2014
Embed
What would you like to do?
package main;
use strict;
use warnings;
sub onTimer($) {
# Purpose: Hilfsfunktion um Timerereignisse zu steuern
# Author : Dennis Gnoyke
# Date : 30.09.2012
# Changes: ---
# Remarks:
# $_[0] = eine Zahl
#
if ($_[0] eq 1) {
#Lueften(,,)
Lueften("TS34C_Misc","AR_Lueften","55");
#Platz für weitere Räume ...
} elsif ($_[0] eq 2) {
#irgendetwas anderes
}
}
sub Lueften($$$) {
# Purpose: Ermitteln ob gelüftet werden soll oder nicht
# Author : Dennis Gnoyke
# Date : 30.09.2012
# Changes: ---
# Remarks:
# $_[0] = Innensensor mit Reading "Fan"
# $_[1] = dummy device
# $_[2] = Grenzwert Luftfeuchte
if (ReadingsVal($_[0],"fan","off") eq "on") {
if (ReadingsVal($_[0] ,"humidity",100) >= $_[2]) {
if (ReadingsVal($_[1],"state","NEIN") ne "JA") {
fhem("set $_[1] JA");
}
} else {
if (ReadingsVal($_[1],"state","NEIN") ne "EGAL") {
fhem("set $_[1] EGAL");
}
}
} else {
if (ReadingsVal($_[1],"state","JA") ne "NEIN") {
fhem("set $_[1] NEIN");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment