コード例 #1
0
ファイル: sensor.py プロジェクト: notarock/jardiniot
def update_lights():
    if request.headers['Content-Type'] != 'application/json':
        print("ERROR: Content type is not JSON in HTTP header.")
    elif request.is_json:
        return SensorController.update_lights(request)
    else:
        print("ERROR: Request is not JSON.")
        return ('', 204)
コード例 #2
0
def update_lights():
    """
    POST => /lights
    Modifier la luminosité de chaque couleur de DEL

    Le POST peut être testé avec ce JSON:
    {"red": 128, "blue": 255, "white": 59}
    """
    if request.headers['Content-Type'] != 'application/json':
        print("ERROR: Content type is not JSON in HTTP header.")
    elif request.is_json:
        return SensorController.update_lights(request)
    else:
        print("ERROR: Request is not JSON.")
        return ('', 204)
コード例 #3
0
def update_fans():
    """
    UPDATE FANS et GET FANS
    POST: C'est la requête à faire pour modifier la vitesse d'un ventilateur

    Le POST peut être testé avec ce JSON:
    {"fanl": 255, "fanh": 255}
    """
    if request.headers['Content-Type'] != 'application/json':
        print("ERROR: Content type is not JSON in HTTP header.")
    elif request.is_json:
        return SensorController.update_fans(request)
    else:
        print("ERROR: Request is not JSON.")

    return ('', 204)
コード例 #4
0
def get_fans():
    """
    GET => /fans
    Retourne la vitesse d'un ventilateur
    """
    return SensorController.get_fans()
コード例 #5
0
def get_lights():
    """
    GET => /lights
    Renvoie les valeurs de luminosité de chaque couleur de DEL
    """
    return SensorController.get_lights()
コード例 #6
0
def get_sensors():
    """
    GET => /sensor
    Renvoies une liste de senseurs avec leurs noms
    """
    return SensorController.get_sensors()
コード例 #7
0
ファイル: server.py プロジェクト: JanVan01/gwot-physical
def sensor_list():
    return SensorController().list()
コード例 #8
0
ファイル: sensor.py プロジェクト: notarock/jardiniot
def get_lights():
    return SensorController.get_lights()
コード例 #9
0
ファイル: sensor.py プロジェクト: notarock/jardiniot
def get_sensors():
    return SensorController.get_sensors()
コード例 #10
0
ファイル: sensor.py プロジェクト: notarock/jardiniot
def get_fans():
    return SensorController.get_fans()