theengs/app

Assigned MAC addresses get cleared when closing and reopening the app

DigiH opened this issue · 6 comments

DigiH commented

Assigned MAC addresses get cleared when closing the app and opening it again, verified on macOS and iOS 1.2

This requires any MAC addresses to be entered again for all devices to be able to get functioning published MQTT messages again.

The assigned MAC addresses need to be persistent across app restarts.

DigiH commented

Likely related to
#58
as the MAC addresses are also in the database, but not being repopulated (either in the UI, nor for MQTT publishing) when App is reopened.

DigiH commented

Closing as verified with the latest build as fixed.

Opening the app immediately populates the locations, and also the previously saved MAC addresses are there for all devices. 👍

By the way, it might be a nice addition to the decoder to have it parse and expose the sensor's MAC addresses, if available in the advertisement data.
That way, there wouldn't be any need to fill that MAC field manually. I already do that for sensors that have an existing WatchFlower implementation, but it might be useful to generalize that.

Kind of theengs/decoder#89, but the other way around.

DigiH commented

I'm not quite sure what you mean by

parse and expose the sensor's MAC addresses

Decoder does get the MAC address from the project, Theengs App, OpenMQTTGateway, Theengs Gateway etc. and doesn't need to send it back because of that - each project already having the "id" key and property.

How would you want it to be additionally exposed?

With the macOS and iOS Bluetooth stack, you don't have access to the MAC addresses, so the ID field of the decoder is filled only with "equivalent" UUIDs.

For instance with the FlowerCare sensors, you do need the actual MAC to interact with the devices for longer than a second, it's part of its handshake process. So they put the MACs in the advertising data (https://github.com/emericg/WatchFlower/blob/master/docs/mibeacon-ble-api.md#protocol-version-0x70), so their iOS app can have the same features than their Android app.
So for these devices, you could add a mac field/property in the decoder.

DigiH commented

MAC property added in branch
https://github.com/theengs/decoder/tree/mac_property

Needing more device decoder updates for devices known to have their MAC address in broadcast data.