This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

[OLD] LogicMachine firmware 2017.04
#52
(08.05.2017, 08:53)admin Wrote: @bmodeco

Have you tried using the universal profile?
http://openrb.com/bluetooth-presence-detection-and-rssi

Can you post your presence script?

Hi admin,
I am using the script on thread : http://forum.logicmachine.net/showthread...t=presence
It worked fine before RC1. Tried rebooting, unplugging and so on - no difference.
Thanks Bart

Code:
require('ble')

-- enable ble
ble.up()

list = {}

-- mac -> group address mapping
known = {
 ['88:0F:10:10:F2:8A'] = '1/1/1',
 ['88:0F:10:4A:2C:36'] = '1/1/2',
}

ctime = os.time()

function callback(addr)
 local now, delta

 now = os.time()
 delta = now - ctime

 if addr then
   if not list[ addr ] then
     log('BLE found ' .. addr)

     if known[ addr ] then
       grp.write(known[ addr ], true, dt.bool)
     end
   end

   list[ addr ] = now
 end

 -- check for missing devices each 5 seconds
 if delta < 0 or delta > 5 then
   for addr, time in pairs(list) do
     delta = now - time

     if delta < 0 or delta > 60 then
       log('BLE missing ' .. addr)
       list[ addr ] = nil

       if known[ addr ] then
         grp.write(known[ addr ], false, dt.bool)
       end
     end
   end

   ctime = now
 end
end

ble.scan(callback)


Messages In This Thread
RE: [PRE-RELEASE] LogicMachine firmware 2017.04 - by bmodeco - 09.05.2017, 10:05

Forum Jump: