#Huge automation HA Mess

1 messages · Page 1 of 1 (latest)

plain edge
#

just deciding what i will do, having phone in my pocket and going

#

the same for my girlfriend, thats why i wanted these notification so that she and i know, what happens without us needing to use the phone for daily stuff

fiery canopy
#

Well, the device_tracker domain (and your home is a one of those), can tell you the current zone.
So, you could create a binary template sensor "Oskars is coming home", which is triggered by the zone on of your device tracker updating, and if the previous state was the last one you need, then it could say "true", otherwise it would say false.

#

And then in your automation, you can check if you were at work for 2 hours, and you're coming home.

#

The device has a property location_name, which is the zone it's in

plain edge
#

its like i said, i wanted to use Boolean that gets turned on by an automation if im at work for at least 2 hours and off after sending notification and You're solution is to take out the boolean and its automation and put the template sensor in, right ?

fiery canopy
#

Well, the boolean seems redundant to me. You're creating new information which you can read from the information you already have

plain edge
#

i just want to undesrtand the difference here first 🙂

fiery canopy
#

Well, think of it like this: an input boolean is a switch. I have to go and press the switch.

plain edge
#

i get the thing i want to do, i just cant get You're plan here, and the difference here 🙂

fiery canopy
#

The template sensor knows.

#

So if the light is on, it says its on

#

If I use an input boolean, I have to turn it on and off,

#

Only the template sensor can do a lot more than "is the light on", it can take a list of things and process them, or check against other data.

plain edge
#

so the idea is to replace boolean with two automations with just one sensor right ?

fiery canopy
#

I'm not sure about one sensor just yet, I think that will be complex and frustrating to get figured out.

plain edge
#

i just really want to understand my case now, i get that the template sensor gets way more done

fiery canopy
#

And you need to start with something you understand and can easily tweak and play with

plain edge
#

boolean with automations is what i undesrand 😄

#

but since you understand the daily routes i have, You can imagine the booleans and automations i will have 😄

fiery canopy
#

It tells you how close you are to a zone, and if you're travelling to a zone, or not.

#

Which to me, sounds like exactly what you need to get you started with some of this.

plain edge
#

have that in left side now opened 🙂

fiery canopy
#

Because that can tell you "Oskars is travelling to zone 1, from work 1"

plain edge
#

just a quick question here, is it a super simple thing im trying or its pretty hard ? 😄

#

dir_of_travel seems to be the thing here 🙂

fiery canopy
#

You're trying to do something very complex

#

And yes, the direction of travel is going to be immensely helpful for this use case

plain edge
#

thanks ! i really started to think something is wrong with me here...

fiery canopy
#

It's a combination of things, you're trying to do something complex, but you're still at the beginning of your HA journey and you're using the logical first tools, but you really need the more powerful tools for this kind of thing.

#

Template sensors, the proximity integration, and even the bayesian sensor are the sort of thing you should be using, but if you don't understand them it's going to make everything a lot harder

plain edge
#

Wait For Trigger -> Boolean -> Template Sensor -> Proximity. 🙂

fiery canopy
#

What's the trigger you're waiting for? 😉

plain edge
#

my journey so far 😄

fiery canopy
#

Ahhh, gotcha

plain edge
#

that was the first automation 🙂

fiery canopy
#

You'll get there, just need to take it slow.

#

It can be frustrating when you don't understand the docs, but you'll need to figure out some of them to do a lot of this stuff.

#

Don't worry about the bayesian sensor just yet, that one is complex and whilst it's super cool, you'll need your other sensors and things set up 😉

plain edge
#

so then here comes the question of the day, proximity, i get what it does, i think i could use it, how to do it in GUI ? 😄

fiery canopy
#

Haha, this is one for YAML 😉

plain edge
#

fck me

fiery canopy
#

Get out VSCode, and copy and paste the example over. Then tweak it.

#

Put it on the right hand side of your screen, and put your HA window on the left. Then you can find the ids for your zones, devices, and more.

#

And if you don't have the Home Assistant addon for VSCode yet, you'll benefit from that.

#

When you have the YAML done, you'll need to put it in your configuration file. After that, you need to run the configuration check.

#

Stealing from the bot:

plain edge
#

ok, so im definitely sleeping over all this, but before that, please help me to understand the mess in docs the code part. like proximity link, what comes where ? how to write the code, thats why i've used only copy paste so far, i just don't get what comes under what

fiery canopy
#

So the whole

proximity:
  home:
    ignored_zones:
      - work
    devices:
      - device_tracker.car1
    tolerance: 50
    unit_of_measurement: mi

Or whatever you end up with, goes into your configuration.yaml file in your config folder in HA

#

Proximity is an integration, and this just tells it how it should do things. The same way an integration works when you set it up in the UI. Only it doesn't have a pretty way to ask you for information.

#

In this case, there's too many options, literally an infinite number, and that wouldn't be fun to set up.

plain edge
#
proximity:
  work_me_1:
     towards: 100
     unit_of_measurment: m
     devices: device_tracker.my_iphone
#

like so ?

fiery canopy
#

Yup. Assuming work_me_1 is the ID of your zone, and so on.

#

Wait, almost

#

You see where devices is? That's too far to the left

#

devices is a part of your work_me_1 zone set up. So it needs to move in to the right

#

devices should be in like with the unit of measurement.

#

And the device tracker is one item in a list, so it needs the - , and needs to be indented

#

This might be a good intro for you.

#

It's really important to get the number of spaces at the start of a line right, as well as the format

#

You're a lot closer!

#
     devices: device_tracker.my_iphone

needs to be

     devices: 
       - device_tracker.my_iphone
plain edge
#

ok

fiery canopy
#

The devices are a list or an array.

#

If you write this: device_tracker.phone, then this is a string.

plain edge
#

but if there is only one device ? then what ? how can i get the notification part here ?

fiery canopy
#

But with the new line, and the - it is one item in a list

#

Proximity won't do notifications for you, it just tells you the information you need to make those notifications super easy later.

#

So the devices are which devices you want to know about for that zone.

plain edge
#
proximity:
  work_me_1:
     towards: 100
     unit_of_measurment: m
     devices: 
       - device_tracker.my_iphone
#

then if its only one its a device and then its right ?

fiery canopy
#

Nope. It has to be a list

plain edge
#

ok got it 🙂

fiery canopy
#

👍

plain edge
#

like so ?

fiery canopy
#

When you do the code blocks, if you add yaml after the first three back ticks, it will highlight it by the way 🙂

#

Perfect!

plain edge
#

ok, and how can i get this part into automation then ?

fiery canopy
#

Step 1: get this working 😉

#

Step 2: look at the sensors, and then
Step 3: you can use those to trigger your automation, and as conditions in the automations

plain edge
#

but how can i know if its works ? 😄

fiery canopy
#

Look at the sensors 😉

plain edge
#

so its creates a senor then ?

#

like i dont get what im geting by doing this ?

fiery canopy
#

Yes, multiple sensors.

#

Well, what you can do with this is read those sensors

#

So you know the template sensors I was talking about before?

plain edge
#

yep

fiery canopy
#

This is like that, only it the hard work (the actual template) for you

plain edge
#

if sensor ( proximity ariving ) to work on then bla bla

fiery canopy
#

At least regarding "where was person" and "is person coming here"

#

So, you won't have to figure out the jinja templating just yet, and we can keep things simple with one input boolean when you're at work for a while, and this.

#

And then you can upgrade later 😉

#

Home Assistant and Home Automation is a journey, like a cruise. You'll end up as captain, but you have to work all over the ship first, and keep improving the things you already made.

plain edge
#

ok, if its ok with You ill keep this Thread open until im done with the first part at least here 🙂

fiery canopy
#

Well, I'm pretty busy at work and with my second job tomorrow, and threads disappear from everyone else's view pretty quickly in Discord. So you may want to ask in other channels too 🙂

#

But, I think we've found some useful stepping stones for you to get to your end goal in a really good way a bit faster which is excellent

plain edge
#

believe me, its not a rush, i have all the notifications turned of for a week at least, i was just so done with all this mess since it wouldn't work because if wait for trigger... i will try to get to this in the next days and if You will have time, You're more than welcome here 🙂 at least im ending in a somewhat usable mood here so thats already a win 😄 thanks for all the help so far 🙂

fiery canopy
#

🎉

plain edge
#

So since I can’t fall asleep I have It some thoughts, the Sensor would show if a person goes away or arrives to a zone, but it kinda don’t help me here, the first zone work, firstly I have to be there for at least 2h and then wait to leave, wait for trigger shouldn’t be used… then I have to go through one of at least two zones that are pretty close together, after I was at the work zone for 2h, how should that work ? Like the whole thing itself, I think I get the proximity part of it now

#

My brain is working in Boolean mode here … ;D with them it all works 🙂

fiery canopy
#

Each proximity will have the dir_of_travel, so when that switches from towards to arrived, on work_me_1, then you know you have arrived at work.
You can then use that to chain things together (probably with a template sensor long term), so if the "zone 1 on the way home" goes from towards to arrived, then your Zone 1 notification fires, and then your zone 2 one checks if you are travelling away_from Zone 1, and towards Zone 2, and so on and so forth

plain edge
#

I get that but then it would trigger each time I’m driving by there

fiery canopy
#

Indeed, hence the template sensor, to combine those.

plain edge
#

At the first part of it that’s the beginning of all of the automation, arriving, arived, waiting a minimum of 2h, leaving, how to get this part

fiery canopy
#

And added to the "Oskars was at work for 2 hours" check, you'll get it all in one place. And then you can start using those proximity triggers for other things too.

#

Hopefully, you're using the for property with the "at work for two hours" part. But that's all something to be looked at when you've got these things up and running.

#

The trick will be using the ignored_zones property

plain edge
#

The arriving arived and leaving would be done by proximity, at least it should be. But how to do the check thing here ? Like a condition ? But then it should wait for trigger to leave after that… the 2 h part makes the problem here

fiery canopy
#

Not at all, that bit can be solved separately.

#

Keep in mind, you're looking at this as one big puzzle. But it's actually lots of little puzzles. You need to solve each part, and then you can put it all together

plain edge
#

That’s what I’m trying to understand here, the arriving, here, and leaving part should be simple, it will be stated by the proximity sensor for zone 1, then if I leave zone 1 and arive zone 2 the next a thing happens, I just don’t get what to do with the waiting parts, 2h while at work, while from zone 1 to zone 2…

fiery canopy
#

You don't wait, you use each proximity arrived as a trigger for the next part.

plain edge
#

But then I have to use wait for trigger…

#

Because I need it to wait for trigger after I leave zone 1

#

So that it doesn’t trigger each time I’m in zone 2

#

The second zone can be triggered only if I left work zone and only if I was there for minimum of 2h

fiery canopy
#

No, you use the automation having triggered for Zone 1 as a condition for Zone 2 😉

plain edge
#

Ok now that sounds better

#

Can I do that ?

fiery canopy
#

That's a template

#

Yup.

plain edge
#

Ok and beeing at work for at least 2h also a template ?

fiery canopy
#

Yup, though that one I would leave as your input boolean for now. It'll be a more complex one to switch over.

plain edge
#

I think I’ll just go with Boolean and two automations here and I’m done ;D it’s way simpler and at the end it’s even less… the proximity with Boolean with template is even more then Boolean with boolean automation

fiery canopy
#

Fair, though I'd still suggest looking at the proximity sensor, setting it up gives you data

#

And later you can feed it to a Bayesian sensor and it will magically figure it out for you

plain edge
#

But the data doesn’t help me here, just checking if I leave zone is the same in this case…

fiery canopy
#

Not if you ignore the right zones.

plain edge
#

Another thing to add, or just use enter zone 😄

#

It’s makes it harder and harder, ok it would help after 10 years when I learn about the bay… Sensor but not now…

#

And why should I ignore a zone in this case ?

fiery canopy
#

Well, if you had a "shop" zone, and you went from there to zone 1, you don't want to know about that 😉

#

The problem you have is tracking yourself between zones.

#

Without knowing the geography of the area and so on it's hard to make another suggestion that doesn't involve those 4 zones, which are what is seriously complicating matters.

plain edge
#

Like trying to get it to look good in my brain, automation 1 I arrive at zone 1 I send a notification. I leave zone one and Boolean is on, notification, second zone Boolean still on notification. Proximity gives nothing here.

#

That’s why no proximity, no need to leave zones out, one zone one movement one automation

#

The problem is with bunch of booleans but from what we’ve understood I would have to create a couple of them + templates so it’s kinda the same thing in my case

#

I newer have easy problems ;D

fiery canopy
#

The question is really "why a notification at each zone"? But that's not a problem to solve right now

#

Try just having one boolean

#

It turns on when you're at work for 2 hours

plain edge
#

Will give it a thought about the one Boolean 🙂

fiery canopy
#

Then use that as your condition, and have it turn off after the last notification

#

(And at midnight or similar)

plain edge
#

The problem there would be if after work I drive through a zone but that doesn’t lead to home or next work or shop or so, so like something random, it would still get triggered, and if I drive past one zone like 5h later it would send false notification

#

Maybe a time limit and a turn of when Home

fiery canopy
#

That's where the other conditions come in

#

Zone 2 requires boolean "you were at work" and "zone 1 notification triggered"

plain edge
#

But from what I’ve got so far Boolean is my friend here ;D

#

That sounds good, it’s been so long that I’ve totally forgot about that…

fiery canopy
#

Just remember, the boolean makes you do the work, template sensors work for you

plain edge
#

But I will make the proximity Sensor just as an entity card to look at it when I’m bored and maybe I’ll come up with a plan later ;D and Boolean makes life easy in this case so I still don’t like sensors 🙂

fiery canopy
#

Alright

plain edge
#

So huge thanks ! Have a bit more understanding in sensors, templates, Boolean’s and proximity stuff 🙂 and it’s a huge mess 😄 thanks !!! 🙂

fiery canopy
#

It's always worth mapping out what you're actually trying to accomplish in a text file/on paper, and keeping that somewhere you check on regularly as you build your automations

plain edge
#

With time the text document would look as awful as docs to me 😄 I habe lists notes screenshots and reminders already, and thinking about creating text document in HA on VSCode 🙂 I’ll get to it, at least today wasn’t totally useles and now I can close the thread, again, THANKS ! 🙂