Good evening, I’m trying (with no success due to my poor knowledge) to send a telegram message with timestamp using a python script because the destination is dependent from a boolean value. As long as the script runs as follows it works flawlessly (I took it from someone else :-)). But if I try to put a timestamp I get an error.
Working script:
message = "movement warning!"
def send_message(bot, text):
hass.services.call("notify", bot, {"message": text}, False)
logger.info("Sending to %s message '%s'", bot, text)
if hass.states.is_state('input_boolean.alarm_to_person_one', 'on'):
send_message("telegram_to_person_one", message)
if hass.states.is_state('input_boolean.alarm_to_person_two', 'on'):
send_message("telegram_to_person_two", message)
not working script is the same apart from the first line which looks like:
message = "{{now().strftime("%Y %m %d-%H:%M:%S")}} movement warning!"
As previously said my knowledge is almost non existent and I suppose that I have to handle the timestamp in another way but I wouldn’t know how.
Thanks to anybody willing to shed some light on the issue,
Federico