『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 757|回复: 2

[求助] 救救,NR中sensor节点对于json处理(不用了,解决了)

[复制链接]

4

主题

76

帖子

563

积分

高级会员

Rank: 4

积分
563
金钱
487
HASS币
0
发表于 2024-4-11 10:31:16 | 显示全部楼层 |阅读模式
本帖最后由 cr130 于 2024-4-11 11:23 编辑

[{"id":"94:f8:27:d6:8d:b0","ip":"192.168.68.120","name":"chuangmi_camera_038a02","online":"1","uplink":"0","downlink":"0","type":"wire","qos_enable":"0","qos_upload":"102400","qos_download":"102400","net_enable":"1","is_guest":0},{"id":"ec:d6:8a:05:83:10","ip":"192.168.68.92","name":"YOS-1U5IK12UL97","online":"1","uplink":"0","downlink":"0","type":"wire","qos_enable":"0","qos_upload":"102400","qos_download":"102400","net_enable":"1","is_guest":0},{"id":"1a:2d:5d:5c:bc:70","ip":"192.168.68.177","name":"M2012K10C","online":"1","uplink":"0","downlink":"0","type":"5G","qos_enable":"0","qos_upload":"102400","qos_download":"102400","net_enable":"1","is_guest":0},{"id":"08:00:27:90:85:61","ip":"192.168.68.175","name":"homeassistant","online":"1","uplink":"129","downlink":"6","type":"wire","qos_enable":"0","qos_upload":"102400","qos_download":"102400","net_enable":"1","is_guest":0}]0

使用sensor,输入msg.payload[0].id,执行后debug提示"TypeError: Cannot read properties of undefined (reading '0')"

我该怎么输入,或者大佬给个学习地址



1712803032509.jpg
回复

使用道具 举报

10

主题

1332

帖子

4250

积分

论坛元老

Rank: 8Rank: 8

积分
4250
金钱
2918
HASS币
0
发表于 2024-4-11 12:52:53 | 显示全部楼层
可以直接复制地址的啊,就是后面的3个图标里的第一个。就好调用了。
回复

使用道具 举报

4

主题

76

帖子

563

积分

高级会员

Rank: 4

积分
563
金钱
487
HASS币
0
 楼主| 发表于 2024-4-11 13:12:46 | 显示全部楼层
隔壁的王叔叔 发表于 2024-4-11 12:52
可以直接复制地址的啊,就是后面的3个图标里的第一个。就好调用了。

感谢感谢,学会新的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-23 18:43 , Processed in 0.064640 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表