How to retrieve weekday from ntp binding

Following is part of my item definition:

/* *** NTP binding demo item *** */

DateTime	Date	"Datum und Uhrzeit: [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<calendar>	{ channel="ntp:ntp:local:dateTime" } /* T für Zeit */
DateTime    Weekday "[%1$tA]" <calendar>       { channel="ntp:ntp:local:dateTime" }     /* Wochentag */

My sitemap is using:

		Text item=Date icon="calendar"  	                                                                            // Anzeige Datum und Kalender
		Text item=Weekday

The result is as expected:
first line: weekday, date and time is shown
second line: only the weekday is shown

Now I want use that information in a rule like e.g.

	if (Weekday.state == "Sonntag") {
		sendTelegram("bot2", "yes") }
		else 
			sendTelegram("bot2", "no")

this is part of a rule just to test if I can access to the weekday. Whatever I ask the literal is evaluataed to “no”.

If I send the content of weekday

		sendTelegram("bot2", ". tag:"+Weekday.state)

I get the information:
“.tag:2020-07-05T12:31:…”

How can I check on the current weekday in order to let parts of a rule run dependent on the day?

use now.getDayOfWeek()

What is the exact syntax to use the resulting weekday?

	if (now.getDayOfWeek() == "Sunday") {
		sendTelegram("bot2", ".yes") }
		else 
			sendTelegram("bot2", ".no")

seems not to work. (independent if I ask for german Sonntag or english Sunday

if (now.getDayOfWeek >= 6) to match the weekend.

Search the docs and forum for more usage examples, and take your time to learn Rules DSL.

Thank you for your support!
I already had a look on documentation, but it’s not so easy to find correct solutions

Now it’s working. Again: thank a lot for your quick answer!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.