Very simply I am sending a message via telegram from within a rule. The code I have works fine, but I am struggling with one aspect. Within the message, I would like it to send the Date and Time that the notification was generated. e.g. Id like the message to read SOMETHING Changed to state X at 13:50 03-02-2018
if (SOMETHING.state == "BLAH" && MYBUTTON.state == ON) { ITEMONSITEMAP.postUpdate("SOMETHINGHAPPENED") sendTelegram("TELEGRAMbot", "SOMETHING Changed to state X at DATE/TIME") }
Im really struggling to get the correct code for the DateTime aspect to work.
I have a DateTime Item thats bound to NTP, but if I use that to post its Status,
sendTelegram("TELEGRAMbot", "SOMETHING Changed to state X at DATE/TIME", Current_DateTime.state)
I get something in the format 2018-02-03T14:07:03.429+0000 … which is great… ish, but not exactly friendly to look at.
I know I need to setup this with something like [%1$tA, %1$td/%1$tm/%1$tY, %1$tH:%1$tM] though for the life of me, I cannot figure the correct structure, to get those settings/variables into my sendTelegram line within the rules.
Does anyone know how to do this, or perhaps have a simpler way of doing it?
Thanks