Bdenouden / IN4398-Advanced-Practical-IoT-and-Seminar

GNU General Public License v3.0
0 stars 0 forks source link

API: /get_devices #11

Closed Bdenouden closed 4 years ago

Bdenouden commented 4 years ago

A request is made to this url when the server boots (and probably daily afterwards or after updates). This requests serves to let the server know all the current settings.

A JSON containing (at the very least) the known devices chip_id is expected as well as a list of sensor types/UID's.

mdjong1 commented 4 years ago

Currently /api/get_devices returns, where id is the Node UID. Settings can also be returned once we decide what needs to be in there/what format

[

    {
        "id":"kIqcAcyGWqDPrGgw",
        "added":"2020-09-22 22:15:17",
        "is_active":"1"
    },
    {
        "id":"SWUbbFivvIqteELW",
        "added":"2020-09-22 22:15:09",
        "is_active":"1"
    }

]
Bdenouden commented 4 years ago

missing info about attached sensors, expected output:

[{
        "id": "kIqcAcyGWqDPrGgw",
        "added": "2020-09-22 22:15:17",
        "is_active": "1",
        "sensors": [{
                "id": "dsfadsf",
                "name": "Temperature",
                "type": "analog",
                "rawMinVal": 0,
                "rawMaxVal": 1023,
                "minVal": -55,
                "maxVal": 125
            },
            {
                "id": "dsfadsf",
                "name": "humidity",
                "type": "DHT11",
                "rawMinVal": 0,
                "rawMaxVal": 1023,
                "minVal": 0,
                "maxVal": 100
            }
        ]
    },
    {
        "id": "SWUbbFivvIqteELW",
        "added": "2020-09-22 22:15:09",
        "is_active": "1",
        "sensors": [{
            "id": "dsfadsf",
            "name": "Soil moisture",
            "type": "analog",
            "rawMinVal": 0,
            "rawMaxVal": 1023,
            "minVal": -55,
            "maxVal": 125
        }]
    }

]