Please format per instructions at the top of the page. Without proper formatting we really can’t comment on potential indentation issues (which is a common problem.) You need to do this right after copying and pasting from your yaml file.
EDIT: It also helps to describe what problems you’re having. “Working” depends on what you want it to do. That’s not always obvious just by looking at an automation.
Ok,
What i want is when my daughter gets home (wifi joins in),
between time 12-18 on mon-fri
5 minutes after wifi join my google home shouts this message to her.
ps. I still dont know why sometimes same things are with - ← mark.
Like those -mon -tue -wed and so on.
Ok. Thanks for reformatting and for the description. That really helps!
First, there are definitely indentation problems. Also, your condition is overly complicated. I think what you want is:
# Ellin kotiintuloilmoitus
- alias: 'Elli tuli himaan'
trigger:
platform: state
from: 'not_home'
to: 'home'
for:
minutes: 5
entity_id: device_tracker.XXXXXXXXX
condition:
condition: time
after: '12:05:00'
before: '18:05:00'
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: tts.google_say
entity_id: media_player.kitchen
data:
message: 'Welcome home Elli, do your homework!'
Note that I added 5 minutes to the before/after time conditions. That’s because this automation will actually trigger 5 minutes after she comes home. Probably not a huge deal, but this makes it work the way you described.
EDIT: I’d also suggest removing from: 'not_home' from your trigger. It’s not necessary, and in some scenarios it might even prevent this from working (but it probably doesn’t really matter in your case.)
Ok so its like, when it turns from something else to “home” it works.
I understand its not needed here but in some scenarios where it can be something else than just two different states.
Yes, basically. E.g., if you had another zone defined that was just outside your home zone, then it wouldn’t go between ‘not_home’ (aka Away) to ‘home’, but from ‘not_home’ to the other zone and then to ‘home’. So a trigger that only triggers if it goes exactly from ‘not_home’ to ‘home’ would not trigger. But, if you just specify to: 'home', then it doesn’t matter what comes before ‘home’, it will trigger whenever it changes to ‘home’ (and from anything else.)