Abfallkalender auslesen

Ich möchte gerne den Abfallkalender meiner lokalen Abfallgesellschaft in IPS integrieren. Früher konnte ich simpel die Webseite „importieren“. Jetzt haben die auf eine php-Formularseite umgestellt. Nun habe ich überhaupt kein Wissen in php … kann mit jemand einen hilfreichen Tipp geben?
http://www.muellmax.de/abfallkalender/rsa/res/RsaStart.php
Mit einer Art „Starthilfe“ komme ich dann alleine weiter.

Alternativ wäre das hier noch eine Möglichkeit.

Grüße
galleto

Wie wäre es mit der Smartphone App Mymüll?

Ich hatte von hier auch schon mal ein Anfall Kalender Skript im Einsatz. Dort konnte man die gerade/ungerade Woche und den Turnus für die verschiedenen müllarten eintragen. Auf der Basis hat das Skript entsprechend Erinnerungen angelegt. Da es aber immer wieder Abweichungen geben kann, bin ich irgendwann mal auf die o.g. APP umgestiegen, da unser Landkreis dafür geworben hat. In der APP sind sehr viele Landkreise bundesweit hinterlegt. vielleicht ist der eigene ja auch dabei.

Hallo Zusammenn,

wie kann man so einen Abfallkalender auslesen?

http://hildesheim.abfuhrkalender.de/

Die einzelnen Abfallbetriebe sollte mal einen gemeinsamen Standard entwickeln.

Danek im Voraus

Das mit dem gemeinsamen Standard ist gar keine schlechte Idee. Die Firma mein-Abfallkalender.de bietet einen solchen Service für Kommunen an. Zur Zeit machen 92 Kommunen mit, darunter auch größere Städte wie zum Beispiel Leverkusen. Zufällig auch meine kleine Gemeinde :). Ich konnte die Termine bisher immer unkompliziert mit ioBroker’s ical Plugin auslesen und in einen String konvertieren lassen, um dann die anstehende Termine anzuzeigen.

Man kann auf der Webseite eine iCal/WebCal URL erzeugen, die auf die eigene Straße, bestimmte Abfallarten, Anzahl der Tage im Voraus, usw, angepasst werden kann. Das sieht dann so aus:

webcal://www.bad-vilbel.mein-abfallkalender.de/ical.ics?sid=1209&cd=inline&ft=6&fp=days_14&wids=21,22,24,23,25,126,26

Ich würde gerne ein Skript haben, dem man diese URL übergibt und das als Ergebnis einen String erzeugt mit einer Zeile pro Datum in der Art:

Hausmüll: heute
Gelbe Tonne: morgen
Biomüll: 18.11.2016

Vielleicht haben wir ja einen erfahrenen User in einer diese Gemeinden der das umsetzten könnte? http://mein-abfallkalender.de/unsere_referenzen.html

iCalCreator Klasse im Internet downloaden und dann mit folgendem Code kannst Du Dir den array anzeigen lassen:


<?
require_once( "iCalcreator-2.22/iCalcreator.php" );
$config = array( "unique_id" => "1209" );
  // set the (site) unique id,  
// required if any component UID is missing!!
$v = new vcalendar( $config );
  // create a new calendar instance
$v->setConfig( "url", "http://www.bad-vilbel.mein-abfallkalender.de/ical.ics?sid=1209&cd=inline&ft=6&fp=days_14&wids=21,22,24,23,25,126,26" );
 
 // iCalcreator also support remote files
$v->parse();
print_r($v);

?>

Am 18.11. ist das nächste Mal Hausmüll bei Dir :slight_smile:

@wupperi
Das klingt genau nach dem was ich suche! :slight_smile:
Wo erstellt Du den Ordner für „require_once( „iCalcreator-2.22/iCalcreator.php“ );“?

Die IPS Scripte liegen in scripts, somit also relativ dazu ;).

MfG
Ralf

einfach den Ordner im archiv in …/ips/scripts/ kopieren.

Ok. Das funktioniert.
Leider bietet meine Abfallgesellschaft keine „echte“ URL an. Wie kann ich auf eine lokale Datei (gleicher Ordner) referenzieren?

Ich bin schon weiter …

<?

require_once( "iCalcreator-2.22/iCalcreator.php" );

$config = array( 	"unique_id" => "1209",
						"directory" => "iCalcreator-2.22",
						"filename" => "RSAG_Abfuhrtermine.ics" );

$vcalendar = new vcalendar( $config );
$vcalendar->parse();

$event = $vcalendar->getComponent( "vevent" );

// iCalcreator also support remote files
$vcalendar->parse();
print_r($vcalendar);

?>

Die Ausgabe ist allerding so riesengroß … :frowning:

So:


$config = array( "directory" => "calendar"  // set file directory
               , "filename" => "file.ics" );
  // set file name
$v->setConfig( $config );
  // set config 
$v->parse();

nicht ganz … es fehlte noch das:

$v = new vcalendar( $config );

Also:

<?

require_once( "iCalcreator-2.22/iCalcreator.php" );

$config = array(  "directory" => "calendar",  // set file directory
						"filename" => "RSAG_Abfuhrtermine_2016.ics" );
  // set file name
$v = new vcalendar( $config );
$v->setConfig( $config );
  // set config
$v->parse();
print_r($v);


?>

Jetzt bekomme ich allerdings gar nichts mehr angezeigt.

vcalendar Object
(
    [calscale:vcalendar:private] => 
    [method:vcalendar:private] => 
    [prodid:vcalendar:private] => 
    [version:vcalendar:private] => 2.0
    [directory:vcalendar:private] => .
    [filename:vcalendar:private] => 20161113152027.ics
    [url:vcalendar:private] => 
    [xprop:protected] => Array
        (
        )

    [components] => Array
        (
        )

    [unparsed] => 
    [allowEmpty:protected] => 
    [language:protected] => 
    [nl:protected] => 
    [unique_id:protected] => localhost
    [format:protected] => 
    [dtzid:protected] => 
    [componentStart1:protected] => 
    [componentStart2:protected] => 
    [componentEnd1:protected] => 
    [componentEnd2:protected] => 
    [elementStart1:protected] => 
    [elementStart2:protected] => 
    [elementEnd1:protected] => 
    [elementEnd2:protected] => 
    [intAttrDelimiter:protected] => 
    [attributeDelimiter:protected] => 
    [valueInit:protected] => 
    [xcaldecl:protected] => Array
        (
        )

    [delimiter] => \
)

EDIT: mit

„directory“ => „iCalcreator-2.22“
geht es. Allerdings nicht verwertbare Informationen.

Doch, doch … die Informationen sind schon verwertbar (analog zu IP-Symcon Community Forum). Allerdings weiß ich grad nicht, wie ich die Ausgabe strukturiert bekomme. Jemand eine Idee?

Ich versuche so einen gmail Kalender auszulesen, aber ich bekomme immer diese Meldung:

Output-Buffer exceeds 1024kb. Operation halted.

Ich komme hier mit der Verarbeitung einfach nicht weiter. Für den Abfallkalender müsste ich aus dem ganzen Wust einfach nur Datum + Müllart in ein Array oder noch besser in einen String lesen getComponent scheint dafür das richtige zu sein.

Aber keine Idee wie ich das coden soll.

Das iCalcreate Maunal liegt übrigens hier:
http://kigkonsult.se/iCalcreator/docs/using.html#getComponent

Die geparste Ausgabe sieht so aus:


Notice:  Undefined property: vcalendar::$filename in /var/lib/symcon/scripts/iCalcreator-2.22/lib/vcalendar.class.php on line 633
Array
(
    [2016] => Array
        (
            [11] => Array
                (
                    [23] => Array
                        (
                            [0] => vevent Object
                                (
                                    [attach:protected] => 
                                    [attendee:protected] => 
                                    [categories:protected] => 
                                    [comment:protected] => 
                                    [contact:protected] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [value] => Mein-Abfallkalender.de, support@mein-abfallkalender.de
                                                    [params] => 
                                                )

                                        )

                                    [class:protected] => Array
                                        (
                                            [value] => PUBLIC
                                            [params] => 
                                        )

                                    [created:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [description:protected] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [value] => Biotonne im Bereich Kornblumenweg
                                                    [params] => 
                                                )

                                        )

                                    [dtend:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 24
                                                )

                                            [params] => Array
                                                (
                                                    [VALUE] => DATE
                                                )

                                        )

                                    [dtstart:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 23
                                                )

                                            [params] => Array
                                                (
                                                    [VALUE] => DATE
                                                )

                                        )

                                    [duration:protected] => 
                                    [exdate:protected] => 
                                    [exrule:protected] => 
                                    [geo:protected] => 
                                    [lastmodified:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [location:protected] => Array
                                        (
                                            [value] => Kornblumenweg, Bad Vilbel
                                            [params] => 
                                        )

                                    [organizer:protected] => 
                                    [priority:protected] => Array
                                        (
                                            [value] => 5
                                            [params] => 
                                        )

                                    [rdate:protected] => 
                                    [recurrenceid:protected] => 
                                    [relatedto:protected] => 
                                    [requeststatus:protected] => 
                                    [resources:protected] => 
                                    [rrule:protected] => 
                                    [sequence:protected] => Array
                                        (
                                            [value] => 0
                                            [params] => 
                                        )

                                    [status:protected] => Array
                                        (
                                            [value] => CONFIRMED
                                            [params] => 
                                        )

                                    [summary:protected] => Array
                                        (
                                            [value] => Biotonne
                                            [params] => 
                                        )

                                    [transp:protected] => Array
                                        (
                                            [value] => TRANSPARENT
                                            [params] => 
                                        )

                                    [url:protected] => 
                                    [uid:protected] => Array
                                        (
                                            [value] => 153082@www.bad-vilbel.mein-abfallkalender.de
                                            [params] => 
                                        )

                                    [dtstamp:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [objName] => vevent
                                    [xprop:protected] => Array
                                        (
                                            [X-FUNAMBOL-ALLDAY] => Array
                                                (
                                                    [value] => 1
                                                    [params] => 
                                                )

                                            [X-MICROSOFT-CDO-ALLDAYEVENT] => Array
                                                (
                                                    [value] => TRUE
                                                    [params] => 
                                                )

                                            [X-CURRENT-DTSTART] => Array
                                                (
                                                    [value] => 2016-11-23
                                                    [params] => 
                                                )

                                            [X-CURRENT-DTEND] => Array
                                                (
                                                    [value] => 2016-11-23
                                                    [params] => 
                                                )

                                        )

                                    [components] => Array
                                        (
                                        )

                                    [allowEmpty:protected] => 1
                                    [language:protected] => 
                                    [nl:protected] => 

                                    [unique_id:protected] => 1209
                                    [format:protected] => ical
                                    [dtzid:protected] => 
                                    [componentStart1:protected] => BEGIN:
                                    [componentStart2:protected] => 
                                    [componentEnd1:protected] => END:
                                    [componentEnd2:protected] => 

                                    [elementStart1:protected] => 
                                    [elementStart2:protected] => 
                                    [elementEnd1:protected] => 
                                    [elementEnd2:protected] => 

                                    [intAttrDelimiter:protected] => 
                                    [attributeDelimiter:protected] => ;
                                    [valueInit:protected] => :
                                    [xcaldecl:protected] => Array
                                        (
                                        )

                                    [srtk] => Array
                                        (
                                            [0] => 153082@www.bad-vilbel.mein-abfallkalender.de
                                            [1] => 9223372036854775807
                                            [2] => 9223372036854775807
                                            [3] => 0
                                        )

                                    [propix] => Array
                                        (
                                        )

                                )

                        )

                    [24] => Array
                        (
                            [0] => vevent Object
                                (
                                    [attach:protected] => 
                                    [attendee:protected] => 
                                    [categories:protected] => 
                                    [comment:protected] => 
                                    [contact:protected] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [value] => Mein-Abfallkalender.de, support@mein-abfallkalender.de
                                                    [params] => 
                                                )

                                        )

                                    [class:protected] => Array
                                        (
                                            [value] => PUBLIC
                                            [params] => 
                                        )

                                    [created:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [description:protected] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [value] => Gartenabfälle im Bereich Kornblumenweg
                                                    [params] => 
                                                )

                                        )

                                    [dtend:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 25
                                                )

                                            [params] => Array
                                                (
                                                    [VALUE] => DATE
                                                )

                                        )

                                    [dtstart:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 24
                                                )

                                            [params] => Array
                                                (
                                                    [VALUE] => DATE
                                                )

                                        )

                                    [duration:protected] => 
                                    [exdate:protected] => 
                                    [exrule:protected] => 
                                    [geo:protected] => 
                                    [lastmodified:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [location:protected] => Array
                                        (
                                            [value] => Kornblumenweg, Bad Vilbel
                                            [params] => 
                                        )

                                    [organizer:protected] => 
                                    [priority:protected] => Array
                                        (
                                            [value] => 5
                                            [params] => 
                                        )

                                    [rdate:protected] => 
                                    [recurrenceid:protected] => 
                                    [relatedto:protected] => 
                                    [requeststatus:protected] => 
                                    [resources:protected] => 
                                    [rrule:protected] => 
                                    [sequence:protected] => Array
                                        (
                                            [value] => 1
                                            [params] => 
                                        )

                                    [status:protected] => Array
                                        (
                                            [value] => CONFIRMED
                                            [params] => 
                                        )

                                    [summary:protected] => Array
                                        (
                                            [value] => Gartenabfälle
                                            [params] => 
                                        )

                                    [transp:protected] => Array
                                        (
                                            [value] => TRANSPARENT
                                            [params] => 
                                        )

                                    [url:protected] => 
                                    [uid:protected] => Array
                                        (
                                            [value] => 153084@www.bad-vilbel.mein-abfallkalender.de
                                            [params] => 
                                        )

                                    [dtstamp:protected] => Array
                                        (
                                            [value] => Array
                                                (
                                                    [year] => 2016
                                                    [month] => 11
                                                    [day] => 18
                                                    [hour] => 18
                                                    [min] => 01
                                                    [sec] => 47
                                                    [tz] => Z
                                                )

                                            [params] => Array
                                                (
                                                )

                                        )

                                    [objName] => vevent
                                    [xprop:protected] => Array
                                        (
                                            [X-FUNAMBOL-ALLDAY] => Array
                                                (
                                                    [value] => 1
                                                    [params] => 
                                                )

                                            [X-MICROSOFT-CDO-ALLDAYEVENT] => Array
                                                (
                                                    [value] => TRUE
                                                    [params] => 
                                                )

                                            [X-CURRENT-DTSTART] => Array
                                                (
                                                    [value] => 2016-11-24
                                                    [params] => 
                                                )

                                            [X-CURRENT-DTEND] => Array
                                                (
                                                    [value] => 2016-11-24
                                                    [params] => 
                                                )

                                        )

                                    [components] => Array
                                        (
                                        )

                                    [allowEmpty:protected] => 1
                                    [language:protected] => 
                                    [nl:protected] => 

                                    [unique_id:protected] => 1209
                                    [format:protected] => ical
                                    [dtzid:protected] => 
                                    [componentStart1:protected] => BEGIN:
                                    [componentStart2:protected] => 
                                    [componentEnd1:protected] => END:
                                    [componentEnd2:protected] => 

                                    [elementStart1:protected] => 
                                    [elementStart2:protected] => 
                                    [elementEnd1:protected] => 
                                    [elementEnd2:protected] => 

                                    [intAttrDelimiter:protected] => 
                                    [attributeDelimiter:protected] => ;
                                    [valueInit:protected] => :
                                    [xcaldecl:protected] => Array
                                        (
                                        )

                                    [srtk] => Array
                                        (
                                            [0] => 153084@www.bad-vilbel.mein-abfallkalender.de
                                            [1] => 9223372036854775807
                                            [2] => 9223372036854775807
                                            [3] => 0
                                        )

                                    [propix] => Array
                                        (
                                        )

                                )

                        )

                )

        )

)


Hiermit bastel ich gerade…
Beim ersten getProperty steigt er aber aus mit:

Fatal error: Call to a member function getProperty() on null in /var/lib/symcon/scripts/11922.ips.php on line 23
Abort Processing during Fatal-Error: Call to a member function getProperty() on null
Error in Script /var/lib/symcon/scripts/11922.ips.php on Line 23

<?
require_once( "iCalcreator-2.22/iCalcreator.php" );

$config = array( "unique_id" => "1209" );
  // set the (site) unique id,  
// required if any component UID is missing!!
$v = new vcalendar( $config );
  // create a new calendar instance
$tz = "Europe/Berlin";
$v->setConfig( "url", "http://www.bad-vilbel.mein-abfallkalender.de/ical.ics?sid=1281&cd=inline&ft=noalarm&fp=days_7&wids=21,22,24,23,25,126,26" );
 
 // iCalcreator also support remote files
$v->parse();
$v->sort();
//print_r($v);

$eventArray = $v->selectComponents(2016,11,18,2016,11,24,"vevent");
print_r($eventArray);
  // select components occuring today
  // (including components with recurrence pattern)
$dtstart     = $vevent->getProperty( "dtstart" );
// dtstart required, one occurence, (orig. start date)
$summary     = $vevent->getProperty( "summary" );
$description = $vevent->getProperty( "description" );

?>

Das ist kein Wunder da $eventArray ein Array ist dieser muss erst durchlaufen werden um an die Werte zu kommen.

z.B. so


 $iCal = IPS_GetKernelDir()."webfront".DIRECTORY_SEPARATOR."user".DIRECTORY_SEPARATOR."iCalcreator".DIRECTORY_SEPARATOR."iCalcreator.php";
 //var_dump($iCal);
 require_once($iCal);

$config = array( "unique_id" => "1281" ); 
  // set the (site) unique id,   
// required if any component UID is missing!! 
$v = new vcalendar( $config ); 
  // create a new calendar instance 
$tz = "Europe/Berlin"; 
$v->setConfig( "url", "http://www.bad-vilbel.mein-abfallkalender.de/ical.ics?sid=1281&cd=inline&ft=noalarm&fp=days_7&wids=21,22,24,23,25,126,26" ); 
  
 // iCalcreator also support remote files 
$v->parse(); 
$v->sort();  

$events_arr = $v->selectComponents(2016,11,18,2016,11,24,"vevent"); 
foreach( $events_arr as $year => $year_arr )
 {
  foreach( $year_arr as $month => $month_arr )
  {
    foreach( $month_arr as $day => $day_arr )
	{
      	foreach( $day_arr as $event )
		{ 
			$date     = $event->getProperty( "dtstart" );  
			$summary     = $event->getProperty( "summary" ); 
			$description = $event->getProperty( "description" );
			echo  $date["day"].".".$date["month"].".".$date["year"]."
";
			echo $summary."
";
			echo $description."

"; 
		}
	}
   }
  } 

Ich weis ja nicht was Du genau auslesen willst mit den von Dir eingestellten Werten kommt dann das raus


23.11.2016
Biotonne
Biotonne im Bereich Kornblumenweg

24.11.2016
Gartenabfälle
Gartenabfälle im Bereich Kornblumenweg

Danke, Fonzo! Das hat mir sehr geholfen :slight_smile:

Nur Dein hack um den Pfad zur iCallcreator lib zu finden funktionierte bei mir nicht (Linux?)

Ich bastel jetzt mal weiter damit und stelle dann mal später eine Anleitung samt Skript in einem Extra-Beitrag zu „mein-Abfallkalender.de“ bereit.

Soweit funktioniert es ja, aber ich bekomme bei jeder Ausführung diesen Fehler:

Notice: Undefined property: vcalendar::$filename in /var/lib/symcon/scripts/iCalcreator-2.22/lib/vcalendar.class.php on line 633

Die Zeile 633 in der vcalendar.class.php ist aber eine Komentarzeile.
Keine Ahnung was er daran auszusetzen hat…