I have a few sensors with date values, Sat 02 Mar, 2019 for example. I’m looking for a way to show only the sensors that have a value within the next 7 days. Something like auto-entities card might work, but not exactly sure how to do this.
The values are taken from a webpage and saved to a text file, and then using a command_line sensor and sed to reference a specific line in the file, I grab the value for the sensor. I can also modify this output if needed to remove the day and the comma after the month if needed.
It’s scrapped from a website, and the format is Sat 02 Mar, 2019. I was just looking at the date command in linux. I might be able to do something with that. Just trying to work out how to add that on a command line after sed does its thing.
So if you can put it in the same format as I show in my template, and then set that as a state for an entity, you should be able to use that by comparing the as_timestamp(states.entity.states) with now as per the above. Definitely doable.
Ok, so with a combination of using sed, awk and sed again, I got the date format to be 2019-03-02 00:00:00. Now, having a play in the template editor I have 2 options. Both seem to result the same.