ESPresence for Home Assistant Presense Monitoring - Scargill's Tech Blog

The point of this article is/was to show how inexpensive ESP32 boards can be used as ESPRESENSE points in places around the home (for example) for detecting people and animals hopefully better than simple IR units.People carry phones and/or smart-bands – animals can wear tiny, inexpensive BLE beacon devices running off cheap CR2032 batteries – well, that was the idea – anyway.BIG caviat coming up… Time for an update: I wrote this entry on July 16, 2024, it is now exactly one month later.

We’ve had a short trip overseas and come back to this…..I can now with some experience state that for presense detection, the following: The Xiomi Mi 7 band works just fine – broadcasting regular BLE messages as to it’s whereabouts – these updates are appearing in Home Assistant, being picked up by my ESP32 ESPRESENSE units sitting on shelves around the house.In the photo right – the Mi7 is showing as being in my office.

I then took the Mi7 into the living room, right next to the “livingroom” ESP32-C3 sensor – did it show up? No? Did it show as being in the adjascent bathroom – yes.But then throughout this excercise I’ve known the C3 units are not ideal and will likely have to go in favour of Wemos D1 ESP32 boards- the point being – generally reliable presense/absense detection without false (bird, animal, insect) triggering.My “people sensing” cameras outside often trigger on swarms of flying insects at night and my IR office unit often puts the lights off if I sit quietly proof-reading in my office without moving for a while.

The latest Xiaomi Mi 8 band? Well, presumably to stop people complaining about short battery life, the location BLE information is not available in these wrist devices….as a complete aside, the Mi 8 keeps underestimating my steps (the Mi 7 was/is just fine as were it’s predecessors) – and it seems I’m not the only one making that statement.The cheap AliExpess location buttons – just a few euros each – slim, light, great looking in the packet – but words fail me in reality- so here’s a photo: Note how nice they look when new? WELL, the black one was attached to my cat LILLY’s neck a month ago on a standard metal ring – she doesn’t go out much or do much really other than eat and sleep.

I don’t know how obvious it is but the plastic bit at the end has snapped.That and a bad battery? The GREEN sensor I took off CLOE (who does go out) today – thinking – well, it might’ve been a bad battery – that is until I opened it up.This is July-August SPAIN, it hasn’t rained once recently – that has to be down to the cat simply drinking water as usual – and the dongle ending up in her water bowl – i.e.

UTTERLY USELESS devices (as I informed AliExpress when insisting on a refund).Above you’ll see that not one of my cats is showing as in the OFFICE , or LIVING ROOM, or BATHROOM etc… I’m after feedback – if you’re into ESPRESENSE….what ESP32 did you use – and what dongles did you use for pets etc? I’ve spent the afternoon trying to get to the bottom of this… was there a problem with the HOME Assistant ESPRESENSE monitoring? Well, normal phone monitoring is WORKING just fine (GPS) on both our phones – see below – not failed to notice our presense or absense once (myself and my wife).

The info below has nothing to do with ESPRESENSE – it is HA picking up on the phone’s GPS location – slow but it works: and the Mi7 sensing IS ESPRESENCE and that works – all but one of my ESP32 units (the C3 unit) has worked flawlessly for a month).Meanwhile a friend is making a design for a 3D-printed case for the Wemos D1 ESP32 units as standard Aliexpress cases out there are a bit awful looking for such a small device – almost there – but the AliExpress dongle units are going in the bin… and I’m seriously reconsidering the Xiaomi Mi 8 band – good job I kept the Mi 7.Check out the ESPHOME devices page – not one beacon: This morning (July 18, 2024) I checked sensors – ALL dead….

even one who’s battery reads 3v.I tried long-clicking the button (3 secs+) – and should have had 2 beeps for on, one beep for off – and when on a blue flashing light for a short time – no light asnd only the faintest almost inaudible “tick”.I replaced the battery – immediate success – 2 clear beeps and a bright blue flashing LED.

The ESPRESENSE fingerprint age showed the tag was very close… see below – itag..See below – “cyan Simba” – in the “office”.A good detective work morning then… useless battery life on the tags – tags not water-resistant, an issue with my Mi7 after a phone pair/unpair fiasco – and one unreliable ESP32-C3 (office has been 100% throughout).

Oh, exact battery life? I bought first tags June 27, then more on July 3 – so we’re talking 6 weeks battery life – (good battery supplier – Amazon – never had a bad batch of CR2032 batteries yet).Your issues – anyone had similar? I’ve reported back to AliExpress, claimed refund and left feedback to say these tags are not fit for purpose.Now I have to find ones which are.

Original article July 16: You may or may not have wondered about the difference between currently popular ESP32, ESP32-C3 and ESP32-S3 boards.My particular interest for now is their use as BT presense points for Home Assistant using ESPresense.What I was after was a small board that would fit into standard, cheap AliExpress plastic cases to provide presense points to detect if my wife, myself, our 4 cats or any combination are in or around the house (or not) by comminicating with Bluetooth BLE beacons on our phones or in the case of the cats, by picking up similar info from cheap BLE beacons.

Bathed in ignorance I started with the tiny ESP32-S2 board I had lying around.It didn’t take too long to realise this ESP32 board has no Bluetooth (making it pretty pointless really – a cheaper ESP8266 Wemos D1 would do almost the same job) – either way, no Bluetooth.I’ve also found that board doesn’t want to know about WLED.

Next stop, the ESP32-C3.I bought several of these and unlike many modern ESP-boards, I had to carefully manipulate the two on-board buttons just to program them.Once programmed up, they seemed to work perfectly as BT presense points.

That is until I got ambitious and tried adding an RGB light.Firstly, I could only get the light to work on certain GPIO pins – others would not work at all.Then I discovered that I’m not the first to have issues with these boards – just check around the web – GPIO problems seem to be quite common with the C3 boards – something to do with GPIO setup.

Off I went to AliExpress looking for alternatives like ESP32-based Wemos D1 (no, they are not the same size as the ESP8266 Wemos D1 as the ESP32 packaging is larger than that for the ESP8266).39mm long by 30mm wide excluding the USB-C connector overhang.Plugging an ESP-WROOM-32-based board (USB-C) into my PC I started up the ESPresense online installer (similar to Tasmota online installer) – standard install – noting the displayed usb driver below: I selected install – and the first thing that came to my attention: NO BUTTON PUSHING NEEDED.

GOOD.Several seconds after I started install, the chip was ready to accept my WiFi details.Well, this never seems to work properly with ESPresence and any board I’ve tried, so as usual I took the serial console option (the board was after all plugged into the serial already) and entered 2 lines into the console.

wifi-ssid myssid wifi-password mypassword You understand I actually entered my nearest wifi ssid and its password.Next – after booting the board to be safe, I opened up Advanced IP Scanner on my PC and told it to scan.At address 192.168.1.137 appeared a new device called espresence-1cef34.

I took this name (I could have used the IP address) and put that into a browser (in my case with the suffix .lan).As always, I started by changing the “room” name – to “foyer” – for the purpose of testing – I’ve done the other rooms already – and put in my MQTT server (broker) name, username and password, leaving the port as default.I left everything else as default and hit SAVE then RESTART.

After changing the address in my browser – http://espresense-foyer.lan/ I ended up back on that same page.I was now up and running with a new ESPresense point called espresense-foyer.On my other PC I went into Home Assistant, looked up ENTITIES and sure enough… a shedload of new entities magically appeared on a search..

Next – on my Home Assistant SENSORS page (Dashboard page) I have some test buttons to see if I can spot cats or my phone – so I added in a few simple lines to see if the unit was picking up my phone).Sure enough, putting my phone anywhere near the new board resulted in: And the code I added for the sake of completeness: See the line starting in “- value: foyer” all the way to but not including the line stating “- operator: default”….- value: testing styles: state: - font-size: 18px - color: '#00ffff' - value: foyer styles: state: - font-size: 18px - color: '#ff00ff' - operator: default styles: state: - font-size: 18px - color: yellow So, after a great start, I need to test reliability (the C3 was less than reliable with any IO attached) and see how this new “Wemos D1” ESP32 board handles IO.

But meanwhile, my SUPER MINI ESP32-S3 boards have arrived from AliExpress… just over half the width and just over half the length of the above at 24mm long by 18mm wide again excluding the USB connector overhang.What’s the first thing I noticed on plugging this little S3 board into USB (USB-C again)? Well, where the larger board has a bright red light always on a tiny blue light flickering with data, the SUPER MINI has an always on RGB light which settled on white’ish and a tiny blue data light.The S3-based super-mini gets hot-ish to the touch when connected to USB-C power.

Depending, I may have a use for that light.So, as I’m hooked into serial, let’s call this one FOYER2 and see what happens? Same seamless flashing – let’s find out.Note the slightly different serial driver above… this time not so fortunate – the chip appeared to erase and flash as before – no problem – but – at the console – on RESET DEVICE..

I tried a second unit – same result.SO I took the SUPER MINI and tried flashing TASMOTA onto it… https://tasmota.github.io/install/ – no problem at all – after giving it a name – see below – so what is it about some ESP32 devices and ESPresense? These boards are so tiny and inexpensive – it would be a shame not to pursue this so I’ve put in a bug issue in the ESPresense Github page – but I note the author has not responded recently to any issues as far as I can tell.So, back to the ESP32 boards I talked about above – and AliExpress cases… Above the box as they arrive with one round hole on either side.

Problem having that second hole? Actually no, handy for ventilation.One of the holes has to be enlarged with a file to be a tight fit for te USB-C female connector.Also for a perfect fit, the corner of the board at the left of the USB-connector should be filed just a little.

No tracks there so no problem.Note that I’m fitting the board into what you might think of as the female piece of the board, as shown on the right in the larger picture above.Pretty much a perfect fit, to be used here an ESPresence point.


Read More
Related Posts