FakeWT Anfängerfragen

Begonnen von dematic, 12 Februar 2016, 20:35:22

Vorheriges Thema - Nächstes Thema

dematic

ok klingt logisch. habe das in der 99_MyUtils mal wieder auf $CULMAX geändert, und jetzt funkioniert es auch.

später werde ich dann mal noch die anderen notifys dann erstellen.

Pa_CZ

Being a beginner with FHEM I struggled a lot with the above. to all also struggling with making the fakeWT work based on the wiki and the above thread here is result of my efforts which acually works ok now: Hope this helps.

Note:
IODev named cm in wiki is in my case named as CULMAX0
MAX_111111 is a MAX! heatthermostat (radiator valve head)
DEV_999999 is some temperature sensor providing actual temperature


1/ to FHEM command prompt write this:
set MAX_111111 associate fakeWallThermostat


test to see if it worked - write to FHEM command prompt the following:

set CULMAX0 fakeWT MAX_111111 14.5 12.1

...and observe the changes on the given heatingthermostat or Event monitor


2/ to FHEM.cfg write the following

define SendExtTemp notify DEV_999999:temperature.* { MaxFakeWallThermostat("MAX_111111", $EVTPART1)}


3/  to 99_myUtils.pm write the following (use myUtilsTemplate.pm as a source if you have not used it until now)

sub MaxFakeWallThermostat($$)
{
my ($heizung, $aktTemp)    = @_;
my $CULMAX     = $defs{$heizung}{LASTInputDev};
my $desiredTemp   = ReadingsVal($heizung, "desiredTemperature", undef);
my $windowOpenTemp = ReadingsVal($heizung, "windowOpenTemperature", undef);
my $lastTemp    = ReadingsVal($heizung, "LastExtTemperature", 0);
my $lastSet     = ReadingsTimestamp($heizung, "LastExtTemperature", 0);

if($desiredTemp && $windowOpenTemp &&
$desiredTemp != $windowOpenTemp &&
(time()-time_str2num($lastSet) >= 600 || abs($aktTemp-$lastTemp)>=0.2 ))
{
  Log 1, "set CULMAX0 fakeWT $heizung dzrdtmp $desiredTemp akttemp $aktTemp lasttmp $lastTemp wot is $windowOpenTemp lastsettime is $lastSet";
  readingsSingleUpdate($defs{$heizung}, "LastExtTemperature", $aktTemp, 0);
  fhem("set CULMAX0 fakeWT $heizung $desiredTemp $aktTemp");
}
else
{
  Log 1, "conditions not fulfilled hence no action $heizung dzrdtmp $desiredTemp akttemp $aktTemp lasttmp $lastTemp wot is $windowOpenTemp lastsettime is $lastSet";
}

}


This code is enriched with ELSE statement - I wanted to see when the IF condition was not fulfilled  (to see actual reason for nothing happening)

Hint: for testing/trying of changes you do to the above the Eventlog will not say much, you have to observe the logfile

Do not forget to Restart FHEM after each step.

Hope this helps.