IoT

使用钉钉扫一扫加入圈子

物联网软硬件开发者一站式基地

找工具、找技术、找活动、找朋友、找资源,全在这里!大咖解读,助你深度了解物联网平台玩法;名师授课,手把手教你软硬件开发实战;活动聚会,最快找到技术同路人;扶持计划,为开发者提供入门到商业化的整体支持。

1

回答

0

回答

booyood 2020-05-05 543浏览量 回答数 0

1

回答

保持可爱mmm 2020-05-05 1337浏览量 回答数 1

1

回答

0

回答

0

回答

1

回答

1

回答

1

回答

游客uctyy3eu4r4fw 2020-04-27 633浏览量 回答数 1

1

回答

社区秘书 2020-04-27 11493浏览量 回答数 1

1

回答

社区秘书 2020-04-27 11298浏览量 回答数 1

1

回答

1

回答

1

回答

1

回答

哦哦喔 2020-04-17 888浏览量 回答数 1

网络上已经有使用python 模拟设备接入阿里云,手里刚好有块ESP32的小板子,在上面跑过Alios Things,然后接入阿里云。但是终究感觉麻烦,有的时候只是做一个很简单的应用,跑os确实不太方便。使用micropython直接操作ESP32很是方便,就想着如果能通过micropython 直接接入物联网,那就方便多了。可以非常简单地接入云端,而且操作简单。先放上主干部分,有时间再补充细节

from umqtt.simple import MQTTClient
import usocket as socket
import time
import wifi
 
wifi.connect()
 
#Demo_01
ProductKey = "a1Mf4HZ5k**"
ClientId = "1234|securemode=3,signmethod=hmacsha1|"
DeviceName = "Demo_01"
DeviceSecret = "****************************"
 
strBroker = ProductKey + ".iot-as-mqtt.cn-shanghai.aliyuncs.com"
Brokerport = 1883
 
user_name = "Demo_01&a1Mf4HZ5k**"
user_password = "***************************************"
 
print("clientid:",ClientId,"\n","Broker:",strBroker,"\n","User Name:",user_name,"\n","Password:",user_password,"\n")
 
 
def connect():
	client = MQTTClient(client_id = ClientId,server= strBroker,port=Brokerport,user=user_name, password=user_password,keepalive=60) 
	#please make sure keepalive value is not 0
	
	client.connect()
 
	temperature =25.00
	while temperature < 30:
		temperature += 0.5		
	
		send_mseg = '{"params": {"IndoorTemperature": %s},"method": "thing.event.property.post"}' % (temperature)
		client.publish(topic="/sys/a1Mf4HZ5kET/Demo_01/thing/event/property/post", msg=send_mseg,qos=1, retain=False)
		
		time.sleep(3)
 
	while True:
		pass
 
	#client.disconnect()

连接成功后和可以在设备运行状态下看到上传的温度数据

bad8af1f5f8ab29423b767426d8d5261b2490592

demo中做了一个温度递增的上传,以下是数据记录:

1efed9107b0c5b3a6e1c579d12a76fed099b9e84

做的过程中参考了一下链接,放在这里,读者可以阅读,以获得更多细节:

子设备接入

https://help.aliyun.com/document_detail/66641.html

ESP8266 and MicroPython - Part 2

https://www.home-assistant.io/blog/2016/08/31/esp8266-and-micropython-part2/

使用MQTT客户端连接阿里云MQTT服务器

https://yq.aliyun.com/articles/592279

使用Python模拟设备接入阿里云物联网的MQTT服务器

https://yq.aliyun.com/articles/162978

保持可爱mmm 评论 1

11

回答

用数据说话 评论 0

2

回答

Runt 2020-04-14 8372浏览量 回答数 2
已经全部加载了,小花花送你

近期公开课 全部