Does
subject: ".*Abfuhrtermine.*"
make a difference?
Does
subject: ".*Abfuhrtermine.*"
make a difference?
No, just checked the ".*Abfuhrtermine.*"
version. No effect. Even without this filter the content string is “NULL”.
Do you need this just for the Garbage collection? Maybe you have an ical-calender with the data? Here is how I solved it:
Configured the icalender-Binding with the official ical-Link to the garbage collection of my town.
Then I use the “next_title” and “next_start” channels. Here is my rule for the notification at 2pm one day before the garbage collection:
rule "Müll Benachrichtigung"
when
Time cron "0 0 14 ? * *"
then
val nextTitle = Abfallkalender_NextTitel.state.toString // Titel des nächsten Termins
if(now.isAfter((Abfallkalender_Next.state as DateTimeType).getZonedDateTime.minusMinutes(780)) && nextTitle != "Tonnentausch") {
val notificationMsg = "Morgen: " + nextTitle
sendBroadcastNotification(notificationMsg)
}
end
IT’s very simpel and works perfect, maybe this helps you to do it without mails.
That was my first thought. Unfortunately, my garbage collector does not offer an ical-Link.
Next attempt was müll.io. But here the data for my town (village ) is not provide, too.
What is provide is an pdf-file or the mail.
I tried with your mail and it works fine for me with latest snapshot. There have been no changes to this part of the code since July last year (when this feature was introduced), so this is quite surprising.
UID: mail:imap:010774be9c
label: IMAP-Server
thingTypeUID: mail:imap
configuration:
refresh: 60
hostname: imap.strato.de
password: <redacted>
security: SSL
username: <redacted>
channels:
- id: count
channelTypeUID: mail:mailcount
label: Anzahl der E-Mails
description: ""
configuration:
folder: INBOX
- id: content
channelTypeUID: mail:content
label: Content
description: ""
configuration:
subject: .*Abfuhrtermine.*
folder: INBOX
markAsRead: true
17:56:25.336 | INFO | OH-eventexecutor-2-1 | openhab.event.ItemStateChangedEvent | 182 | Item 'IMAPServer_Anzahl_der_EMails' changed from 1672 to 1673
17:57:29.378 | INFO | OH-eventexecutor-2-1 | openhab.event.ItemStateChangedEvent | 182 | Item 'IMAPServer_Content' changed from NULL to --------------QdIzZoXi1nl0iJZleNL0hLXW
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
- Montag, 18.03.2024 Restmülltonne 80 l - 360 l, 4 wö - Montag,
18.03.2024 Restmülltonne 1.100 l, 4 wö - Montag, 18.03.2024
Restmülltonne 1.100 l, 2 wö
--------------QdIzZoXi1nl0iJZleNL0hLXW
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div
style="color: rgb(0, 0, 0); font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">- Montag, 18.03.2024 Restmülltonne 80 l - 360 l, 4 wö
- Montag, 18.03.2024 Restmülltonne 1.100 l, 4 wö
- Montag, 18.03.2024 Restmülltonne 1.100 l, 2 wö</div>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>
--------------QdIzZoXi1nl0iJZleNL0hLXW--
17:58:31.309 | INFO | OH-eventexecutor-2-1 | openhab.event.ItemStateChangedEvent | 182 | Item 'IMAPServer_Anzahl_der_EMails' changed from 1673 to 1674
It’s also interesting that your log shows com.sun.mail.imap.IMAPInputStream
as content class, because for me it is javax.mail.internet.MimeMultipart
. I have added code to handle that, would you like to try it?
Sure, what should I do?
which openHAB Version? 4.0 oder 4.1?
From the “Über” page:
openHAB 4.1.1
Release Build
Go to the karaf console (see here for details how to get there) and type
update org.openhab.binding.mail https://download.smarthomej.org/org.openhab.binding.mail-4.2.0-SNAPSHOT.jar
Please set the bidning to TRACE logging again. Thanks!
This worked!
Log output is (edited)
2024-03-26 18:59:19.259 [DEBUG] [inding.mail.internal.POP3IMAPHandler] - Processing `Ihre Abfuhrtermine` from `"example" <example@exampel.org>`
2024-03-26 18:59:19.278 [TRACE] [inding.mail.internal.POP3IMAPHandler] - Detected IMAPInputStream message
2024-03-26 18:59:19.299 [TRACE] [inding.mail.internal.POP3IMAPHandler] - Found content 'This is a multi-part message in MIME format.
...
The item shows the content of the body!:
Thank you very much for the effort.