def telemetry():
    iot_hub = IoTHub(os.environ['IOT_HUB_NAME'],
                     os.environ['IOT_HUB_OWNER_KEY'])
    assets = table_service.query_entities('equipment')
    devices = iot_hub.get_device_list()
    devices.sort(key=lambda x: x.deviceId)
    return render_template('telemetry.html', assets=devices)
Exemple #2
0
def telemetry():
    iot_hub = IoTHub(os.environ['IOT_HUB_NAME'], os.environ['IOT_HUB_OWNER_KEY'])
    devices = iot_hub.get_device_list()
    devices.sort(key = lambda x: x.deviceId)
    return render_template('telemetry.html', assets = devices)
            state['ambient_temperature'],
            'ambientPressure':
            state['ambient_pressure']
        })

        time_elapsed = time.time() - interval_start
        # print('Cadence: {0}'.format(time_elapsed))
        time.sleep(max(1 - time_elapsed, 0))


if __name__ == '__main__':
    iot_hub = IoTHub(IOT_HUB_NAME, IOT_HUB_OWNER_KEY)

    iot_device_count = 10

    devices = iot_hub.get_device_list()

    if len(devices) == 0:
        devices = []
        for i in range(iot_device_count):
            device_id = 'MACHINE-{0:03d}'.format(i)
            device = iot_hub.create_device(device_id)
            devices.append(device)

    healthy_spectral_profile = {
        'W': [1, 2, 3, 4, 5, 12, 15],
        'A': [5, 8, 2 / 3, 9, 8, 13, 5]
    }

    rotor_imbalance_speactral_profile = {
        'W': [1 / 2, 1, 2, 3, 5, 7, 12, 18],