FHEM Forum

FHEM => English Corner => Thema gestartet von: kroonen am 06 Juni 2020, 22:11:39

Titel: maxfakewallthermostat question
Beitrag von: kroonen am 06 Juni 2020, 22:11:39
medling

Hi,

I have an max thermostat basic, that works, but I want to use an other temperature sensor for it.
So i decided to use my oregon temperature sensor (slaapkamertemp)


Slaapkamertemp

     2020-06-06 19:54:19   humidity        36.00
     2020-06-06 19:54:19   temperature     19.40
     2020-06-06 19:54:19   temperatuur     19.4


the max thermostat basic is MAX_130261

This is in


##############################################
# $Id: myUtilsTemplate.pm 21509 2020-03-25 11:20:51Z rudolfkoenig $
#
# Save this file as 99_myUtils.pm, and create your own functions in the new
# file. They are then available in every Perl expression.

package main;

use strict;
use warnings;

sub
myUtils_Initialize($$)
{
  my ($hash) = @_;
}

# Enter you functions below _this_ line.

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 3, "set $CULMAX fakeWT $heizung $desiredTemp $aktTemp";
  readingsSingleUpdate($defs{$heizung}, "LastExtTemperature", $aktTemp, 0);
  fhem("set $CULMAX fakeWT $heizung $desiredTemp $aktTemp");
}
}


and did a notify


define SendExtTemp notify Slaapkamertemp:temperatuur.* {\
MaxFakeWallThermostat("MAX_130261", $EVTPART1);;\
}


I ony get an error

2020.06.06 22:06:17 3: CM_Parse, unhandled message WakeUp from MAX_130261 to MAX_111111, groupid : 0 , payload : 03 - ignoring !
2020.06.06 22:06:17 3: CULMAX, target device 111111 has no name !
Titel: Antw:maxfakewallthermostat question
Beitrag von: Wzut am 07 Juni 2020, 08:33:50
please post a list of your CULMAX device
Titel: Antw:maxfakewallthermostat question
Beitrag von: kroonen am 07 Juni 2020, 09:53:03
Hi

Did again so enabled the sendext again. And now it works. I think maybe issue with credits yesterday.

regards Richard
Titel: Antw:maxfakewallthermostat question
Beitrag von: Wzut am 07 Juni 2020, 14:41:42
hmm, strange. If the credits are low you will have other lines in the log.
This two lines are not real errors , more like information. Do you have more than one CUL device ?


other point in your 99_myUtils :
my $CULMAX     = $defs{$heizung}{LASTInputDev};
this is a little bit unlucky because the Internal LASTInputDev sometimes could be empty.

IMHO saver

sub MaxFakeWallThermostat {
    my $heizung  = shift;
    my $aktTemp  = shift;
    my $CULMAX   = (exists($defs{$heizung}{IODev}->{NAME})) ? $defs{$heizung}{IODev}->{NAME} : '';
    my $desiredTemp    = ReadingsNum($heizung, 'desiredTemperature', 0);
    my $windowOpenTemp = ReadingsNum($heizung, 'windowOpenTemperature', 0);

    return if (!$CULMAX || !$desiredTemp && !$windowOpenTemp);

    my $lastTemp       = ReadingsNum($heizung, 'LastExtTemperature', 0);
    my $lastSet        = ReadingsAge($heizung, 'LastExtTemperature', 0);

    if ((($desiredTemp != $windowOpenTemp) && ($lastSet > 599)) || (abs($aktTemp-$lastTemp) > 0.1)) {
Log3($CULMAX, 3, "$CULMAX, set fakeWT $heizung $desiredTemp $aktTemp");
readingsSingleUpdate($defs{$heizung}, 'LastExtTemperature', $aktTemp, 0);
my $ret = CommandSet(undef, "$CULMAX fakeWT $heizung $desiredTemp $aktTemp");
Log3($CULMAX, 2, "$CULMAX, error : $ret") if ($ret);
    }
    return;
}



Titel: Antw:maxfakewallthermostat question
Beitrag von: kroonen am 08 Juni 2020, 22:28:35
Hi,

Thnx for the update for the 99_myutils (maybe also the fhem max wiki need to be change here)

I'm also testing the culfw on the esp 8266 with an cc1101 soldered on, from Manfred, and looks very good already (so maybe this gives some of my errors;-)

https://github.com/Man-fred/culfw-esp8266
Titel: Antw:maxfakewallthermostat question
Beitrag von: kroonen am 09 Juni 2020, 22:26:23
still one question

a fakewallthermostat is this limited to 1, because of one 11111 address?

I have more temperature sensors and more cul max basic radiatorthermostats

regards Richard
Titel: Antw:maxfakewallthermostat question
Beitrag von: Wzut am 10 Juni 2020, 06:45:00
Did you read https://forum.fhem.de/index.php/topic,106258.0.html ?
IMHO the problems with fakeWT are the same as with fakeSC.
As an alternative to fakeSC, I created the new vitrualShutterContact device. Its advantage is that you can define as many of them as you want.
In some cases there is already support for a virtualWallThermostat in the code from 10_MAX and 14_CUL_MAX.
First attempts with it are very promising.
I think I'll have that done by autumn. Until then you have to get along with the only one fakeWT. 
Titel: Antw:maxfakewallthermostat question
Beitrag von: kroonen am 10 Juni 2020, 12:17:11
Thnx for the answer.

I'm looking forward to test it.

Good job already with the max module.