Skip to content

Instantly share code, notes, and snippets.

Created November 23, 2014 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e6e9eb2f1617da3f02b2 to your computer and use it in GitHub Desktop.
Save anonymous/e6e9eb2f1617da3f02b2 to your computer and use it in GitHub Desktop.
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