dwyl / smart-home-firmware

Firmware for dwyl/smart-home-security-system
GNU General Public License v3.0
4 stars 0 forks source link

How do we identify doors and other IoT devices? #2

Closed th0mas closed 4 years ago

th0mas commented 4 years ago

We need a way of syncing the edge devices on the network (e.g. Locks) with the main "hub" authentication server. E.g. how will new devices added to the network know if they're an internal door or an external one?

We could:

The last three options would require a method to pre-register devices with the hub server before they're deployed, while the first method this would be achieved by the initial handshake where a device would be registered if it didn't already exist

It's worth properly thinking about this and doing it right first time as whatever method will take a lot of time and be difficult to change later.

th0mas commented 4 years ago

@nelsonic have you got any thoughts on this?

This is currently a "blocker" as I need to work out how to connect the individual devices to the hub

th0mas commented 4 years ago

As far as unique IDs are concerned - Raspberry Pi's by default use the CPU serial number and is easily accessible within nerves.

Moving forward, Nerves Hub allows us to set device identifiers as well.

th0mas commented 4 years ago

With the handshake method, we could setup a Phoenix channel between lock and hub which could make 2FA easier and allow for monitoring of device health etc.

nelsonic commented 4 years ago

@th0mas right now we only have the concept of internal and external doors but you're right in the near future we will have more types of device (at least two more). For now, given that we will have fewer than 1k devices, I would just have device_type: Int and have regular doors as device_type=1 and higher security doors as device_type=2 We can always refactor/migrate it to a more complex system later. As for using the unique reference of the Raspberry Pi, that seems reasonable. We will only need to associate them to the system once.

th0mas commented 4 years ago

It might be worth making a handshake system now, as we probably need to start with three device types:

Or at least be able to tell doors to go into a pairing mode - which will require two way communication

nelsonic commented 4 years ago

@th0mas yeah that sounds/looks good. We might be able to re-use one of the internal doors as a pairing station. But given that the cost of having a dedicated pairing station isn't very high, let's make it a separate thing (as you suggest). 👍

th0mas commented 4 years ago

Implemented a Websocket pairing system including a handshake. This fixes all of these problems

nelsonic commented 4 years ago

Great plan! 💡