设备数据通过Azure Functions 推送到 Power BI 数据大屏进行展示(1准备工作)
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,本案例适用于开发者入门理解Azure Functions/ IoT Hub / Service Bus / Power BI等几款产品。主要实战的内容为:将设备遥测数据上传到物联网中心,将遥测数据路由
千家信息网最后更新 2026年11月02日设备数据通过Azure Functions 推送到 Power BI 数据大屏进行展示(1准备工作)
本案例适用于开发者入门理解Azure Functions/ IoT Hub / Service Bus / Power BI等几款产品。
主要实战的内容为:
将设备遥测数据上传到物联网中心,
将遥测数据路由到消息中间件的Topic中,
使用Azure Function解析消息中间件Topic中的消息并推送到大屏 。
本文主要是本案例的准备工作,即(第1条和第2条的内容):
1.创建IoT Hub:
https://v.qq.com/x/page/h4031pnaxi8.html
2.创建Service Bus:
https://v.qq.com/x/page/b3031hdv9yk.html
3. 创建IoT Hub 消息路由,将遥测消息路由到Service Bus Topic
https://v.qq.com/x/page/i3031hkec4q.html
本示例中的Python Device 代码来自于微软官网,请参照:
https://docs.azure.cn/zh-cn/iot-hub/quickstart-send-telemetry-python
# Copyright (c) Microsoft. All rights reserved.# Licensed under the MIT license. See LICENSE file in the project root for full license information.import randomimport timeimport sys# Using the Python Device SDK for IoT Hub:# https://github.com/Azure/azure-iot-sdk-python# The sample connects to a device-specific MQTT endpoint on your IoT Hub.import iothub_client# pylint: disable=E0611from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResultfrom iothub_client import IoTHubMessage, IoTHubMessageDispositionResult, IoTHubError, DeviceMethodReturnValue# The device connection string to authenticate the device with your IoT hub.# Using the Azure CLI:# az iot hub device-identity show-connection-string --hub-name {YourIoTHubName} --device-id MyNodeDevice --output tableCONNECTION_STRING = "your device conn string"# Using the MQTT protocol.PROTOCOL = IoTHubTransportProvider.MQTTMESSAGE_TIMEOUT = 10000# Define the JSON message to send to IoT Hub.TEMPERATURE = 20.0HUMIDITY = 60MSG_TXT = "{\"temperature\": %.2f,\"humidity\": %.2f}"def send_confirmation_callback(message, result, user_context): print ( "IoT Hub responded to message with status: %s" % (result) )def iothub_client_init(): # Create an IoT Hub client client = IoTHubClient(CONNECTION_STRING, PROTOCOL) return clientdef iothub_client_telemetry_sample_run(): try: client = iothub_client_init() print ( "IoT Hub device sending periodic messages, press Ctrl-C to exit" ) while True: # Build the message with simulated telemetry values. temperature = TEMPERATURE + (random.random() * 15) humidity = HUMIDITY + (random.random() * 20) msg_txt_formatted = MSG_TXT % (temperature, humidity) message = IoTHubMessage(msg_txt_formatted) # Add a custom application property to the message. # An IoT hub can filter on these properties without access to the message body. prop_map = message.properties() if temperature > 30: prop_map.add("temperatureAlert", "true") else: prop_map.add("temperatureAlert", "false") # Send the message. print( "Sending message: %s" % message.get_string() ) client.send_event_async(message, send_confirmation_callback, None) time.sleep(3) except IoTHubError as iothub_error: print ( "Unexpected error %s from IoTHub" % iothub_error ) return except KeyboardInterrupt: print ( "IoTHubClient sample stopped" )if __name__ == '__main__': print ( "IoT Hub Quickstart #1 - Simulated device" ) print ( "Press Ctrl-C to exit" ) iothub_client_telemetry_sample_run()
消息
路由
遥测
数据
中间件
内容
大屏
设备
准备
工作
产品
代码
实战
开发者
示例
微软
开发
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
中关村互联网 科技集团
美国互联网保险保险科技
科技平台互联网
互联网与未来科技
互联网科技革命
互联网科技素材视频竖屏
互联网实体化科技化
阿里巴巴算科技企业还是互联网
来此购互联网科技有限公司
佳云科技和互联网广告
科技互联网大厂
移动互联网年度科技创新
注册互联网科技公司经营范围大全
开一家科技互联网公司需要多少钱
互联网保险科技创业
世界互联网领先科技成果获奖
中和天地互联网科技有限公司
互联网科技年终奖
互联网科技对化妆品行业
北京品多多互联网科技有限公司
互联网科技工作委员会副主任毛军
互联网通讯科技
涨乐互联网科技
互联网科技公司税收优惠
互联网科技的英文
科技互联网公司logo
菲比寻常互联网科技
兼蜜互联网科技
银川新华互联网科技职业技术培训学校图片
内蒙古九一互联网科技