From 7e9ac10f3af66668410fb01c2aa35c13d4ab2cda Mon Sep 17 00:00:00 2001 From: vuffiraa <> Date: Mon, 22 Apr 2019 20:04:06 +0000 Subject: [PATCH] 70_BOTVAC.pm: add weblink feature for statistics git-svn-id: https://svn.fhem.de/fhem/trunk@19243 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/70_BOTVAC.pm | 46 ++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/fhem/FHEM/70_BOTVAC.pm b/fhem/FHEM/70_BOTVAC.pm index d1739f093..7c59f7105 100755 --- a/fhem/FHEM/70_BOTVAC.pm +++ b/fhem/FHEM/70_BOTVAC.pm @@ -216,7 +216,7 @@ sub Get($@) { return "no such reading: $what"; } } elsif ( $what =~ /^(statistics)$/ ) { - if (defined( $hash->{helper}{MAPS} and @{$hash->{helper}{MAPS}} > 0)) { + if (defined($hash->{helper}{MAPS}) and @{$hash->{helper}{MAPS}} > 0) { return GetStatistics($hash); } else { return "maps for $what are not available yet"; @@ -1627,18 +1627,33 @@ sub GetMap() { } +sub ShowStatistics($) { + my ($name) = @_; + my $hash = $::defs{$name}; + + return "maps for statistics are not available yet" + if (!defined($hash->{helper}{MAPS}) or @{$hash->{helper}{MAPS}} == 0); + + return GetStatistics($hash); +} + sub GetStatistics($) { my($hash) = @_; my $name = $hash->{NAME}; my $mapcount = @{$hash->{helper}{MAPS}}; + my $model = ReadingsVal($name, "model", ""); my $ret = ""; $ret .= ''; - $ret .= ''; - $ret .= ''; + $ret .= ''; + $ret .= '
'; $ret .= ''; $ret .= ''; - $ret .= ''; + $ret .= ''; $ret .= ' '; $ret .= ' '; $ret .= ' '; @@ -1651,7 +1666,7 @@ sub GetStatistics($) { $ret .= ' '; $ret .= ' '; $ret .= ' '; - $ret .= ''; + $ret .= ''; $ret .= ' '; $ret .= ' '; $ret .= ' '; @@ -1665,7 +1680,7 @@ sub GetStatistics($) { $ret .= ' '; $ret .= ' '; $ret .= ' '; - $ret .= ''; + $ret .= ''; $ret .= ' '; $ret .= ' '; $ret .= ' '; @@ -1687,7 +1702,7 @@ sub GetStatistics($) { my $dc = $$map->{run_charge_at_start}-$$map->{run_charge_at_end}; my $expa = int($$map->{cleaned_area}*100/$dc+.5) if ($dc > 0); my $expt = int($dt*100/$dc/60+.5) if ($dc > 0); - $ret .= ''; + $ret .= ''; $ret .= ' '; # Map No. $ret .= ' '; # Expected Area $ret .= ' '; # Expected Time @@ -1706,12 +1721,17 @@ sub GetStatistics($) { } $ret .= '
Report: '.ReadingsVal($name,"name","name").', '.InternalVal($name,"VENDOR","VENDOR").', '.ReadingsVal($name,"model","model").'
MapExpectedMapStatusDateTime
No.AreaTimeFreq.During
qmmin
'.($i+1).''.($expa>0?$expa:0).''.($expt>0?$expt:0).'
'; $ret .= "

Manufacturer Specification:
"; - $ret .= "Neato Botvac D3 Connected, up to 60 qm
"; - $ret .= "Neato Botvac D4 Connected, up to 75 qm
"; - $ret .= "Neato Botvac D5 Connected, up to 90 qm
"; - $ret .= "Neato Botvac D6/D7 Connected, up to 120 qm
"; - $ret .= "Vorwerk VR200, battery 84 Wh, eco (90 min, 120 qm, power 50 W), turbo (60 min, 90 qm, power 70 W)
"; - $ret .= "Vorwerk VR220(VR300), battery 84 Wh, eco (90 min, 120 qm, power 65 W), turbo (60 min, 90 qm, power 85 W)
"; + + my $specification = "$model specification unknown"; + $specification = "Neato Botvac Connected, eco (120 min), turbo (90 min, power 40 W)
" if ($model eq "BotVacConnected"); + $specification = "Neato Botvac D3 Connected, up to 60 min
" if ($model eq "BotVacD3Connected"); + $specification = "Neato Botvac D4 Connected, up to 75 min
" if ($model eq "BotVacD4Connected"); + $specification = "Neato Botvac D5 Connected, up to 90 min
" if ($model eq "BotVacD5Connected"); + $specification = "Neato Botvac D6/D7 Connected, up to 120 min
" if ($model eq "BotVacD6Connected" or $model eq "BotVacD6Connected"); + $specification = "Vorwerk VR200, battery 84 Wh, eco (90 min, 120 qm, power 50 W), turbo (60 min, 90 qm, power 70 W)
" if ($model eq "VR200"); + $specification = "Vorwerk VR220(VR300), battery 84 Wh, eco (90 min, 120 qm, power 65 W), turbo (60 min, 90 qm, power 85 W)
" if ($model eq "VR220"); + + $ret .= $specification; $ret .= ''; return $ret;