this post was submitted on 19 May 2024
124 points (93.1% liked)

homeassistant

12152 readers
32 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 2 years ago
MODERATORS
 

"Hur Hur that's what a timer on your phone is for dude"

Yeah but this was a smart plug that was going dusty in a drawer!

Anyway it's not the notification that makes my brain tickle in that special way, but the fact that my HA takes note of who was in the kitchen when the air fryer was started and only notifies the floor with that person on when it's done.

Now I've worked that logic out with a silly Air Fryer notification I can reuse it in all my other automations.

top 39 comments
sorted by: hot top controversial new old
[–] Lifebandit666 25 points 6 months ago* (last edited 6 months ago) (3 children)

For anyone else wondering how I'm keeping track of who's where, https://espresense.com/

I tried Room Assistant a year or 2 ago and it SUCKED. I have a 4 storey townhouse and had 2 nodes running Room Assistant and I could be stood next to 1, two floors away from the other and that's the one it said I was closest to.

The idea is that by detecting the strength of the Bluetooth signal, the node with the best signal was closest, but it just didn't work (for me).

Anyway espresence is better, especially because I've doubled up and I bought 4 esp32 boards with pins off AliExpress for under £12, and arrived within a week.

You connect the little chip to your pc and flash a firmware from Google Chrome, then hook it into your WiFi, go to its page and give it a name, and hook it into your MQTT.

4 boards later I have a node per floor.

Next I added our phones to it by pairing them to it, then deleting the pairing on the phone. Add the Bluetooth connection to HA config and you're away! Well...

So you have to connect what the boards say to what it means in HA yourself. You get "bedroom" off Espresence and have a Bedroom zone but you have to put the pieces together yourself.

I ended up making binary sensors for each room in Node Red. Did I leave the room? Who else is there, nobody? Ok mark it clear... You could just make helper switches and use them but I was feeling fancy. I've already posted recently about the Binary sensor.

But once you've done that, you just base your automations off the state of the switches you made.

So the age old "The front room motion sensor stopped detecting, should the lights go off?" question, now becomes...

Huh I must have stopped typing there...

...much easier to solve. I can still have the old "TV on?, wife's laptop connected to Bluetooth?" bits in, but having Bluetooth presence detection AS WELL makes it much more reliable, for a measly £12

[–] Emperor 1 points 6 months ago (1 children)

I ended up making binary sensors for each room in Node Red. Did I leave the room? Who else is there, nobody? Ok mark it clear…

Why not use mmWave presence sensors?

[–] Lifebandit666 1 points 6 months ago (1 children)

I already have motion sensors everywhere but I also have cats. They make it seem like there's people wandering around the house all the time.

I've placed a lot of them on top of door frames that seem to miss the cats, but in the front room there's sofas for them to climb up on which means they still get picked up.

I have also since this post purchased MMwave sensors. But they're worse for picking up the cats.

So what I'm trying to do is add more sensors so HA has a better picture of who is in the house, and when.

To give you an idea, yesterday I took my wife to a Dr appointment, my kids are at their grandparents, but when I was sat on the car waiting for Wifey I noticed my kitchen lights were on in the app.

The Drs turned into the hospital and I was out for a good 4 hours, but got home and added "Is anyone home?" to my lights automations.

The cats don't need lights

[–] Emperor 2 points 6 months ago (1 children)

I have also since this post purchased MMwave sensors. But they’re worse for picking up the cats.

You can fine tune some and the Aqara FP2 seems to do a good job ignoring pets.

[–] Lifebandit666 2 points 6 months ago

Yeah I've kinda found the sweet spot now to be fair, but I'm using an esp32 board and some dude's yaml, so I've been groping in the dark a bit

[–] Cyber 1 points 6 months ago (1 children)

Noice.

But... how much faffing did you have to do to get the tuning right?

I've recently started using this and have 3 different ESP modules and I'm having a hellofatime getting them to show near-enough results, let alone accurate.

1 of them literally has the phone on top of it and it thinks it's 4m away.

I've gone upto absorbtion factor 10 (Spock) with an RSSI adjustment of 6, and that's passible on 1 device, but not another

So... what's your secret?

[–] Lifebandit666 1 points 6 months ago* (last edited 6 months ago) (1 children)

The secret is not caring it's 4m away as long as it says you're closest to that one. It's not accurate, it's a guess made with software.

As I've said I've sat at my PC on the front room and watched it say I'm in my bedroom and kitchen.

So for example my front room lights are based around an input boolean. They're triggered on by motion but back off by whether the TV is on, my wife's laptop is connected to the WiFi, the pc is switched off, and everyone's presence is not in the front room. I already did all that and now I have presence as well.

It used to be that my wife would be sat there on her phone and the lights would go out, now because her phone is on her person they stay on.

Like I say, they're not perfect but they are better than not having them.

I don't think I'll ever have my music follow me around the house.

Oh also try instead of basing automations around whether you are in a room, instead use "is not"

So for example when I get out of bed and get up for work by bedroom lights come on with my alarm. When I go downstairs and make a brew I am no longer in the bedroom so my automations turn off the lights in there. Is not "bedroom"

It's triggered by the motion sensor outside my bedroom door, then it waits for my presence to be anything other than bedroom. Since I'm moving around the house it'll trigger at some point.

Similarly my sleep automation turns off when the bedroom is no longer occupied. But that's when my wife gets up 2 hours after me. It's also triggered by motion, but then waits until my bedroom presence sensor no longer reads anything

[–] Cyber 2 points 6 months ago (3 children)

Ah, ok... I see. I guess you've not filtering on distance then, ok. I see all my neighbours stuff on 1 sensor, so automatically started filtering (and then attempting to tune)

Good point on the negative room sensing, I think I need to start this again... but also ditch the crap module.

Thanks

[–] Lifebandit666 1 points 6 months ago

Yeah I have a million Bluetooth devices picked up but I've only put 4 of them so far into my Ha sensors. Fuck knows what the others are, but we have soany devices in the house that I can't keep track, then there's the neighbours' stuff too...

Interestingly I stumbled across a YouTube short yesterday about hacking an android device from only knowing it's Bluetooth Mac address, so theoretically I could really piss off my neighbours if they drove me to it.

[–] Lifebandit666 1 points 6 months ago* (last edited 6 months ago)

Just coming back in to say that yeah, now I've used it as a primary trigger instead of a secondary check it seems I'm all over the place in Bluetooth land...

I don't have a motion sensor in my bedroom. I do have an old phone on a charging stand that I use as a Smart Clock, and the camera of that can be used as a motion sensor. It's pointed at my head when I'm in bed so it's not in an optimal motion sensor position... Just setting the scene for you.

Now I had an automation that turns bedroom lights on based on motion so when I wake up in the middle of the night for a pee I have a lamp that turns on for five minutes.

Well of course I wanted MORE from this extra from my clock, so I've added presence in the room as a primary trigger of my lamps.

I'm stood in my room watching my lights popping on and off again every 30 seconds...

Not great as a primary trigger, more a secondary check.

Anyway I'm gonna try and change it by adding "in room FOR 30 seconds" to my sensors, seems to be helping so far.

Also limiting reporting distance in the settings for each node to 4-6 meters.

Or maybe stop trying to use it as a primary sensor lol

[–] Lifebandit666 1 points 6 months ago* (last edited 6 months ago)

Yeah you certainly need more than one sensor. I have one per floor

[–] peregus@lemmy.world 1 points 6 months ago* (last edited 6 months ago) (1 children)

This is very interesting, ~~thsni~~ thanks! How fast are the base stations? Is it all down to the smartphone speed to connect to a BT device? What smartphone are you using?

[–] Lifebandit666 3 points 6 months ago (1 children)

You pair the device to a base station once to create an entity but you don't have to if you know the mac of your phone. So there's no pairing involved in the tracking.

You can use the HA app to create a beacon on your phone when you're on your home WiFi and not pair anything, just plumb the id into HA.

The speed is quite fast but there is still a lot of false positives. I've sat and watched mine and my wife's phones just pinging around the house, but if you add some "for X seconds" to your automations it becomes much more stable.

I've got 3 android phones and an iPhone tracked at present

[–] peregus@lemmy.world 2 points 6 months ago
[–] kurikai@lemmy.world 16 points 6 months ago (2 children)

How are you taking note of who was in the kitchen?

[–] Lifebandit666 9 points 6 months ago (1 children)

Espresence, it tracks Bluetooth and guesses which node it's closest to, it's guesses are really good

[–] snooggums@midwest.social 8 points 6 months ago (1 children)

So ninjas could sneak in along as they don't use bluetooth?

[–] Lifebandit666 5 points 6 months ago (1 children)

Wouldn't even have to be ninjas tbh, but yeah fuck it, ninjas!

[–] bane_killgrind@kbin.social 8 points 6 months ago (1 children)
[–] Lifebandit666 6 points 6 months ago (1 children)

Now you've got me wondering what marshal art Armish Ninjas would learn.

Like where I'm from in Yorkshire the marshal art is Ekky Thump, and in Scotland they learn Fah Kyoo...

Kung Plow?

[–] bane_killgrind@kbin.social 2 points 6 months ago

I think the absence of Bluetooth and the knowledge how to butcher an animal is enough to interdict your shit brother

[–] filister@lemmy.world 3 points 6 months ago (2 children)

Frigate or Bluetooth I guess

[–] BOFH666@lemmy.world 3 points 6 months ago

Bluetooth or wifi, depending on the number of accesspoints..

Anyway, a really smart hack!

[–] Lifebandit666 1 points 6 months ago

Yup espresence

[–] sabreW4K3@lazysoci.al 14 points 6 months ago

Nice. You took it one step further than I would've and in such a nice way.

[–] Donut@leminal.space 12 points 6 months ago

That's what the world needs. Smart notifications. And I'm not being sarcastic, this is such a good example of how something like that enriches the user experience that a timer on your phone could never achieve. Keep it up!

[–] ArbiterXero@lemmy.world 7 points 6 months ago (2 children)

I love the concept but……

Air fryers and kitchen heating appliances shouldn’t be left on their own much….

Maybe an oven, but certainly not the countertop version, just for fire safety reasons …

[–] Lifebandit666 18 points 6 months ago

Meh, disagree.

[–] BReel@lemmy.one 10 points 6 months ago (2 children)

I’d argue an airfryer is better to leave alone then an oven. They turn off on their own, so if you forget about them, it runs its 20 mins or whatever then turns off.

My oven is on for the weekend if I fuck up haha.

[–] ArbiterXero@lemmy.world 3 points 6 months ago

The insulation on an oven is 10x that of an air fryer.

…. And sometimes air fryers don’t turn off.

An oven is usually designed to last a decade, an air fryer sometimes only lasts a year.

VERY different build quality standards.

[–] Tja@programming.dev 1 points 6 months ago

Of course, depends on the oven and the air fryer. Modern ovens have timers and even whole programs.

[–] Tadpole@aussie.zone 5 points 6 months ago

That's really cool! How did you do the detection of who started it and what floor they're on?

[–] dream_weasel@sh.itjust.works 1 points 6 months ago* (last edited 6 months ago) (1 children)

I've got one esp32 board with espresence on it right now, but I sort of balked when I had to go in the HA settings and enable BLE on high power for my phone. How does it affect your battery life?

Also, as a minor annoyance, I could only flash the board from chrome when connected to a WINDOWS machine which I find pretty nasty 🤢, but I may be in the minority there.

Edit: how do you know when to send the notification btw? Did you configure some automation or script that just says how long until notify?

[–] Lifebandit666 1 points 6 months ago (1 children)

how do you know when to send the notification btw? Did you configure some automation or script that just says how long until notify?

When power drops below a certain wattage I figure the cooking it complete. I've set it to 20 because it seems my air fryer drops to 24W every few minutes (when it's reached temp I guess) and my rice cooker drops below 50W when it's on the Keep Warm cycle.

So above 50W it checks the room and below 20W it calls a notification from the people that were in the room.

Also, as a minor annoyance, I could only flash the board from chrome when connected to a WINDOWS machine which I find pretty nasty 🤢, but I may be in the minority there.

Yeah I was a Linux-boy for a decade before a friend gave me a gaming PC he made out of spare parts for me. His one stipulation was NO LINUX so I'm stuck with Windows. But I get ya.

[–] dream_weasel@sh.itjust.works 1 points 6 months ago

Oh neat. I don't think my smart plugs show power consumption.

[–] TedZanzibar 1 points 6 months ago (1 children)

The whole point of home automation is that it's automated. Setting a timer on your phone is for chumps.

I have a similar thing to notify us when the washing machine is done, only without the cool presence stuff - I'll have to look into your setup for that!

I also use a smart plug to monitor our toaster. Not for notifications but because it uses a mechanical timer that if it fails, will also fail to turn the element off, so it comes with dire warnings about always unplugging it after use. Instead I just have HA setup to turn off the plug if it ever draws power for more than 4 minutes.

[–] Lifebandit666 1 points 6 months ago (1 children)

Don't know why you've been down voted but don't worry I put you back up to positive.

Your toaster automation sounds like what I had to do with the old dishwasher. It would finish the cycle but not stop, so it would continually try to keep up to temperature for some reason.

So I had my notify automation for when it was done and then I had it switch off when the power dropped.

Minor inconvenience to that setup was having to turn it back on again when I wanted to use it. I didn't wanna have to go under the sink and wade through all the shit in there to get to the plug so I used Google "Hey Google, wash up"

But we have a new one now so I can leave it on.

I also have the washing machine notification. At present it announces when the motion sensor in the kitchen picks up movement and the washer is finished, and sends a notification to the phones in the house when the announcement is made with "I emptied it" and "Ignore" so you walk in the kitchen, get shouted at to empty the washer and a phone notification.

But I am planning on having the same presence detection pick up who triggered the motion sensor and only notify that phone, just haven't gotten around to it just yet

[–] TedZanzibar 2 points 6 months ago (1 children)

Thanks for the re-upvote. My guess is it was someone who sets timers on their phone. 😂

Dammit, now you've got my head swimming with ways to improve the washing machine stuff. I bet a vibration sensor on top could be combined with the smart plug power monitoring to detect when it's being emptied.

How did you do the Google-turning-on-the-smartplug thing? I feel like I'm missing a lot of tricks by not having HA integrated into those. I just use them for audible notifications currently.

[–] Lifebandit666 1 points 6 months ago

Just hooked my HA into Google Assistant so it can see my devices with this https://www.home-assistant.io/integrations/google_assistant/ then made a Google automation to match the words to turning the plug on.