So, I need to be at work, at 07.45 every day.
With the sensor.zu_arbeit_mann I get the time i need from google travel time
So I need something like, if current time plus travel time is before (or shorter than?) 7.45 (or 7.40) all cool light should be green.
If current time plus travel time is 7.45 get red.
It’s easier if you make sensors and break into smaller pieces. Basically what you want to do is 1) get the time of day you want to be at work and convert to a Unix time stamp, then 2) minus that by the minutes of travel as from the google travel time sensor. This will give you your latest time to leave. If now is greater than that time, then turn the light red. 3) create a sensor that uses that leave time minus 10 minutes. And if that time is greater but less than the first sensor turn yellow. 4) create a new template sensor that is leave time minus 20 minutes etc. Go through all of your colours. Give it a try and if you’re absolutely stuck I can give you a hand with it tomorrow.
I think I know where the problem is, but I can not resolve it.
I have two sensors, the now() and the sensor.zu_arbeit_mann.
The Problem is, that the sensor.zu_arbeit_mann only provides minutes, and I guess this is the reason I can’t work with the now() as just adding minutes will not help here.
@TheCrey The best way to work with times is to convert into a timestamp ie 1513549191 (it’s the current seconds since Jan 01, 1970) and then subtract the seconds from that. Let’s say you want to subtract 15 minutes, you’d need to convert minutes to seconds (15 * 60) and subtract that number from the current timestamp. Then you’d convert the timestamp back into readable format. See my example for how to do it. It’s all there. Best of luck.