Notdienst Apotheke via jsonmod

Begonnen von binford6000, 27 März 2023, 14:10:27

Vorheriges Thema - Nächstes Thema

betateilchen

#60
Dann mach es doch einfach so, wie es alle hier im Thread machen, dann funktioniert es auch.

Warum willst Du Dir zwanghaft eine Extrawurst braten?

Bei mir heißt übrigens die map schon anders:

/typo3temp/assets/compressed/pharmacymap-22608502a558747159a530c82beea164.js
Vermutlich rufst Du einfach eine falsche (alte) map-URL auf.
Das HTTPMOD device, mit dem das Token aktualisiert, arbeitet ja zweistufig und erzeugt auch jeweils ein reading für die pharmacymap.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Sailor

#61
Ein weihnachtliches @Moin@ vom achtern Diek

Hat Jemand Lust ein Modul zu testen?

Gruß
    Sailor
******************************
Man wird immer besser...

JoWiemann

Zitat von: Sailor am 23 Dezember 2023, 20:00:17Ein weihnachtliches @Moin@ vom achtern Diek

Hat Jemand Lust ein Modul zu testen?

Gruß
    Sailor

Hallo Sailor,

danke für das Modul und anbei eine erste Rückmeldung.

Warum schreibst Du diese Log Informationen?
2023.12.24 11:09:17 3: deleteReading myNotApotheke .* : Deleted reading 005_startzeit for device myNotApotheke
Deleted reading 002_latitude for device myNotApotheke
Deleted reading 002_distanz for device myNotApotheke
Deleted reading 005_longitude for device myNotApotheke
Deleted reading 003_id for device myNotApotheke
Deleted reading 002_apo_id for device myNotApotheke
Deleted reading 002_enddatum for device myNotApotheke
Deleted reading 002_kammer for device myNotApotheke
Deleted reading 004_id for device myNotApotheke
Deleted reading 005_fax for device myNotApotheke
Deleted reading 005_telefon for device myNotApotheke
Deleted reading 002_email for device myNotApotheke
Deleted reading 004_name for device myNotApotheke
Deleted reading 001_startzeit for device myNotApotheke
Deleted reading 001_longitude for device myNotApotheke
Deleted reading 002_plz for device myNotApotheke
Deleted reading 004_strasse for device myNotApotheke
Deleted reading 003_startdatum for device myNotApotheke
Deleted reading 002_ort for device myNotApotheke
Deleted reading 004_startdatum for device myNotApotheke
Deleted reading 003_strasse for device myNotApotheke
Deleted reading 001_telefon for device myNotApotheke
Deleted reading 003_name for device myNotApotheke
Deleted reading 001_fax for device myNotApotheke
Deleted reading 001_email for device myNotApotheke
Deleted reading 002_startzeit for device myNotApotheke
Deleted reading 002_longitude for device myNotApotheke
Deleted reading 005_distanz for device myNotApotheke
Deleted reading 005_latitude for device myNotApotheke
Deleted reading 001_plz for device myNotApotheke
Deleted reading 001_ort for device myNotApotheke
Deleted reading 005_enddatum for device myNotApotheke
Deleted reading 005_kammer for device myNotApotheke
Deleted reading 005_apo_id for device myNotApotheke
Deleted reading 002_telefon for device myNotApotheke
Deleted reading 002_fax for device myNotApotheke
Deleted reading 005_email for device myNotApotheke
Deleted reading 001_latitude for device myNotApotheke
Deleted reading 001_distanz for device myNotApotheke
Deleted reading 005_ort for device myNotApotheke
Deleted reading 003_endzeit for device myNotApotheke
Deleted reading 005_plz for device myNotApotheke
Deleted reading 001_apo_id for device myNotApotheke
Deleted reading 004_endzeit for device myNotApotheke
Deleted reading 001_enddatum for device myNotApotheke
Deleted reading 001_kammer for device myNotApotheke
Deleted reading 003_email for device myNotApotheke
Deleted reading 002_startdatum for device myNotApotheke
Deleted reading 003_ort for device myNotApotheke
Deleted reading 003_plz for device myNotApotheke
Deleted reading 005_endzeit for device myNotApotheke
Deleted reading 004_ort for device myNotApotheke
Deleted reading 002_strasse for device myNotApotheke
Deleted reading 004_plz for device myNotApotheke
Deleted reading 002_name for device myNotApotheke
Deleted reading 004_email for device myNotApotheke
Deleted reading 003_distanz for device myNotApotheke
Deleted reading 003_latitude for device myNotApotheke
Deleted reading 002_id for device myNotApotheke
Deleted reading 004_kammer for device myNotApotheke
Deleted reading 001_endzeit for device myNotApotheke
Deleted reading 004_enddatum for device myNotApotheke
Deleted reading 004_apo_id for device myNotApotheke
Deleted reading 003_enddatum for device myNotApotheke
Deleted reading 003_kammer for device myNotApotheke
Deleted reading 003_apo_id for device myNotApotheke
Deleted reading 004_distanz for device myNotApotheke
Deleted reading 004_latitude for device myNotApotheke
Deleted reading 001_id for device myNotApotheke
Deleted reading 002_endzeit for device myNotApotheke
Deleted reading 005_startdatum for device myNotApotheke
Deleted reading 005_strasse for device myNotApotheke
Deleted reading 005_name for device myNotApotheke
Deleted reading 003_startzeit for device myNotApotheke
Deleted reading 004_fax for device myNotApotheke
Deleted reading 004_telefon for device myNotApotheke
Deleted reading 003_longitude for device myNotApotheke
Deleted reading 005_id for device myNotApotheke
Deleted reading 001_startdatum for device myNotApotheke
Deleted reading 001_strasse for device myNotApotheke
Deleted reading 004_longitude for device myNotApotheke
Deleted reading 003_fax for device myNotApotheke
Deleted reading 004_startzeit for device myNotApotheke
Deleted reading 001_name for device myNotApotheke
Deleted reading 003_telefon for device myNotApotheke

Nach dem Define habe ich folgendes im Log:
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute SearchLatitude was missing and has been set to Berlin
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute SearchLongitude was missing and has been set to Berlin
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute SearchRadius was missing and has been set to 10 km
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute UpdateMode was missing and has been set to "interval".
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute Interval was missing and has been set to 86400s = 24h
2023.12.24 11:04:07 3: myNotApotheke : NotApotheke - The attribute Schedule was missing and has been set to "04:00 12:00"
[/code]

Geholt werden aber die Daten für meine Umgebung. Ich vermute, dass Du trotz gesetztem Berlin die Koordinaten aus dem global Device holst.

Warum erhalte ich bei einem Restart folgende Log Einträge:
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute SearchLatitude was missing and has been set to Berlin
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute SearchLongitude was missing and has been set to Berlin
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute SearchRadius was missing and has been set to 10 km
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute UpdateMode was missing and has been set to "interval".
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute Interval was missing and has been set to 86400s = 24h
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute Schedule was missing and has been set to "04:00 12:00"

In seinem Modul 98_JsonMod.pm nutzt hermannj eine von ihm entwickelte CRON Lib. Mit dieser Lib kann man ein CRON Attribut definieren, dass genauso arbeitet wie der Linux CRON. Ich nutze die Library in meinem Modul 98_CDCOpenData.pm. Vielleicht wäre das auch etwas für Dein Modul.

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

betateilchen

#63
Zitat von: Sailor am 23 Dezember 2023, 20:00:17Ein weihnachtliches @Moin@ vom achtern Diek

Hat Jemand Lust ein Modul zu testen?

FHEM bringt doch schon alles mit, was man dafür braucht.

Nicht jedes perl-Geskribbel ist deswegen gleich ein "Modul".
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Christoph Morrison

Zitat von: betateilchen am 24 Dezember 2023, 12:25:16Nicht jedes perl-Geskribbel ist deswegen gleich ein "Modul".

Und wer, aufgrund solch wenig motivierender Kommentare, FHEM den Rücken kehren, aber trotzdem nicht auf Notfalldaten von Apotheken verzichten möchte, kann sich bei Github ein Standalone-MQTT-Gateway zum Apothekennotdienst als Docker-Container besorgen.

betateilchen

#65
Zitat von: Christoph Morrison am 24 Dezember 2023, 15:32:16Und wer, aufgrund solch wenig motivierender Kommentare

Hast Du mal einen Blick in das "Modul" geworfen?
Vielleicht um zu verstehen, wie ich zu meinem Kommentar kam?.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Sailor

#66
Hi Jörg

Zitat von: JoWiemann am 24 Dezember 2023, 11:24:49Warum schreibst Du diese Log Informationen?
2023.12.24 11:09:17 3: deleteReading myNotApotheke .* : Deleted reading 005_startzeit for device myNotApotheke
Deleted reading 002_latitude for device myNotApotheke
Ach Mist! Die Codezeile
fhem("deleteReading $name .*"); wollte ich noch in
foreach my $reading (keys(%{$hash->{READINGS}})) {
readingsDelete($hash, $reading);
}
ändern.


Zitat von: JoWiemann am 24 Dezember 2023, 11:24:49Geholt werden aber die Daten für meine Umgebung. Ich vermute, dass Du trotz gesetztem Berlin die Koordinaten aus dem global Device holst.
Das ist korrekt. Wenn die global attributes "latitude" und "longitude" vorhanden sind, dann nimmt das Modul auch diese.
Soviel Komfort muss sein.


Zitat von: JoWiemann am 24 Dezember 2023, 11:24:49Warum erhalte ich bei einem Restart folgende Log Einträge:
2023.12.24 11:12:40 3: myNotApotheke : NotApotheke - The attribute SearchLatitude was missing and has been set to Berlin
Die werden nur beim allerersten define geschrieben.
Habe das Log-Level auf "4" geändert. Sollten also beim Standard - Verbose = 3 nicht mehr auftauchen.

Zitat von: JoWiemann am 24 Dezember 2023, 11:24:49In seinem Modul 98_JsonMod.pm nutzt hermannj eine von ihm entwickelte CRON Lib. Mit dieser Lib kann man ein CRON Attribut definieren, dass genauso arbeitet wie der Linux CRON. Ich nutze die Library in meinem Modul 98_CDCOpenData.pm. Vielleicht wäre das auch etwas für Dein Modul.

Danke für den Tipp! - Werde ich mir anschauen.

Gruß
    Sailor
******************************
Man wird immer besser...

Sailor

Hallo Christoph

Zitat von: Christoph Morrison am 24 Dezember 2023, 15:32:16
Zitat von: betateilchen am 24 Dezember 2023, 12:25:16Nicht jedes perl-Geskribbel ist deswegen gleich ein "Modul".

Und wer, aufgrund solch wenig motivierender Kommentare, FHEM den Rücken kehren, aber trotzdem nicht auf Notfalldaten von Apotheken verzichten möchte, kann sich bei Github ein Standalone-MQTT-Gateway zum Apothekennotdienst als Docker-Container besorgen.

Danke für das "Rücken stärken"!
An solche Kritik bin ich mittlerweile gewöhnt. Ist ein ein moderiertes aber dennoch freies Forum. ;)

Gruß
    Sailor
******************************
Man wird immer besser...

betateilchen

Zitat von: Sailor am 27 Dezember 2023, 13:08:35An solche Kritik bin ich mittlerweile gewöhnt.

Das Schlimme ist, dass Dich die Kritik nicht interessiert und Du einfach mit dem gleichen Kraut-und-Rüben-Gefrickel weitermachst, wie es in Deinen xxxCalculator-Dateien schon enthalten ist.

Die existierenden Development-Guidelines scheinen Dich dabei genauso wenig zu interessieren, wie ernstgemeinte Hilfsangebote (die ich vor langer Zeit schon gemacht hatte), gemeinsam an einer Optimierung zu arbeiten. Du wärst nicht das erste Forummitglied, dem man mit einem Code-Review helfen könnte, auf einen optimierten Lösungsweg in einem geplanten Modul zu kommen.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

yersinia

Ich fürchte, Aponet hat mal wieder umgestellt. Jetzt wird das Token über einen zwei/dreistufigen js Ladeprozess verschleiert. Über eine (hier die zweite) Main.entry js
<script type="module" src="/_assets/vite/assets/Main.entry-MorqIBr0.js?1709126033"></script>
<script type="module" src="/_assets/vite/assets/Main.entry-QXWoBoT3.js?1709126033"></script>
wird eine neue Pharmacymap geladen
import("./Pharmacymap--Xc30Toc.js")welche das token enthält
fs="mHVaki0/q/M";
Mir ist nicht klar, wie man dies nun in HTTPMOD/JsonMod zusammenbauen kann - und ob man das überhaupt noch in HTTPMOD machen müsste und nicht besser eine myUtils nutzt oder was auf Systemebene zu "bauen".
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

betateilchen

Zitat von: yersinia am 29 Februar 2024, 08:37:19Ich fürchte, Aponet hat mal wieder umgestellt. Jetzt wird das Token über einen zwei/dreistufigen js Ladeprozess verschleiert.

Die sind halt auch nicht so blöd, sich ihr durchaus lukratives Geschäftsmodell kaputtmachen zu lassen.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Sailor

Moin tosammen!

Zitat von: betateilchen am 29 Februar 2024, 12:33:50Die sind halt auch nicht so blöd, sich ihr durchaus lukratives Geschäftsmodell kaputtmachen zu lassen.

Mir doch egal.  ;)

Ich habe mal mein 73_NotApotheke.pm auf den entsprechenden Stand gebracht.
Funktioniert bei mir.

Die svg - Datei muss in
/opt/fhem/www/images/fhermSVG/apotheke.svg

Aber Vorsicht!
Das Modul greift 4 mal auf die genannte Webseite zu. Und zwar alles noch "Blocking".
Sollte die Webseite sich geändert haben, kann das zu einem langen Aussetzer im fhem -System führen bis der timeout greift.
Ich weiß noch nicht inwieweit das ggf. das fhem-System zum Absturz bringt.
Ich arbeite dran... Erbitte aber fleißig um Rückmeldung.

Gruß
    Sailor

******************************
Man wird immer besser...

yersinia

#72
Ich teste hier ein paar Zeilen mit HttpUtils_NonblockingGet und läuft auch auf dem rpi4 hier trotz der vielen regex recht flott; bei Interesse teile ich es per pm

Edit: läuft seit einer Woche recht stabil. :)
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

Sailor

Hallo Yersinia

Zitat von: yersinia am 03 März 2024, 21:18:15Ich teste hier ein paar Zeilen mit HttpUtils_NonblockingGet und läuft auch auf dem rpi4 hier trotz der vielen regex recht flott; bei Interesse teile ich es per pm

Habe Interesse!

Gruß
    Sailor
******************************
Man wird immer besser...

grossmaggul

Vielleicht könnte man ja auch hiermit was machen: https://www.apotheken-umschau.de/apotheken-notdienst/

Tschuldigung jetzt schon, sollte ich mich damit als DAU outen...
FHEM auf Debian Buster Server, 2 x nanoCUL868, 1xnanoCUL465; Homematic, MAX, MiLight, HUE,  2 x Gosund SP1