mKeRix / room-assistant

Presence tracking and more for automation on the room-level
https://www.room-assistant.io
MIT License
1.27k stars 122 forks source link

Has anyone run this on OS X? #123

Closed mikeage closed 4 years ago

mikeage commented 4 years ago

Is your feature request related to a problem? Please describe. I'm running room-assistant on two raspberry pis now, but I have two places in my house which have poor Pi coverage but do have Mac OS machines. Is it possible to run this on OSX? [it starts, but doesn't either (a) print any errors or (b) detect any bluetooth devices. Of course, hcitool / hciconfig are not available.

Describe the solution you'd like Runs on OS X (without using docker)

Describe alternatives you've considered Buying more Pis :-)

Additional context Add any other context or screenshots about the feature request here.

mKeRix commented 4 years ago

Generally you can run room-assistant on OS X as well, it's just that not all integrations will work of course. BLE should work fine, the IDs might be different if you're not using iBeacons though. Bluetooth Classic won't work that way because of the missing hcitool command. You may be able to get it running through Docker... I haven't tried though.

Which integration are you trying to run specifically?

mikeage commented 4 years ago

BLE, with some Mi band devices. On Linux platforms, I can see them using hcitool lescan, and confirm that the same devices show up on room-assistant.

I can't run docker because my Mac is too old (yes, there is such a thing; it's an old Mac mini, and doesn't support the full hardware virtualization).

Although having typed that last sentence, I realized I should check if it supports BT 4.0 / BTLE; turns out, it doesn't. Sorry for wasting your time.

mikeage commented 4 years ago

I've tried this on my newer MacBook; you were correct about the IDs being different. I'm not quite sure I understand why; I opened https://github.com/abandonware/noble/issues/51 . Any thoughts?

mKeRix commented 4 years ago

If I remember correctly, macOS generates its own IDs for Bluetooth devices and doesn't pass on the MAC to the library unless you have paired the peripheral to your Mac at least once. I think the IDs are at least permanent, so maybe we can think of an alias feature as a workaround. That could then allow you to register whatever IDs you configured on the machine as different IDs in the cluster. Actually finding the correct IDs for your devices is still a PITA then though.

mikeage commented 4 years ago

Interesting. I currently have 5 devices at home, which I expect to be reasonably within range. It looks like some have a fixed ID, and some others actually change when restarting room-assistant (but not on every rerun of room-assistant. Perhaps there's some process within the OSX bluetooth stack that's restarting on its own?).

Strangely, one of the devices consistently reports a positive RSSI (this is one of the fixed IDs). I did not think that was valid.

mKeRix commented 4 years ago

Positive RSSIs can be possible actually, at least if the device is really close. But if you were moving the device around and still saw positive values all the time it's probably not correct.

Unfortunately it's hard to detect things without a fixed ID. #121 is a feature request to allow a whitelist by name instead of id - do you get consistent names showing in the advertisements? Then that may be another workaround.

mikeage commented 4 years ago

It doesn't look like I'm getting names at all. The IDs and the names are identical for everything. (it seems like I'm getting five or six consistent devices and two that are sending a random ID (so I assume random MAC) every ~10 minutes; I see them on my Linux machine as well.

mKeRix commented 4 years ago

Hm, alright - so would you consider an "alias" feature to be useful? So that you can at least map the consistent IDs to the proper IDs as used on Linux devices?