Thanks guys!
After reading this, it helped me adapt the code for my 2 heather pumps (downstairs & upstairs).
Made pump assignement by userattr for each radiator valve:
attr MAX_Livingroom_Heating1 userattr down
The trail and error code for now:
Pump_Guard()
{
my $threshold_val = 25;
#Log 3, "Pump_Guard Threshold: $threshold_val...";
#Log 3, "checking Down-stairs ...";
my $valve = 0;
my $actual_down = ReadingsVal( "MAX_Pomp0_Heating", "state", "off");
my $disered_down = "off °C";
my @MAX_Down=devspec2array("userattr=down");
foreach(@MAX_Down) {
$valve=ReadingsVal( $_, "valveposition", "101" );
if ( $valve >= $threshold_val )
{
$disered_down = "on °C";
Log 3, "Heater: $_, Valve: $valve";
}
}
#Log 3, "Actual: $actual_down, Disered: $disered_down";
if ( $actual_down eq $disered_down )
{
#Log 3, "nothing to do!";
}
elsif ( $actual_down eq "off °C" )
{
Log 3, "Pomp0 is OFF switching ON";
fhem "set MAX_Pomp0_Heating desiredTemperature on";
} else
{
Log 3, "Pomp0 is ON switching OFF";
fhem "set MAX_Pomp0_Heating desiredTemperature off";
}
#Log 3, "checking Up-stairs...";
my $actual_up = ReadingsVal( "MAX_Pomp1_Heating", "state", "off");
my $disered_up = "off °C";
my @MAX_Up=devspec2array("userattr=up");
foreach(@MAX_Up) {
$valve=ReadingsVal( $_, "valveposition", "101" );
if ( $valve >= $threshold_val )
{
$disered_up = "on °C";
Log 3, "Heater: $_, Valve: $valve";
}
}
#Log 3, "Actual: $actual_up, Disered: $disered_up";
if ( $actual_up eq $disered_up )
{
#Log 3, "nothing to do!";
}
elsif ( $actual_up eq "off °C" )
{
Log 3, "Pomp1 is OFF switching ON";
fhem "set MAX_Pomp1_Heating desiredTemperature on";
} else
{
Log 3, "Pomp1 is ON switching OFF";
fhem "set MAX_Pomp1_Heating desiredTemperature off";
}
}
Maybe over-acting, demand trigger each 15 seconds:
define Pump_guard_cron at +*00:00:15 {Pump_Guard () }
There must be a better way, right?
Next try decently visualise the MAX on-off values in SVG.
Suggestions welcome.