fablabbcn / smartcitizen-api

The Smart Citizen Engine
https://developer.smartcitizen.me
GNU Affero General Public License v3.0
10 stars 4 forks source link

`hashing` sensor configurations #308

Open oscgonfer opened 7 months ago

oscgonfer commented 7 months ago

With the refactor we are losing the capacity to know what a particular device contains in a quick way (i.e. SCK2.1 + CO2).

The blueprint concept allowed us to make device configurations and put a name on them, but it's rigidity did not allow for adding and removing sensors dynamically.

Considering this, it would be good to come up with a way to generate a hash from the sensors that are active in a certain device that could allow us to filter devices, or to generate names for that. A little bit like the concept of a blueprint, but a dynamic one, which can change per device without the user having to do anything with it.

The hash could be checked for certain sensors (i.e. sensors that have ancestries for instance) in order to determine a friendly name. For instance, a device SCK 2.2 could be turned into SCK 2.2 + CO2 because the sensor_hash contains a sensor that maps to a sensor_ancestry (or in itself) whose friendly name is CO2.

pral2a commented 7 months ago

It can be interesting to look into things like locality-sensitive hashing to cluster blueprints with similar but not exact same features.