Notdienst Apotheke

Begonnen von Vaddi, 24 April 2018, 01:39:35

Vorheriges Thema - Nächstes Thema

yersinia

Danke an alle für die Tipps und Optimierungen. :)
Zitat von: JoWiemann am 18 Januar 2023, 20:38:28Bei Flächengemeinden ist die Straße schon wichtig. Da sind dann einige Kilometer relevant.
Der Suchlink akzeptiert auch Koordinaten.  ;)

Ich würde noch reread hinzufügen und das interval auf täglich (43200s) mit aligntime 09:03 hinzufügen (die Notdienstzeiten sind imho immer von 9Uhr bis 9uhr).

Hier mein Beispiel für das erweiterte Template aponet_pharmacy_emergency_service_germany:
defmod NotApo HTTPMOD https://www.aponet.de/apotheke/notdienstsuche?tx_aponetpharmacy_search[action]=result&tx_aponetpharmacy_search[controller]=Search&tx_aponetpharmacy_search[search][plzort]=%%PLZ%%&tx_aponetpharmacy_search[search][date]=&tx_aponetpharmacy_search[search][street]=%%STREET%%&tx_aponetpharmacy_search[search][radius]=%%RADIUS%%&tx_aponetpharmacy_search[search][lat]=%%LAT%%&tx_aponetpharmacy_search[search][lng]=%%LONG%%&type=1982 43200
attr NotApo alignTime 09:03
attr NotApo model aponet_pharmacy_emergency_service_germany
attr NotApo reading01Name NotName
attr NotApo reading01Regex class="name">(.*?)<\/h4>
attr NotApo reading02Name NotdienstVon
attr NotApo reading02Regex Notdienst vom(.*?Uhr)
attr NotApo reading03Name NotdienstBis
attr NotApo reading03Regex Notdienst vom.*?Uhr bis(.*?Uhr)
attr NotApo reading04Name NotdienstTelefon
attr NotApo reading04Regex href="tel:(.*?)"
attr NotApo reading05Name NotdienstAdresse
attr NotApo reading05Regex (?s)strasse">([\sa-zA-Z0-9äöüÄÖÜß.&#;;;;_-]+).*?plz">(\d+).*?ort">([\sa-zA-Z0-9äöüÄÖÜß.&#;;;;_-]+)<
attr NotApo reading06Name DatumVon
attr NotApo reading06Regex Notdienst vom ([ 0-9.:&#;;;;_-]+)
attr NotApo replacement01Mode text
attr NotApo replacement01Regex %%PLZ%%
attr NotApo replacement01Value %20
attr NotApo replacement02Mode text
attr NotApo replacement02Regex %%RADIUS%%
attr NotApo replacement02Value 10
attr NotApo replacement03Mode text
attr NotApo replacement03Regex %%STREET%%
attr NotApo replacement03Value %20
attr NotApo replacement04Mode expression
attr NotApo replacement04Regex %%LAT%%
attr NotApo replacement04Value AttrVal("global","latitude","")
attr NotApo replacement05Mode expression
attr NotApo replacement05Regex %%LONG%%
attr NotApo replacement05Value AttrVal("global","longitude","")
attr NotApo room CoViD-19
attr NotApo stateFormat { my $ret .= "<div style=\"display:table;;width:100%;;\">";; #table\
$ret .= "<div style=\"display:table-row;;width:100%;;\">";; #row\
$ret .= "<div style=\"display:table-cell;;padding:3pt;;width:50%;;text-align:left;;\">";; #cell\
$ret .= "<a href=\"".ReadingsVal($name,"OSMLink","https:\/\/www.osm.org");;\
$ret .= "\" rel=\"noopener noreferrer\" target=\"_blank\" style=\"font-weight:bold;;\">".ReadingsVal($name,"NotName","?")."</a><br \/>";;\
$ret .= ReadingsVal($name,"NotdienstAdresse-1","")."<br /\>";;\
$ret .= ReadingsVal($name,"NotdienstAdresse-2","")."&nbsp;;".ReadingsVal($name,"NotdienstAdresse-3","");;\
$ret .= "</div>";; #/cell\
$ret .= "<div style=\"display:table-cell;;width:50%;;text-align:left;;\">";; #cell\
my $numberlink = ReadingsVal($name,"NotdienstTelefon","");;\
$numberlink =~ s/\s+//g;;\
$ret .= "Tel.: <a href=\"tel:+49".substr($numberlink, 1)."\">".ReadingsVal($name,"NotdienstTelefon","")."</a>";;\
$ret .= "</div>";; #/cell\
$ret .= "</div>";; #/row\
$ret .= "<div style=\"display:table-row;;width:100%;;\">";; #row\
$ret .= "<div style=\"display:table-cell;;padding:3pt;;width:50%;;text-align:left;;\">";; #cell\
$ret .= "Von ".ReadingsVal($name,"NotdienstVon","");;\
$ret .= "</div>";; #/cell\
$ret .= "<div style=\"display:table-cell;;width:50%;;text-align:left;;\">";; #cell\
$ret .= "Bis ".ReadingsVal($name,"NotdienstBis","");;\
$ret .= "</div>";; #/cell\
$ret .= "</div>";; #/row\
$ret .= "</div>";; #/table\
return $ret;;\
}
attr NotApo timeout 30
attr NotApo userReadings OSMLink { my $ret = "https:\/\/www.openstreetmap.org\/?";;\
$ret .= "query=".ReadingsVal($name,"NotdienstAdresse-1","0");;\
$ret .= ",%20".ReadingsVal($name,"NotdienstAdresse-2","0");;\
$ret .= "%20".ReadingsVal($name,"NotdienstAdresse-3","0");;\
return $ret;; }
attr NotApo webCmd reread

Da es keine Koordinaten der Apothekenadresse gibt, kann zumindest ich kein Routing bilden - aber man kann OSM nach der Adresse anfragen.

Die Koordinaten kommen aus dem global Device:
attr NotApo replacement04Mode expression
attr NotApo replacement04Regex %%LAT%%
attr NotApo replacement04Value AttrVal("global","latitude","")
attr NotApo replacement05Mode expression
attr NotApo replacement05Regex %%LONG%%
attr NotApo replacement05Value AttrVal("global","longitude","")


Alternativ kann man auch die Adresse angeben (radius ist mit 10(km) vorbelegt):
attr NotApo replacement01Mode text
attr NotApo replacement01Regex %%PLZ%%
attr NotApo replacement01Value %20
attr NotApo replacement02Mode text
attr NotApo replacement02Regex %%RADIUS%%
attr NotApo replacement02Value 10
attr NotApo replacement03Mode text
attr NotApo replacement03Regex %%STREET%%
attr NotApo replacement03Value %20

Anstelle der %20 (= Leerzeichen) einfach für PLZ die PLZ mit optionaler Stadt (12345 Musterstadt) und Straße inkl. bedarfsweise Hausnummer angeben (Musterweg 25).
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

JoWiemann

Hallo,

ich habe jetzt eine Vorschlag für das attrTemplate:


#Pharmacy emergency service Germany - aponet, Forum https://forum.fhem.de/index.php/topic,87234.0.html
name:aponet_pharmacy_emergency_service_germany
filter:TYPE=HTTPMOD
desc: Gets the current emergency service of a pharmacy closeby your postal code from aponet.de<br />Define an empty HTTPMOD device with <br />define DEVICE HTTPMOD none 0<br /><a href="https://forum.fhem.de/index.php/topic,87234.0.html">Source: Forum</a><br />
order:DIV02
par:SEARCHZIPCODE;Zip code of the city you want to search around;
par:SEARCHCITY;city you want to search around;
par:SEARCHSTREET;Street in the city you want to search around;
par:SEARCHNUMBER;Building nummber you want to search around;
par:SEARCHRADIUS;Radius in km for the search;
par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE","room","HTTPMOD" )}
defmod DEVICE HTTPMOD https://www.aponet.de/apotheke/notdienstsuche?tx_aponetpharmacy_search[action]=result&tx_aponetpharmacy_search[controller]=Search&tx_aponetpharmacy_search[search][plzort]=SEARCHZIPCODE%20SEARCHCITY&tx_aponetpharmacy_search[search][date]=&tx_aponetpharmacy_search[search][street]=SEARCHSTREET%20SEARCHNUMBER&tx_aponetpharmacy_search[search][radius]=SEARCHRADIUS&tx_aponetpharmacy_search[search][lat]=&tx_aponetpharmacy_search[search][lng]=&type=1982 0
attr DEVICE reading01Name NotName
attr DEVICE reading01Regex class="name">(.*?)<\/h4>
attr DEVICE reading02Name NotdienstVon
attr DEVICE reading02Regex Notdienst vom(.*?Uhr)
attr DEVICE reading03Name NotdienstBis
attr DEVICE reading03Regex Notdienst vom.*?Uhr bis(.*?Uhr)
attr DEVICE reading04Name NotdienstTelefon
attr DEVICE reading04Regex href="tel:(.*?)"
attr DEVICE reading05Name NotdienstAdresse
attr DEVICE reading05Regex (?s)strasse">([\sa-zA-Z0-9äöüÃ,,ÖÜß.&#;;_-]+).*?plz">(\d+).*?ort">([\sa-zA-Z0-9äöüÃ,,ÖÜß.&#;;_-]+)<
attr DEVICE reading06Name DatumVon
attr DEVICE reading06Regex Notdienst vom ([ 0-9.:&#;;_-]+)
attr DEVICE reading07Name NotdienstEntfernung
attr DEVICE reading07Regex Entfernung:.<\/span>(\d{1,}\.?\d?\d?\skm)
attr DEVICE reading08Name GoogleLink
attr DEVICE reading08Regex href="(http:\/\/maps\.google\.de\/maps.*?)">Google Navigation
attr DEVICE stateFormat {my $Apo = ReadingsVal("DEVICE", "NotName", "") . " (" . ReadingsVal("DEVICE", "NotdienstTelefon", "") . ") ";\
$Apo .=   ReadingsVal("DEVICE", "NotdienstAdresse-1", "") . " in ";\
$Apo .=   ReadingsVal("DEVICE", "NotdienstAdresse-2", "") . " " . ReadingsVal("DEVICE", "NotdienstAdresse-3", "");\
my $oLink = ReadingsVal("DEVICE", "GoogleLink", "");\
my $mLink .= "<html><a href='https://www.google.de/maps/dir/?api=1&origin=";\
$mLink .= "SEARCHSTREET" . "+" . "SEARCHNUMBER" . ",+" . "SEARCHZIPCODE" . "+" . "SEARCHCITY" . "&destination=" . substr($oLink,index($oLink, "?", 0) + 3);\
$mLink .= "&travelmode=driving/' target='_blank'>$Apo</a></html>";\
return $mLink;}
attr DEVICE model aponet_pharmacy_emergency_service_germany
setreading DEVICE attrTemplateVersion 20201202


Es wird nun eine stateFormat geniert, das für "Apotheke, Telefonnummer und Adresse" ein GoogleMaps Link hinterlegt.

Vielleicht findet die Änderung ja Zustimmung.

Grüße Jörg
Jörg Wiemann

Slave: RPi B+ mit 512 MB, COC (868 MHz), CUL V3 (433.92MHz SlowRF); FHEMduino, Aktuelles FHEM

Master: CubieTruck; Debian; Aktuelles FHEM

caldir65

Moin

Zitat von: yersinia am 19 Januar 2023, 09:22:47
Ich würde noch reread hinzufügen und das interval auf täglich (43200s) mit aligntime 09:03 hinzufügen (die Notdienstzeiten sind imho immer von 9Uhr bis 9uhr).

Bei uns steht immer von/bis 8:30 Uhr - da sollte man die Abfrage vlt. etwas flexibler gestalten ...

Gruß, Christoph
Alte Techniker-Regel: "kaum macht man es richtig, funktioniert es auch"
------
Dell Wyse5070 ThinClient 16GBRam, 64GB SSD, Lubuntu 22.04LTS, fhem (aktuell), debmatic, Homematic-Devs, ConBee II und deConz, viele Shellys, Rademacher, NextCloud-Anbindung, FullyKioskBrowser+FUIP uvm.

yersinia

Zitat von: caldir65 am 19 Januar 2023, 10:48:19Bei uns steht immer von/bis 8:30 Uhr - da sollte man die Abfrage vlt. etwas flexibler gestalten ...
Interessant. Dann setz doch das Attribut (!) aligntime auf 8:33...
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

OdfFhem

Am Wochenende habe ich mich ein wenig näher mit dem "offiziellen Gesundheitsportal der deutschen ApothekerInnen" beschäftigt und das vorhandene Template u.a. an die neuen Erkenntnisse angepasst.

- zwei Parameter zur Festlegung der "Basis" werden als Attribut abgelegt und bei wiederholter Anwendung des Templates ausgelesen
- alignTime und Interval werden ebenso wie room bei wiederholter Anwendung des Templates ausgelesen
- das bislang existierende FHEM-Device wird resettet ... Reading und Attribute
- FHEM-Device führt zwei Anfragen durch ... eine für die ständig wechselnden Daten (neu) ... eine für den Notdienst-Zeitraum (alt, aber jetzt nach Datum und Zeit getrennt)
- generiert je ein Karten- sowie Routing-Reading für OSM bzw. Google
- Statusanzeige enthält "viele" Informationen, aber trifft im Zweifel nicht  jeden Geschmack


#Pharmacy emergency service Germany - aponet, Forum https://forum.fhem.de/index.php/topic,87234.0.html
name:aponet_pharmacy_emergency_service_germany
filter:TYPE=HTTPMOD
desc: Gets the current emergency service of a pharmacy closeby your postal code from aponet.de<br />Define an empty HTTPMOD device with <br />define DEVICE HTTPMOD none 0<br /><a href="https://forum.fhem.de/index.php/topic,87234.0.html">Source: Forum</a><br />
order:DIV02
par:SEARCHZIPCODE;Zip code of the city you want to search around; {AttrVal("DEVICE","parSearchZipCode",undef)}
par:SEARCHRADIUS;Radius in km for the search; {AttrVal("DEVICE","parSearchRadius",undef)}
par:ALIGNTIME;Aligns each periodic read request to this base time, defaults to 09:15; {AttrVal("DEVICE","alignTime","09:15")}
par:INTERVAL;Repeats the read request every interval seconds, defaults to 86400; {InternalVal("DEVICE","Interval",86400)}
par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE","room","HTTPMOD")}
defmod DEVICE HTTPMOD none INTERVAL
deletereading -q DEVICE .*
deleteAttr DEVICE .*
attr DEVICE userattr parSearchRadius parSearchZipCode
attr DEVICE parSearchRadius SEARCHRADIUS
attr DEVICE parSearchZipCode SEARCHZIPCODE
attr DEVICE get100Name Notdienst1
attr DEVICE get100Poll 1
attr DEVICE get100URL %%base_url%%1982
attr DEVICE reading102Name NotdienstVonDatum
attr DEVICE reading102OExpr $val =~ s/(.*) um (.*) Uhr/$1/;; return $val;;
attr DEVICE reading102Regex Notdienst vom(.*?Uhr)
attr DEVICE reading103Name NotdienstVonZeit
attr DEVICE reading103OExpr $val =~ s/(.*) um (.*) Uhr/$2/;; return $val;;
attr DEVICE reading103Regex Notdienst vom(.*?Uhr)
attr DEVICE reading105Name NotdienstBisDatum
attr DEVICE reading105OExpr $val =~ s/(.*) um (.*) Uhr/$1/;; return $val;;
attr DEVICE reading105Regex Notdienst vom.*?Uhr bis(.*?Uhr)
attr DEVICE reading106Name NotdienstBisZeit
attr DEVICE reading106OExpr $val =~ s/(.*) um (.*) Uhr/$2/;; return $val;;
attr DEVICE reading106Regex Notdienst vom.*?Uhr bis(.*?Uhr)
attr DEVICE get200ExtractAllJSON 0
attr DEVICE get200Name Notdienst2
attr DEVICE get200Poll 1
attr DEVICE get200URL %%base_url%%1981
attr DEVICE reading201JSON features_01_properties_name
attr DEVICE reading201Name NotdienstName
attr DEVICE reading202JSON features_01_properties_strasse
attr DEVICE reading202Name NotdienstStrasse
attr DEVICE reading203JSON features_01_properties_plz
attr DEVICE reading203Name NotdienstPlz
attr DEVICE reading204JSON features_01_properties_ort
attr DEVICE reading204Name NotdienstOrt
attr DEVICE reading205JSON features_01_properties_telefon
attr DEVICE reading205Name NotdienstTelefon
attr DEVICE reading206JSON features_01_properties_fax
attr DEVICE reading206Name NotdienstTelefax
attr DEVICE reading207JSON features_01_geometry_coordinates_0
attr DEVICE reading207Name NotdienstLaengengrad
attr DEVICE reading208JSON features_01_geometry_coordinates_1
attr DEVICE reading208Name NotdienstBreitengrad
attr DEVICE reading209JSON features_01_properties_distanz
attr DEVICE reading209Name NotdienstEntfernung
attr DEVICE reading210JSON features_01_properties_email
attr DEVICE reading210Name NotdienstEmail
attr DEVICE readingMaxAge 60
attr DEVICE readingMaxAgeReplacementMode delete
attr DEVICE replacement01Mode text
attr DEVICE replacement01Regex %%base_url%%
attr DEVICE replacement01Value https://www.aponet.de/apotheke/notdienstsuche?tx_aponetpharmacy_search[action]=result&tx_aponetpharmacy_search[controller]=Search&tx_aponetpharmacy_search[search][plzort]=SEARCHZIPCODE&tx_aponetpharmacy_search[search][date]=&tx_aponetpharmacy_search[search][street]=&tx_aponetpharmacy_search[search][radius]=SEARCHRADIUS&tx_aponetpharmacy_search[search][lat]=&tx_aponetpharmacy_search[search][lng]=&type=
attr DEVICE alignTime ALIGNTIME
attr DEVICE room WHICHROOM
attr DEVICE showError 1
attr DEVICE webCmd reread
attr DEVICE stateFormat NotdienstName, NotdienstStrasse in NotdienstPlz NotdienstOrt\
<br>\
NotdienstVonDatum, NotdienstVonZeit - NotdienstBisDatum, NotdienstBisZeit ... Tel.: NotdienstTelefon\
<br>\
NotdienstGOOGLEmap NotdienstGOOGLEroute NotdienstEntfernung km NotdienstOSMmap NotdienstOSMroute
attr DEVICE userReadings \
  NotdienstGOOGLEmap:(NotdienstBreitengrad|NotdienstLaengengrad):.* {\
    my $link = "https:\/\/www.google.com\/maps\/search";;\
    $link .= "\/".ReadingsVal($name,"NotdienstBreitengrad","0");;\
    $link .= ",".ReadingsVal($name,"NotdienstLaengengrad","0");;\
    return "<html><a href='".$link."' target='_blank'>Google-Karte</a></html>";;\
  },\
  NotdienstGOOGLEroute:(NotdienstBreitengrad|NotdienstLaengengrad):.* {\
    my $link = "https:\/\/www.google.com\/maps\/dir";;\
    $link .= "\/".AttrVal("global","latitude","0");;\
    $link .= ",".AttrVal("global","longitude","0");;\
    $link .= "\/".ReadingsVal($name,"NotdienstBreitengrad","0");;\
    $link .= ",".ReadingsVal($name,"NotdienstLaengengrad","0");;\
    return "<html><a href='".$link."' target='_blank'>Google-Route</a></html>";;\
  },\
  NotdienstOSMmap:(NotdienstBreitengrad|NotdienstLaengengrad):.* { \
    my $link = "https:\/\/www.openstreetmap.org\/?";;\
    $link .= "mlat=".ReadingsVal($name,"NotdienstBreitengrad","0");;\
    $link .= "&mlon=".ReadingsVal($name,"NotdienstLaengengrad","0");;\
    $link .= "#map=18";;\
    $link .= "\/".ReadingsVal($name,"NotdienstBreitengrad","0");;\
    $link .= "\/".ReadingsVal($name,"NotdienstLaengengrad","0");;\
    return "<html><a href='".$link."' target='_blank'>OSM-Karte</a></html>";;\
  },\
  NotdienstOSMroute:(NotdienstBreitengrad|NotdienstLaengengrad):.* { \
    my $link = "https:\/\/www.openstreetmap.org\/directions?";;\
    $link .= "engine=graphhopper_car";;\
    $link .= "&from=".AttrVal("global","latitude","0");;\
    $link .= "%2C".AttrVal("global","longitude","0");;\
    $link .= "&to=".ReadingsVal($name,"NotdienstBreitengrad","0");;\
    $link .= "%2C".ReadingsVal($name,"NotdienstLaengengrad","0");;\
    return "<html><a href='".$link."' target='_blank'>OSM-Route</a></html>";;\
  }
attr DEVICE model aponet_pharmacy_emergency_service_germany
setreading DEVICE attrTemplateVersion 20230123

binford6000

#125
Moin Zusammen,
funktioniert bei euch noch die Abfrage der Notdienst Apotheke über aponet?
Ich habe sowohl das attrTemplate von Jörg als auch von OldFhem getestet. Jeweils ohne das Readings erstellt wurden.

DatumVon 10.03.20232023-03-10 08:33:00

VG Sebastian

caldir65

Moin,

bei mir kommt auch nichts mehr seit dem 10.03.2023 ... bzw. der letzte Eintrag ist vom 10.03.

Gruß, Christoph
Alte Techniker-Regel: "kaum macht man es richtig, funktioniert es auch"
------
Dell Wyse5070 ThinClient 16GBRam, 64GB SSD, Lubuntu 22.04LTS, fhem (aktuell), debmatic, Homematic-Devs, ConBee II und deConz, viele Shellys, Rademacher, NextCloud-Anbindung, FullyKioskBrowser+FUIP uvm.

DeeSPe

Das Template für den Notdienst der Apotheken muss komplett überarbeitet werden denn die abgefragte URL liefert nun JSON zurück und das klappt mit dem bisherigen Template nicht mehr.

Gruß
Dan
MAINTAINER: 22_HOMEMODE, 98_Hyperion, 98_FileLogConvert, 98_serviced

Als kleine Unterstützung für meine Programmierungen könnt ihr mir gerne einen Kaffee spendieren: https://buymeacoff.ee/DeeSPe

binford6000

Zitat von: DeeSPe am 22 März 2023, 09:42:21Das Template für den Notdienst der Apotheken muss komplett überarbeitet werden denn die abgefragte URL liefert nun JSON zurück und das klappt mit dem bisherigen Template nicht mehr.

Gruß
Dan
Hi Dan,
das Template von OldFhem (mit JSON) hat ja immerhin bis zum 10.03. funktioniert. Anscheinend gabs da wieder eine Änderung...
VG Sebastian

Wolle02

Wenn ich das Attribut 'ExtractAllJSON' auf 1 setze, dann kommen wieder Daten rein. Die vielen Readings kann man mit dem Attribut 'ExtractAllJSONFilter' eingrenzen.
Jetzt müsste man nur noch die Userreadings für die Links und das stateFormat anpassen. Vielleicht komme ich heute Abend dazu.

Wolle02

StateFormat habe ich jetzt bei mir so umgestellt:

<hr />results_apotheken_apotheke_01_name, results_apotheken_apotheke_01_strasse in results_apotheken_apotheke_01_plz results_apotheken_apotheke_01_ort, Tel: results_apotheken_apotheke_01_telefon, von results_apotheken_apotheke_01_startdatum, results_apotheken_apotheke_01_startzeit Uhr bis results_apotheken_apotheke_01_enddatum, results_apotheken_apotheke_01_endzeit Uhr<br><a href="GoogleLink_UR" target="_blank">Map</a><hr />
Die Userreadings für die Links lauten bei mir jetzt so:

OSMLink_UR { my $ret = "https:\/\/www.openstreetmap.org\/?";
$ret .= "mlat=".ReadingsVal($name,"results_apotheken_apotheke_01_latitude","0");
$ret .= "&mlon=".ReadingsVal($name,"results_apotheken_apotheke_01_longitude","0");
$ret .= "#map=18";
$ret .= "\/".ReadingsVal($name,"results_apotheken_apotheke_01_latitude","0");
$ret .= "\/".ReadingsVal($name,"results_apotheken_apotheke_01_longitude","0");
return $ret; },

GoogleLink_UR {my $ret = "https:\/\/www.google.com\/maps\/search\/?api=1";
    $ret .= "&query=".ReadingsVal($name,"results_apotheken_apotheke_01_latitude","0");
    $ret .= ",".ReadingsVal($name,"results_apotheken_apotheke_01_longitude","0");
    return $ret; }

Damit läuft es bei mir wieder wie vorher.

DeeSPe

#131
Zitat von: binford6000 am 22 März 2023, 10:00:02Hi Dan,
das Template von OldFhem (mit JSON) hat ja immerhin bis zum 10.03. funktioniert. Anscheinend gabs da wieder eine Änderung...
VG Sebastian

Hi Sebastian,

dass die auf JSON umgestellt haben hatte ich nicht mitbekommen.
Habe jetzt aber auch wieder eine lauffähige Version mittels HTTPMOD hinbekommen:
defmod NotAppo HTTPMOD https://www.aponet.de/apotheke/notdienstsuche?tx_aponetpharmacy_search[action]=result&tx_aponetpharmacy_search[search][plzort]=12345&tx_aponetpharmacy_search[search][radius]=2&type=1982 86400
attr NotAppo alias Apotheken-Notdienst
attr NotAppo alignTime 08:56
attr NotAppo bodyEncode utf8
attr NotAppo extractAllJSON 1
attr NotAppo extractAllJSONFilter results_apotheken_apotheke_01.*
attr NotAppo stateFormat results_apotheken_apotheke_01_name (ca. results_apotheken_apotheke_01_distanz km entfernt)<br>\
<a target="_blank" href="results_apotheken_apotheke_01_goo" title="zu Google Maps">results_apotheken_apotheke_01_strasse</a><br>\
<a target="_blank" href="results_apotheken_apotheke_01_osm" title="zu OpenStreet Maps">results_apotheken_apotheke_01_plz results_apotheken_apotheke_01_ort</a><br>\
Tel.: <a href="tel:results_apotheken_apotheke_01_telefon" title="results_apotheken_apotheke_01_name anrufen">results_apotheken_apotheke_01_telefon</a><br>\
<b>Notdienst im Zeitraum</b><br>\
vom results_apotheken_apotheke_01_startdatum results_apotheken_apotheke_01_startzeit<br>\
bis results_apotheken_apotheke_01_enddatum results_apotheken_apotheke_01_endzeit
attr NotAppo userReadings results_apotheken_apotheke_01_goo { my $ret = 'https://www.google.com/maps/place/';;\
    $ret .= urlEncode(ReadingsVal($name,'results_apotheken_apotheke_01_strasse',''));;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_plz','');;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_ort','');;\
    $ret },\
results_apotheken_apotheke_01_osm { my $ret = 'https://www.openstreetmap.org/search?query=';;\
    $ret .= urlEncode(ReadingsVal($name,'results_apotheken_apotheke_01_strasse',''));;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_plz','');;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_ort','');;\
    $ret }

Gruß
Dan

P.S. Mit gesetztem Attribut "bodyEncode utf8" klappt es auch mit den Umlauten und sonstigen Sonderzeichen.
MAINTAINER: 22_HOMEMODE, 98_Hyperion, 98_FileLogConvert, 98_serviced

Als kleine Unterstützung für meine Programmierungen könnt ihr mir gerne einen Kaffee spendieren: https://buymeacoff.ee/DeeSPe

binford6000

ZitatP.S. Mit gesetztem Attribut "bodyEncode utf8" klappt es auch mit den Umlauten und sonstigen Sonderzeichen.
Hmmm, ich hatte nur mit bodyDecode utf8 erfolglos probiert... 🤔
Hab dann aber jetzt eh umgestellt auf JsonMod.

VG Sebastian

wendeling

Hallo,
leider funktioniert das bei mir nicht. Es kommen keine Daten.
Muss ich ein spezielles template verwenden ?

Gruß
Wendelin



Zitat von: DeeSPe am 27 März 2023, 16:28:31
Zitat von: binford6000 am 22 März 2023, 10:00:02Hi Dan,
das Template von OldFhem (mit JSON) hat ja immerhin bis zum 10.03. funktioniert. Anscheinend gabs da wieder eine Änderung...
VG Sebastian

Hi Sebastian,

dass die auf JSON umgestellt haben hatte ich nicht mitbekommen.
Habe jetzt aber auch wieder eine lauffähige Version mittels HTTPMOD hinbekommen:
defmod NotAppo HTTPMOD https://www.aponet.de/apotheke/notdienstsuche?tx_aponetpharmacy_search[action]=result&tx_aponetpharmacy_search[search][plzort]=12345&tx_aponetpharmacy_search[search][radius]=2&type=1982 86400
attr NotAppo alias Apotheken-Notdienst
attr NotAppo alignTime 08:56
attr NotAppo bodyEncode utf8
attr NotAppo extractAllJSON 1
attr NotAppo extractAllJSONFilter results_apotheken_apotheke_01.*
attr NotAppo stateFormat results_apotheken_apotheke_01_name (ca. results_apotheken_apotheke_01_distanz km entfernt)<br>\
<a target="_blank" href="results_apotheken_apotheke_01_goo" title="zu Google Maps">results_apotheken_apotheke_01_strasse</a><br>\
<a target="_blank" href="results_apotheken_apotheke_01_osm" title="zu OpenStreet Maps">results_apotheken_apotheke_01_plz results_apotheken_apotheke_01_ort</a><br>\
Tel.: <a href="tel:results_apotheken_apotheke_01_telefon" title="results_apotheken_apotheke_01_name anrufen">results_apotheken_apotheke_01_telefon</a><br>\
<b>Notdienst im Zeitraum</b><br>\
vom results_apotheken_apotheke_01_startdatum results_apotheken_apotheke_01_startzeit<br>\
bis results_apotheken_apotheke_01_enddatum results_apotheken_apotheke_01_endzeit
attr NotAppo userReadings results_apotheken_apotheke_01_goo { my $ret = 'https://www.google.com/maps/place/';;\
    $ret .= urlEncode(ReadingsVal($name,'results_apotheken_apotheke_01_strasse',''));;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_plz','');;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_ort','');;\
    $ret },\
results_apotheken_apotheke_01_osm { my $ret = 'https://www.openstreetmap.org/search?query=';;\
    $ret .= urlEncode(ReadingsVal($name,'results_apotheken_apotheke_01_strasse',''));;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_plz','');;\
    $ret .= '%20'.ReadingsVal($name,'results_apotheken_apotheke_01_ort','');;\
    $ret }

Gruß
Dan

P.S. Mit gesetztem Attribut "bodyEncode utf8" klappt es auch mit den Umlauten und sonstigen Sonderzeichen.

yersinia

viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl