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

 找回密码
 立即注册
查看: 186|回复: 0

[基础教程] 请教:属性值中间有原点watch.current_address,nodered怎么写才...

[复制链接]

4

主题

75

帖子

471

积分

中级会员

Rank: 3Rank: 3

积分
471
金钱
396
HASS币
0
发表于 2024-3-12 09:11:54 | 显示全部楼层 |阅读模式
本帖最后由 leozen 于 2024-3-12 09:33 编辑

手表属性值中间有个原点watch.current_address,nodered节点写成 "current_address": msg.data.attributes.watch.current_address,报错:TypeError: Cannot read properties of undefined (reading 'current_address')没有原点的属性读取没问题。
-------------
问了ai,解决了:
To access the `watch.current_address` property in Node-RED, you need to understand how messages work in Node-RED and how to access their properties.


In Node-RED, messages are JavaScript objects that can have any set of properties. The most commonly used property is `payload`, but Node-RED also adds a property called `_msgid` to identify the message's progress through a flow [[1]](https://nodered.org/docs/user-guide/messages).


To access the `watch.current_address` property, you need to follow these steps:


1. Pass the message containing the `watch.current_address` property to a Debug node.
2. In the Debug sidebar, you can view the structure of the message and explore its properties.
3. Hover over the `watch.current_address` property and click the copy button to copy its path to your clipboard [[1]](https://nodered.org/docs/user-guide/messages).


Once you have the path to the `watch.current_address` property, you can use it in a Change or Function node to access and manipulate the property as needed.


---
Learn more:
1. [Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)
2. [Node Red: get data attributes? - Node-RED - Home Assistant Community](https://community.home-assistant ... a-attributes/143540)
3. [Read File from Watch - General - Node-RED Forum](https://discourse.nodered.org/t/read-file-from-watch/3062)



回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-29 23:54 , Processed in 0.045128 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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