Esempio n. 1
0
# Description :
#     Public data model definitions
# -------------------------------------------------------
# History     :
# 1.0.0 - 2017-02-20 : Release of the file
#
from flask_restx import fields
from api.restx import API

# Model desecription for methods parameters
POWER_POST = API.model(
    'powerPost', {
        'power':
        fields.Integer(required=True,
                       description='Power consumption in Watts'),
        'time':
        fields.Integer(required=False, description='Measurment time stamp'),
        'environment':
        fields.String(required=True,
                      description='Recorder environment \
                                              identifier'),
    })
MEASUREMENT = API.model(
    "measurement", {
        'sensor':
        fields.String(required=True, description="Sensor/measurment name"),
        'unit':
        fields.String(required=True, description='Measurement unit'),
        'value':
        fields.Float(required=True, decription='Measurement value'),
        'time':
        fields.Integer(
Esempio n. 2
0
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Zorglub42 {contact(at)zorglub42.fr}.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
"""FFBC8 weatherstation data model."""
from flask_restx import fields
from api.restx import API

# Model desecription for methods parameters
SYSTEM_COMMAND_PAYLOAD = API.model("systemCommand", {
    "command": fields.String(
        requied=True,
        description="Command to execute",
        enum=["shutdown", "reboot"]
    )
})
SYSTEM_TIME = API.model("dateTime", {
    "dateTime": fields.String(
        requied=True,
        description="Date is ISO format",
        example="2020-02-21T20:36:28Z"
    )
})

SENSOR_VALUE = API.model("sensorValue", {
    'name': fields.String(
        required=True,
        description='Sensor name',