This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

garbage can trigger
Hi @all,

I want to create a script that gives me a trigger object when a garbage can will be picked up today. Therefore I have all possible pick up dates available in an .ics calendar or I can easiliy convert it to an Excel.

Is there any script / starting point you can help me with?

Many thanks for your help.

Best Regards
ICS is a text format so it can be parsed via a script. Can you provide an example ICS that you want to use? Is it stored somewhere where LM can retrieve it automatically?
Hi Admin

many thanks for your reply. 

Attached you can find the example file. I want to check if the actual date is similar to a pick up date in the ics and if yes a group address with the kind of garbage ("Restmüll", "Gelber Sack", etc.) should be send. 

The ics I getting from a website as a download and is not stored anywhere.

Many thanks for your help!

Best Regards

Attached Files
.zip (Size: 3.96 KB / Downloads: 6)
Here's an example that you can use a starting point. data variable should contain the ICS file contents that you get externally.

First the script parses ICS events into a table. Then it looks for an event with a matching date. summary variable is the summary field (kind of garbage in your case) of the found event or an empty string. Change 1/1/1 as needed and use 250 byte string as the data type of this object.

url = ''
data, err = require('socket.http').request(url)

if not data then
  log('request failed', err)

data = data:split('\n')

events = {}

for _, line in ipairs(data) do
  line = line:trim()

  if line == 'BEGIN:VEVENT' then
    event = {}
  elseif line == 'END:VEVENT' then
    events[ #events + 1 ] = event
    event = nil
  elseif event then
    pos = line:find(':')
    if pos then
      key = line:sub(1, pos - 1)
      value = line:sub(pos + 1)

      event[ key ] = value

now ='%Y%m%d')
summary = ''

for _, event in ipairs(events) do
  if event['DTSTART;VALUE=DATE'] == now then
    summary = event['SUMMARY']

grp.checkupdate('1/1/1', summary)
Hi Admin,

many thanks for your help! Highly appreciated!

Two questions:

The content of the variable data. Do I need just to replace „\n“ with the copy and paste text string out of the ics opened by a text editor? I tried to and getting failure messages. Or do you have a recommendation how to convert it?

Would it be also possible to parse it directly from a webcal address?

Many thanks for your help!

Best Regards
What is the URL to get the ICS file?
Here is a test url:


Many thanks for your help!
I've modified my original example to fetch ICS from the URL.
Awesome! It works! Many thanks for all of your help!
@admin: If I want to get a message today for a planned pickup tomorrow, how is the modification look like? Sorry for the rookie question I‘ve tried to find a solution via search function without any success.

Many thanks for your help!
Replace line 32 with this:
now ='%Y%m%d', os.time() + 86400)
Awesome! Many thanks again! :-)

Forum Jump: