Rapid Presence Detection via HTTP/OpnSense

Hi,

Wasn’t sure how to categorise this.

New here (go easy!) but am fairly competant in IT (I’m a bit of a network admin but my only programming experience of any sort is the odd bit of VBA in Excel) but seem to be getting there slowly.

First project seems to be running well and pretty solid.

I’m running HASSIO on a headless ESXi host in my loft with a ‘Conbee 2’ USB stick passed through for Zigbee. I also have an OpnSense firewall running on the host which takes care of my DDNS. Right now I only have one device hooked up (Aqara two gang wired switch) and have muddled my way through getting the thing to turn on before sunset and off at 10:30pm. Now I’ve done it, it’s been four days and seems pretty solid. Very satisfying!

The Conbee stick seems to have issues where it continuously boot loops i.e. disconnects and reconnects. I’ve tried numerous ports and extension cables with no joy but my automations are firing when they should, so I’m not bothered right now. Seems to be a common issue.

I thought such basic setup was going to be easy but encountered the following difficulties:

I found that following the website tutorial and entering an offset of -30 didn’t work and that the offset format had to be more like -hh:mm:ss to work. Also the JSON was waaay pickier than VBA (It took me over an hour to call a service to turn on the switch using the dev tool due to brackets and spaces not being right!)

I also found that installing on the ESXi host was difficult - the image just wouldn’t boot! It had to be thick provisioned (VMDK copied) and EFI booted, plus the NIC had to be EV1000, for anyone interested.

The next part of my mission is the security system; I have a Hikvision NVR I’d like to integrate, automatically turning on and off push notifications (with photo attachments) based on presence. Eventually I’d like to involve the alarm system also, but one step at a time.

So far I’ve done the following:

  • Secured the sever using Let’s encrypt.
  • Employed the ‘secrets.yaml’ file.
  • Got location tracking working using OwnTracks over HTTP and have set up some zones.

The current issues are:

  • I’m using port forwarding to expose HA for OwnTracks updates. I’d be much more comfortable not doing this and leaving behind my VPN server, but at present I’m not too concerned.
  • I’m experiencing the lag everyone seems to have with OwnTracks detecting ‘Home’. No good for disarming. I gather many are looking at BLE beacons or using dd-wrt based routers, or are doing continuous ping scans to speed this up.

Roadmap and Questions:

  • For notifications it looks like the most advantageous option for me is Telegram; will be giving this a go shortly.
  • The Hikvision integration looks straightforward enough, reckon I’ll be able to set up line crossing detection and basic push notifications via Telegram. Attaching pictures may be another matter though.
  • The difficult bit looks like the quick presence detection; is there no way of getting HA to check against the DHCP leases on OpnSense? I’ve seen the use of BLE beacons mentioned but everyone seems to be into MQTT - Not sure why I’d need this; isn’t there any solutions using HTTP? Monitor.sh looks interesting but again, MQTT.
  • What’s the advantages and disadvantages of using OwnTracks to use the BLE beacon and report to HA vs doing it the other way around and using HA with a Pi Zero or something to ‘detect’ devices?

Really confused on the presence detection; can’t wait to start stringing it all together. Sounds ridiculous but I’ve been sat watching the CCTV whilst away every night for the past few nights just to watch the lights come on!

Thanks.

1 Like

@mrrodge, did you ever solve this, I’ve just installed OPNsense and finding it really good.

It’s great - we use it at work for over 150 clients/VPN users and it’s rock solid.

Nope never did solve it, decided it was a can of worms I didn’t have time for so now use RFID and the companion app and it’s good enough for me for now.

I can’t get OPNSense presence detection working by following the online tutorial :frowning:
Don’t know what I’ve missed

I cant help im afraid, Im now running pfsense and use unifi access points for presence detection.

For some reason it started working, I’m not entirely sure why exactly :frowning: