From 024b6610367a95946b734ecd590c59def2846da1 Mon Sep 17 00:00:00 2001 From: jmike <> Date: Fri, 21 Apr 2017 13:47:08 +0000 Subject: [PATCH] 98_TRAFFIC: v1.3.1 attribute changed, buttons to store map settings git-svn-id: https://svn.fhem.de/fhem/trunk@14059 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/98_TRAFFIC.pm | 65 ++++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 9204bbecd..6d61cacfd 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 98_TRAFFIC: v1.3.1, attribute change, map setting save buttons - feature: 98_TRAFFIC: v1.3, map customizable, enhancements, fix JSON error - change: 76_SMAInverter: changed SMA_logon, enhanced inverter Types - feature: 98_DLNARenderer: support $readingFnAttributes diff --git a/fhem/FHEM/98_TRAFFIC.pm b/fhem/FHEM/98_TRAFFIC.pm index c77f2819f..17f919cb4 100644 --- a/fhem/FHEM/98_TRAFFIC.pm +++ b/fhem/FHEM/98_TRAFFIC.pm @@ -40,10 +40,18 @@ # 2016-12-15 adding reverseWaypoints attribute, adding weblink with auto create route via gmaps on verbose 5 # 2017-04-21 reduced log entries if verbose is not set, fixed JSON error, Map available through FHEM-Web-toggle, and direct link # Map https, with APIKey, Traffic & customizable, new attributes GoogleMapsStyle,GoogleMapsSize,GoogleMapsLocation,GoogleMapsStroke,GoogleMapsDisableUI +# 2017-04-21 added buttons to save current map settings, renamed attribute GoogleMapsLocation to GoogleMapsCenter # ############################################################################## +#next: +# +# typo on update your map +# optional map zoom +# +# + package main; use strict; @@ -68,7 +76,7 @@ sub TRAFFIC_GetUpdate($); my %TRcmds = ( 'update' => 'noArg', ); -my $TRVersion = '1.3'; +my $TRVersion = '1.3.1'; sub TRAFFIC_Initialize($){ @@ -80,7 +88,7 @@ sub TRAFFIC_Initialize($){ $hash->{AttrFn} = "TRAFFIC_Attr"; $hash->{AttrList} = - "disable:0,1 start_address end_address raw_data:0,1 language waypoints returnWaypoints stateReading outputReadings travelMode:driving,walking,bicycling,transit includeReturn:0,1 updateSchedule GoogleMapsStyle:default,silver,dark,night GoogleMapsSize GoogleMapsLocation GoogleMapsStroke GoogleMapsTrafficLayer:0,1 GoogleMapsDisableUI:0,1 " . + "disable:0,1 start_address end_address raw_data:0,1 language waypoints returnWaypoints stateReading outputReadings travelMode:driving,walking,bicycling,transit includeReturn:0,1 updateSchedule GoogleMapsStyle:default,silver,dark,night GoogleMapsSize GoogleMapsZoom GoogleMapsCenter GoogleMapsStroke GoogleMapsTrafficLayer:0,1 GoogleMapsDisableUI:0,1 " . $readingFnAttributes; $data{FWEXT}{"/TRAFFIC"}{FUNC} = "TRAFFIC"; @@ -165,6 +173,26 @@ sub TRAFFIC_fhemwebFn($$$$) { if (ReadingsVal($device,".map","off") eq "on") { $web .= TRAFFIC_GetMap($device); $web .= TRAFFIC_weblink($device); + + $web .= "
"; + + $web .= ""; } return $web; } @@ -176,10 +204,10 @@ sub TRAFFIC_GetMap($@){ my $debugPoly = $hash->{helper}{'Poly'}; my $returnDebugPoly = $hash->{helper}{'return_Poly'}; - my $GoogleMapsLocation = AttrVal($name, "GoogleMapsLocation", $hash->{helper}{'GoogleMapsLocation'}); + my $GoogleMapsCenter = AttrVal($name, "GoogleMapsCenter", $hash->{helper}{'GoogleMapsCenter'}); - if(!$debugPoly || !$GoogleMapsLocation){ - return "