Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track iPhones via BLE #309

Closed
mKeRix opened this issue Oct 20, 2020 · 101 comments
Closed

Track iPhones via BLE #309

mKeRix opened this issue Oct 20, 2020 · 101 comments

Comments

@mKeRix
Copy link
Owner

mKeRix commented Oct 20, 2020

Is your feature request related to a problem? Please describe.
BLE tracking is quicker and a bit more reliable than BT Classic tracking. It would be awesome if we could also get this working for iPhones.

Describe the solution you'd like
The idea for this was spawned in a reddit comment thread. It turns out you can make iPhones and Macs (not Watches!) act as a peripheral and advertise a custom service via BLE. For this we need to write our own app. That service can then provide a static ID, which we can tie to the periodically changed random ID. Based on this you can then actually track the iPhone based on its BLE advertisements. Each time we see a new ID advertise our custom service we connect to the service and find the "room-assistant" ID that belongs to the cloaked BLE MAC.

Describe alternatives you've considered

  • BT Classic tracking -> works, but slower than BLE as mentioned above
  • Inverse the Bluetooth peripheral/service relationship -> added complexity and a bit weird in the handling
@5a3ee
Copy link

5a3ee commented Oct 23, 2020

How feasible would this be? Am I understanding correctly that an app would be required? Haven’t done any Swift coding in a while have done just about enough to potentially make it work if room-assistant will definitely work with it.

@mKeRix
Copy link
Owner Author

mKeRix commented Oct 23, 2020

As far as I understand it right now we would need an app that uses the Core Bluetooth APIs in peripheral mode. The app should register a BLE service that can also be called in the background (needs some special setting). The service should be advertised under a known name, so that we can discover it from room-assistant. After connecting to it it should provide a static ID (possibly protected by a password for privacy reasons). The static ID should probably be configurable in the app UI.

I have no clue if it would be allowed into the App Store like this though.

@mKeRix
Copy link
Owner Author

mKeRix commented Oct 23, 2020

Crownstone goes a bit more into detail on how to achieve this here. In contrast to what was discussed on reddit this does not require connections to the device.

I spent some time writing a sample test app in Swift, which can now advertise stuff in the background. I now need to test my sample app to see if I can reproduce the findings from the link above.

@mKeRix
Copy link
Owner Author

mKeRix commented Oct 25, 2020

Another update for the interested people: I managed to get this working! There still are some open tasks and the whole functionality isn't perfect yet, but it can correctly identify my test iPhones BLE advertisements without pairing even when it's in standby. I ended up limiting it to just the initial idea, as the additional information from Crownstone wouldn't add much benefit for the room-assistant functionality.

Next steps: clean up some things, make the app a bit prettier and then figure out how to make it available via TestFlight.

@adamrutt
Copy link

adamrutt commented Oct 25, 2020 via email

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 3, 2020

I've submitted the app version I had to TestFlight for review, but since the UI part is very simple and it is more or less just a tool for setting background Bluetooth settings I fear that it may be rejected on the grounds of not providing a "minimum functionality". I still wanted to see if it's enough for TestFlight in this first version.

If this fails I'll have to think of some features I could add to the app (maybe viewing current RSSI levels for easier tuning?). Implementing those will then take some more time, as I'm not really versed in Swift or iOS development.

@srmooney
Copy link

srmooney commented Nov 3, 2020

What about adding as part of the Home Assistant Companion App?

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 3, 2020

We could ask, but I don't think they would want it in there. The Home Assistant app currently asks for no Bluetooth permissions, this requires "Bluetooth always" permissions. I feel like it would be hard to argue to include this code and request additional permissions for a project which is not under their control.

At least this could be a fun exercise for getting into Swift and all that stuff, even if it takes some time.

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 9, 2020

Good news! The app has been approved for beta testing via TestFlight by Apple. I will distribute a new beta release of room-assistant and the app link soon.

@rjbudke
Copy link

rjbudke commented Nov 10, 2020

I would love to help beta test.

github-actions bot pushed a commit that referenced this issue Nov 11, 2020
# [2.13.0-beta.1](v2.12.0...v2.13.0-beta.1) (2020-11-11)

### Bug Fixes

* **bluetooth:** attempt adapter reset on LE timeouts ([386ef37](386ef37))

### Features

* **bluetooth-low-energy:** allow iOS tracking via BLE ([17d537d](17d537d)), closes [#309](#309)
* **bluetooth-low-energy:** share discovered apps with cluster ([188e76c](188e76c))
@github-actions
Copy link

🎉 This issue has been resolved in version 2.13.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 11, 2020

You can try this now! You will need to install the beta version of room-assistant and the app on any device you want to track. The app is available through TestFlight here: https://testflight.apple.com/join/OpCkeHf8

Would love to hear any feedback you might have.

@fidonet
Copy link

fidonet commented Nov 12, 2020 via email

@maa-x
Copy link

maa-x commented Nov 12, 2020

I only have a single device to test with, but am noticing the same behaviour. Grep on output for the first three chars of the ID displayed in the app doesn't return anything.

Also a feature suggestion, it'd be nice to be able to copy the ID from the app! Thank you tons for the hard work and excited to see this happening!

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 12, 2020

Are you on the latest room-assistant beta version as well (v2.13.0-beta.1)? You should see some logs saying "attempting app discovery for tag xyz", hopefully followed by a message that companion app was discovered with the IDs that you are shown in the app. Sometimes it also helps to turn Bluetooth off and then on again in the settings (not the control center!).

You can also try and see if the service is being advertise correctly by installing the nRF Connect app on an extra device (e.g. your iPad), then scanning and connecting to the device that you want to track (e.g. iPhone). After connecting you can swipe over to the left on the device details page, which should show an attribute table. Does this table contain the room-assistant service (UUID starting with 5403C8A7) and characteristic (UUID starting with 21C45F33)? If you click the little down arrow on that characteristic, does it show some value?

@maa-x
Copy link

maa-x commented Nov 12, 2020

Running 2.13.0-beta.1, however I am not seeing any logs stating that it is attempting app discovery for tag xyz. Do I need to add the UUID to the whitelist even if I have not seen it in the logs with an empty whitelist?

How would room-assistant know that the UUID I gave it is for the companion app?

@maa-x
Copy link

maa-x commented Nov 12, 2020

Have added the UUID to the whitelist, configuration looks like this now:

global:
  integrations:
    - homeAssistant
    - bluetoothLowEnergy
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.xxx:1883'
  mqttOptions:
    username: mqtt-user
    password: pass
bluetoothLowEnergy:
  hciDeviceId: 0
  whitelist:
   - id-in-companion-app-with-dashes

But I still do not see companion app logs.

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 12, 2020

The ID for the companion app looks different than MAC addresses, it shouldn't make much of a difference though. I suspect that an assumption that I have made to limit the amount of devices it tries to discover from isn't applicable for the real world and only worked for my test device.

You can help me try this out with some manual editing of the code. If you are on a Pi Zero, you can edit /opt/nodejs/lib/node_modules/room-assistant/dist/integrations/bluetooth-low-energy/bluetooth-low-energy.service.js. In line 251 you should see a check for the manufacturerData length. Could you decrease to e.g. 6 (or even take it out completely) and see if that makes the companion app show up? So from tag.peripheral.advertisement.manufacturerData.length > 10 to e.g. tag.peripheral.advertisement.manufacturerData.length > 6.

I will also see if I can test with some more devices.

EDIT: After editing the file you need to restart room-assistant of course.

@maa-x
Copy link

maa-x commented Nov 12, 2020

Set it to 1 and it was attempting connections with everything more or less. Set it to 6 and it does attempt a couple unsuccesful connections but most importantly it discovers the companion app.

Testing a little bit further now, I don't see the MQTT topic I need to add to home assistant to add that device to home-assistant. I also forgot how to debug that element.

This is all I see in the logs (verbose off):

11/12/2020, 11:31:45 - info - BluetoothLowEnergyService: Attempting app discovery for tag 7214500ef242
11/12/2020, 11:31:46 - info - BluetoothLowEnergyService: Discovered companion app with ID UID-VERY-LONG-AND-MANY-DASHES for tag 7214500ef242
11/12/2020, 11:31:46 - info - BluetoothLowEnergyService: Discovered new BLE peripheral UID-VERY-LONG-AND-MANY-DASHES with ID UUID-VERY-LONG-AND-MANY-DASHES and RSSI -82

@mKeRix
Copy link
Owner Author

mKeRix commented Nov 12, 2020

Alright, seems like we need to fine-tune that number in the next versions. I will put out a new beta with the value decreased later today so that this at least works without manually editing stuff.

The entity should appear automatically in HA as long as the ID is in the whitelist, at least if you have auto discovery enabled in HA. The state topic for the sensor should be in room-assistant/sensor/ble-UID-VERY-LONG-AND-MANY-DASHES/state.

@fidonet
Copy link

fidonet commented Nov 12, 2020 via email

@maa-x
Copy link

maa-x commented Nov 12, 2020

I believe I have everything setup correctly as it stands, however I am not seeing the entity appear in the integration - despite other sensors (cluster leader and cluster size) being created successfully.

In my logs, I see this:

11/12/2020, 2:54:41 PM - info - BluetoothLowEnergyService: Discovered companion app with ID UID-VERY-LONG-AND-MANY-DASHES for tag lowercaseidnodashes
11/12/2020, 2:54:41 PM - info - BluetoothLowEnergyService: Discovered new BLE peripheral UID-VERY-LONG-AND-MANY-DASHES with ID UID-VERY-LONG-AND-MANY-DASHES and RSSI -55

Indicating that the companion app was discovered by room-assistant.

I have since deleted the MQTT integration and restarted the entire process twice, but to no avail. Both Rasperry Pies have been restarted too.

The config file for both is this

global:
  integrations:
    - homeAssistant
    - bluetoothLowEnergy
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.232:1883'
  mqttOptions:
    username: mqtt-user
    password: mqtt-pass
bluetoothLowEnergy:
  hciDeviceId: 0
  whitelist:
   - uuid-very-long-many-dashes-but-lowercase

Listening for events with topic room-assistant/sensor/ble-UID-VERY-LONG-AND-MANY-DASHES/state shows no events in Mosquitto / Home assistant.

@maa-x
Copy link

maa-x commented Nov 12, 2020

The issue lies in the fact that unlike the other BLE entities, these have to be upper case in the config, as such:

global:
  integrations:
    - homeAssistant
    - bluetoothLowEnergy
homeAssistant:
  mqttUrl: 'mqtt://192.168.1.232:1883'
  mqttOptions:
    username: mqtt-user
    password: mqtt-pass
bluetoothLowEnergy:
  hciDeviceId: 0
  whitelist:
   - UID-VERY-LONG-AND-MANY-DASHES

@maa-x
Copy link

maa-x commented Nov 12, 2020

Predictably, we're now hitting Apple's restriction regarding BLE tracking.

If the iPhone is locked, no more advertisements are made. I imagine there is no workaround for this as I'd expect we would have otherwise seen functional "Track and trace" type apps not using the Apple SDK for it. Unless we can initiate a sort pairing request that would allow locked tracking, this is probably the best we'll get.

Other than that, I am seeing significantly more robust tracking in a small flat. Previously on Bluetooth Classic, I would constantly be jumping from room to room, which is not the case now, as the BLE integration tracks the phone much better.

@maa-x
Copy link

maa-x commented Nov 12, 2020

This issue from a different but very similar project (track and trace basically), indicates that it might be possible by flipping the relationship once the app goes into the background: instead of asking the iPhone to advertise, room-assistant should instead broadcast beacons whose handling can be delegated to iOS. The companion app would subsequently have to emit the mosquito packet itself (if I'm understanding correctly).

EDIT: I'm only guessing, but would it be possible to request to be woken-up by Apple if the device is moving?

EDIT2 (apologies I'm basically thinking out loud): Now that we have a companion app, I am wondering if it is not possible to flip the relationship and have the app report its location, rather than the Raspberry Pi? eg, we would make each instance of room-assistant a beacon and have the iPhone send a mosquitto packet to home-assistant telling it which room (beacon) it is closest to. From the thread linked above, this seems doable even with the app in the background.

EDIT3: The app also goes into the background randomly, even with the phone unlocked.

@mKeRix
Copy link
Owner Author

mKeRix commented Jan 23, 2021

I'm sorry to hear that you guys are having trouble with beta.5. This task is really tricky for me - I felt like we're really close to something usable for weeks now, but I can't seem to figure the last steps out. That being said, I just found a bug in the app today that prevented me from the actually seeing which device has the app installed before connecting... which then led me to implement this brute-force approach of just connecting to anything Apple and checking. I will re-write room-assistant to account for this newly found data, which should reduce the amount of required connections heavily. I will also try to re-trace some of the changes that may have lead to the worse detection issues that you guys reported.

As for BT Classic: you will need to raise the interval for BT Classic to at least 20 for it to work in tandem with BLE in beta.5. I will improve on this in the next version(s).

@riddledaxis If you don't specify -c room-assistant will look into <working-dir>/config for the yaml config files. From which directory are you starting it from when you see this warning?

@riddledaxis
Copy link

@mKeRix I think the problem was because I had configured room assistant to run as a service when I set it up originally with BT Classic.

I was stopping room assistant with systemctl stop room-assistant, not room-assistant.service. I was also starting room assistant with room-assistant and not systemctl start room-assistant.service and that is why I think it didn't pick up the correct config without the -c flag

I have now restarted the service and I am waiting to see if it is more reliable.

I also set up a pi zero W yesterday with the room-assistant.service on beta.5 and that seems to be pretty reliable at the moment.
It does alternate between its room name and not_home but then seems to settle on the room name fairly quickly.

@mKeRix
Copy link
Owner Author

mKeRix commented Jan 26, 2021

I published another beta release - this will limit connection attempts to iOS devices that actually advertise having the app installed, instead of connecting to any Apple device that was found in the vicinity like before. Note that for this beta to work you will need to install the latest build from TestFlight (v0.1.0, build 4) and open the room-assistant companion app at least once on each device before it will be detected.

Let me know how things are looking for you with this beta. It's not perfect, but I've been happy with what I've seen on my test setup so far.

@s1rd4v3
Copy link

s1rd4v3 commented Jan 27, 2021

Thanks for your efforts @mKeRix. Will give this a try shortly.

@riddledaxis
Copy link

@mKeRix, thank you for the new beta.

I am running it on both my pi's and at the moment (touches wood), it is all running ok.

Will update in a couple of days.

@adamrutt
Copy link

This latest update (beta 6 and build 4 of the iOS app) is by far the best and I have it working fairly reliably, up until now BLE trackinf would only work for very short periods. Thanks so much for your work on this @mKeRix

@B-Hartley
Copy link

Running beta 6 with the latest test-flight.
Seems to be running well.

Couple of questions....

I'm using bLE with iphones.

People jump from room to room quite often.
Would rolling average be the right way to solve this?
How do I know the entity id to use in the config to assign roling average timescale?

Also I have a bLE device on teh family dog (a fitness tracker type thing)
It only seems to ping everyone 30 seconds or so.
Can I stop him going "away" in between ?
What would be the best config for that.

Thanks for your hard work on this !

@mKeRix
Copy link
Owner Author

mKeRix commented Jan 29, 2021

@B-Hartley If it's only about intermittent jumps but an otherwise correct long "correct" state I would recommend to turn on debouncing. For this you would need to set the time to whatever your longest intermittent incorrect state was +10-20%. If it's a correct state that has many small incorrect blips rolling average would be a good choice. You can also combine both for further experiments. You can find the entity ID via the entities endpoint of the room-assistant API or the verbose logs (no easier way yet, sorry - I want to find something better for this!).

For the tracker I would suggest to just raise the timeout in the bluetoothLowEnergy settings. In fact, try raising it to something between 60-120 and see if that helps with your iPhone BLE room jumping as well before going into the entity behaviors. :)

@B-Hartley
Copy link

Thank you very much.
I'll give these ideas a try.

@mKeRix mKeRix closed this as completed in 17d537d Jan 31, 2021
github-actions bot pushed a commit that referenced this issue Jan 31, 2021
# [2.13.0](v2.12.0...v2.13.0) (2021-01-31)

### Bug Fixes

* **bluetooth:** attempt adapter reset on LE timeouts ([386ef37](386ef37))
* **bluetooth:** disallow parallel resets ([09d55bd](09d55bd))
* **bluetooth:** further improve adapter stability ([fef1a2c](fef1a2c))
* **bluetooth:** hard reset adapter on timeouts ([112441b](112441b))
* **bluetooth:** improve adapter stability ([1c99d05](1c99d05))
* **bluetooth:** improve adapter stability ([27112a0](27112a0))
* **bluetooth-low-energy:** add timeout for app discovery ([16922ac](16922ac))
* **bluetooth-low-energy:** end app discovery on disconnect ([ac2c13d](ac2c13d))
* **bluetooth-low-energy:** improve app id sharing ([b0b2f7c](b0b2f7c))
* **bluetooth-low-energy:** only disconnect from connected devices ([d54c53d](d54c53d))
* **home-assistant:** do not log binary state updates ([a96b566](a96b566))
* improve companion app detection ([4e75511](4e75511))
* limit classic inquiry lock time ([c1412cb](c1412cb)), closes [#327](#327)

### Features

* **bluetooth:** reset deadlocked Bluetooth adapters ([4cdeb24](4cdeb24))
* **bluetooth:** reset stuck Bluetooth adapters ([ab4e940](ab4e940))
* **bluetooth-low-energy:** allow iOS tracking via BLE ([17d537d](17d537d)), closes [#309](#309)
* **bluetooth-low-energy:** auto-attempt to recover scanning states ([df72629](df72629))
* **bluetooth-low-energy:** make regular lists case insensitive ([286bd22](286bd22))
* **bluetooth-low-energy:** only connect to companion app devices ([adc3f23](adc3f23))
* **bluetooth-low-energy:** share discovered apps with cluster ([188e76c](188e76c))
* **entities:** add debounce edge options ([d5b92cf](d5b92cf)), closes [#329](#329)
* **home-assistant:** add device tracker discovery ([#425](#425)) ([5e3a727](5e3a727))
* **home-assistant:** add health indicator ([2ab6e42](2ab6e42))
* **home-assistant:** allow disabling of attribute updates ([9d2eb5b](9d2eb5b))
* **logger:** add Kibana log transporter ([076df21](076df21))
* **prometheus:** add metrics ([d6a90ea](d6a90ea))
* **xiaomi-mi:** add device information ([#362](#362)) ([67427d5](67427d5))
* add toggle for heatmap ([60afaa5](60afaa5))
@github-actions
Copy link

🎉 This issue has been resolved in version 2.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mKeRix mKeRix unpinned this issue Jan 31, 2021
@mKeRix
Copy link
Owner Author

mKeRix commented Jan 31, 2021

My test setup continued to run well, so I decided to release this outside of the beta. Any further problems with this integration should receive their own, new issues. That way my mind is also freed up a bit and I can work on some other stuff again. 😄

@ethank
Copy link

ethank commented Jan 31, 2021

The docs weren't updated to link to the app required for this?

@maa-x
Copy link

maa-x commented Jan 31, 2021

They were for me, although I had to "Reload content".

Documentation

@mKeRix
Copy link
Owner Author

mKeRix commented Jan 31, 2021

The docs website is a PWA atm, which caches its content on first load for quick load times and offline access. To get the refreshed content you need to either hit the button at the bottom right when it pops up or do a hard refresh in your browser. The current TestFlight link is: https://testflight.apple.com/join/OpCkeHf8

@riddledaxis
Copy link

@mKeRix both my pi's have been running this, and as far as I can tell are working flawlessly picking me up straight away when I come into a room and showing me as present with no dropouts.

Thank you so much @mKeRix for all your hard work on this feature.

@ivanvach
Copy link

ivanvach commented Jul 23, 2021

@mKeRix

Running your iPhone app beta version 0.1.0 (8) and sniffing for BLE advertisement by another device

Here is what I see

BLE Advertised Device found: Name: room-assistant companion, Address: 61:26:43:f8:31:c8, serviceUUID: 5403c8a7-5c96-47e9-9ab8-59e373d875a7, txPower: 8

I have 2 problems

  1. The UUID advertised (shown above) is different than the ID I see in the app which is 715EA73E-0C7A-.......
  2. The app doesn't work when the phone is locked. I know that You claim otherwise. Can you please guide a novice like me of how to setup the iPhone and/or the app so that it works always. I did enable your app (via TestFlight) in Settings-->General->Background App Refresh. Is there something else I need to do. Thanks.

@mKeRix
Copy link
Owner Author

mKeRix commented Jul 24, 2021

The service UUID that is advertised is hard-coded, room-assistant specifically looks for it and reads a characteristic from it. This is needed since advertising a BLE service in the background on iOS doesn't actually advertise the service directly, it just flips a bit in the manufacturer data of the packet. Since the ID is hardcoded we know which bit to look for, otherwise we wouldn't (the mapping algorithm between UUID and bit isn't public).

There is nothing special to do for making the app work in the background - you just need to grant the Bluetooth permissions. For the auto toggle feature you also need to allow "location always" access (doesn't actually pull your location with GPS, just watches for beacons). That feature will be reworked or replaced by something else though, so I'd probably stick to leaving it off for now. Somebody else also posted about it not working when the phone was locked a while ago if I remember correctly, but I wasn't able to reproduce it. Which iPhone model are you trying to run the app on?

@ivanvach
Copy link

@mKeRix Thanks for the prompt and detailed response. I moved to the released (non TestFlight) version of the app now and also I'm not using my BLE "sniffer" anymore. Instead I installed and run your room-assistant on RPi. Thanks for developing this wonderful tool and the companion app.
I do have some success but not 100% yet. When it works it does track my iPhone with enviable accuracy. Unfortunately it doesn't work all the time. It stops for no visible reason and starts on it's own again for no apparent reason. The app reports "Connection error" quite often albeit it recovers from such error automatically on its own. I just click "Cancel".
My iPhone is iPhone 11 Pro running iOS 14.6
My RPi is 2-nd generation and I'm using the internal built-in BLE adapter. I do have 3-rd generation RPi and will gladly switch to it if you advise me to do so.
Last but not least if you allow me to make a suggestion for improvements.

  1. The way it works now it produces enormous amount of MQTT traffic that is useless IMHO. If someone likes it for some reason than you may keep it optional, but for others like me you may consider introducing "trigger radius" and produce MQTT payload when someone gets in- and out- of the circled area.
  2. Another nice option would be to provide current location over MQTT as a response to MQTT request. This "pull" feature of course in addition to and not in lieu of the "push" mentioned above.

Thanks,
Ivan

@mKeRix
Copy link
Owner Author

mKeRix commented Jul 24, 2021

The Pi 2 doesn't have any built-in Bluetooth adapter though - those were only added with the Pi 3 and Pi Zero W? Either way, if it's not too much of a hassle I'd recommend checking if it works better with your other Pi.

As for the other stuff, feel free to open separate feature request issues for those. While developing v2.x I already reduced the amount of messages greatly based on previous feedback I've gotten, it should be much lower than any of the other room presence tools out there at the moment (at least for the homeAssistant integration). The barebones mqtt integration just publishes all internal entity update events - I don't really want to teach it specific logic to handle updates coming from the integrations differently, as I like how decoupled this is at the moment. Not sure if that is what you were referring to.

As for the request stuff - room-assistant already has a REST API to allow for request-response communication, I'm a bit hesitant with adding yet another layer next to REST, web sockets and MQTT that are already there.

@ivanvach
Copy link

ivanvach commented Jul 25, 2021

@mKeRix

Thank for the prompt and detailed response.

  1. Apologies for mixing up my RPi devices. What I called Pi 2 is actually Pi 3 . I do have Pi 4 as well.
  2. As far as Pi 3 performance was intermittent (see above) I decided to give it a try on Pi 4. Same result maybe a bit worse. Please see attached log of two consecutive attempts to run room-assistant on Pi 4. First run got stuck not able to connect to the companion iPhone app, whereas the second run connected right away and reported to MQTT correctly.
  3. I do agree with you that REST API is more than sufficient for request-response. I'm sorry that I didn't read about it and made feature request that is not necessary.
  4. I disagree about the logic behind the MQTT messages. I understand that it is your intention to reduce the number of MQTT messages in upcoming versions, but this is not the point. The point is to "to move the intelligence to the edge of the network". You have an intelligent device RPi collecting some BLE info from beacons and just passing it along thus creating traffic and processing burden to the next upper level. RPi with room-assistant is a perfect place to do some preliminary processing and pass along useful data only.

For example: If I'm laying on the couch reading a book for two hours than room-assistant will send out (at current pace) about 12,000 MQTT messages that need to be passed to MQTT broker over the network and processed by Home Automation server. This is absolutely useless for the purpose of presence detection.

I urge you to reconsider adding a "radius" attribute in settings and report to MQTT only when a beacon enters or leaves the circular area defined by such radius.

Your point of treating all integrations in the same way is a good one and I do respect it. I can't comment further as I'm a novice here and not familiar at all with the other integrations.

Per your request I will open a separate issue in "feature requests".

  1. Of course new features doesn't mean much for me if I can't make room assistant running solidly here. Please take a look at the attached log and advise if possible of what to do to have it running solidly as it does for you and others here. Please let me know if you want me to provide more information.

roomassistantlog.txt

@PeteBa
Copy link
Contributor

PeteBa commented Jul 26, 2021

@ivanvach, can you use the updateFrequency option in BluetoothLowEnergy integration to throttle the volume of mqtt messages? My iPhone generates around 5 advertisements per second which is far more than I need to receive/record. I have updateFrequency: 5 in my local.yml to limit things to one mqtt message per five seconds.

@ivanvach
Copy link

@PeteBa Thanks for the advise. Wouldn't such approach reduce the sensitivity / granularity to change in presence. For example if it is set at 1 message per 5 sec. than if I walk in a room than I'll need to wait up to 5 sec for the presence driven lights to come up.
This is not the right way to do it imho.
The right way is for room-assistant to process the flow of information and send MQTT message when trigger happens.

@stevencoutts
Copy link

Hi, is this app still being tested? If so, can I have a testflight invite please?

@B-Hartley
Copy link

B-Hartley commented Jan 9, 2022

It's in the App Store now.

https://apps.apple.com/gb/app/room-assistant/id1538642237

@stevencoutts
Copy link

stevencoutts commented Jan 9, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests