Hi, I’m using scrape sensor to get the date and time of a soccer match from a web page.
I have a sensor that returns the date as “01 novembre 2020” and the time as “21:00”
I’ve tried
for the time but when i reboot instead of 21:00 i get unknown. Same thing for the date. Plus File Editor sometimes gives me some strange syntax error asking me to put a comma beetween % and d, like “%,d”.
What am i doing wrong? Thanks.
This might convert your scraped sensor to a datetime object but it’s hard to say, because you did not say how the date and time were combined or if the 24 hour was zero padded. Or if they are two sensors or one.
Assuming one sensor:
The first filter converts the month to title case ( novembre -> Novembre ).
The second line of the template assumed that your date and time sensor state looks like this:
that before adding “value_template” was returning me 21:00 and now returns unknown. I sincerly don’t know if it is zero padded since it’s 24 hour format and there are no upcoming matches before 12:00 PM.
The second is:
Thanks, now it works perfect. It shows the right time and date.
Do you know if i can make an automations that runs on that specific day something like 10 minutes before the time that the sensor gets from the page?
For example an automation that runs on 01 november 10/15 minutes before 21:00