my($on)=@_;
$on=($on ? 1 : 0);
- login();
- my $change=simple("https://uzivatel.gtsnovera.cz/cgi-bin/fup.pl",
- 'action.'.($on ? 'setManual' : 'unsetManual').'=1',
- )->decoded_content() or die "change: ".$on;
+ my $try=0;
+ my $change;
+ do {
+ print "!" if $try;
+ die "Looping to login" if $try++>0x10;
+ login();
+ $change=simple("https://uzivatel.gtsnovera.cz/cgi-bin/fup.pl",
+ 'action.'.($on ? 'setManual' : 'unsetManual').'=1',
+ )->decoded_content() or die "change: ".$on;
+ } while $change=~m{No authentication cookie was sent.};
my $is_on =($change=~m{\bFUP active\b});
my $is_off=($change=~m{\bFUP not active\b});
$is_on==!$is_off or die $change."\nInvalid change state";
$tx_last=$tx;
push @history,$on_now;
print $on_now;
- my $stable;
$on=change(1) if $on==0 && history(1,$STABILIZE_ON);
$on=change(0) if $on==1 && history(0,$STABILIZE_OFF);
sleep $SECS;