I hope it does not get dark early for you - you may not be able to see the clock to check if it worked
I'm looking at alternatives to having to have a phone. I bought one of those Tile things. I can detect it from the Pi using Bluepy but unfortunately it's not permanently acting as a beacon. I think that's how they get the battery life. So it probably advertises itself every 30 seconds or something. So if you lose your keys and use the app then waiting 30 seconds for it to pick them up isn't a massive problem. But if you have a Python script that sniffs every 60 seconds and gives each device 10 seconds to respond then it's going to be pot luck as to whether your sniff coincides with the Tile broadcasting. If I had more time, I'd see if I could work out what the pattern was and set the timeout so that it would always overlap with a broadcast from the Tile. The problem there is that I'd have to compromise on the lag with the occupancy. I'm checking every 60 seconds at the moment. I suppose it wouldn't be a great deal if I had to push that to 5 minutes so that the Tile detection had a chance.bensimmo wrote: ↑Sat Dec 01, 2018 10:43 amFor reference, as I'm reading through your blog post, My Bosch/Worcester/Nefity Wave setup used GPS for geofencing (hence the geo part).
But it means everyone needs to have a phone, have a mobile connection and have it on and well I have kids so that's not going to happen.
The app then tells the knows if a person is inside or outside that area and send it to the unit to modulate the boiler.
Nice idea, but not everyone has a phone on them.
Code: Select all
from bluepy.btle import Scanner, DefaultDelegate import bluetooth import time import datetime class ScanDelegate(DefaultDelegate): def __init__(self): DefaultDelegate.__init__(self) def handleDiscovery(self, dev, isNewDev, isNewData): if isNewDev: ts = time.time() timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') score = 0 if "cc:1c:41:40:ec:11" in dev.addr: #if "c1:ed:da:df:55:46" in dev.addr: print "Andy in", timestamp else: print "Andy out", timestamp elif isNewData: print "Received new data from", dev.addr scanner = Scanner().withDelegate(ScanDelegate()) devices = scanner.scan(15.0)
Code: Select all
Andy out 2018-12-01 13:38:26 Andy out 2018-12-01 13:38:28 Andy in 2018-12-01 13:38:31
Oldjake: Perhaps you could use a meaningful thread title for this and any future threads? It helps others browsing/lurking to decide if they are going to read or answer a thread, and "MagPi 76" is not helpful.
Hehe, thanks. SAF (Spouse Annoyance Factor) must always be considered in any project. In this case, the smart door is _for_ my wife, who is a private music teacher. This allows her to see who is at the door remotely, so if a student arrives early, she can let them in remotely without disturbing the current student's lesson. The pictures in the MagPi are of a prototype - I'm intending to put in a much nicer version in the coming weeks.