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

 找回密码
 立即注册
查看: 1098|回复: 16

[流程系列] 求nodered 小爱播报 日历事件 流程

[复制链接]

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
发表于 2024-7-1 14:29:17 | 显示全部楼层 |阅读模式
本帖最后由 lzx986 于 2024-7-2 15:46 编辑

如题:,日历已从  nextcloud 获取到 HA本地日历,请高人出个流,实现  日历事件 当天播报

现有插件环境:

1,小米节点已接入 node-red-contrib-xiaoai-tts

求:事件如何获取,后用小爱同学播报,新手小白万分感谢!


场景假设:
如:每天早上7点,房门打开(或者7点执行就行) 执行 当天事件播报,没有则不播报事件内容,只播报问候语句。


新手小白,麻烦提供完整流,或提供一下完整教程连接,谢谢大家了!
回复

使用道具 举报

13

主题

572

帖子

3037

积分

论坛元老

HomeAssistant

Rank: 8Rank: 8

积分
3037
金钱
2460
HASS币
20
发表于 2024-7-1 16:13:45 | 显示全部楼层
https://www.home-assistant.io/voice_control/assist_daily_summary/这个蓝图可以实现,让AI总结挺好玩的
Nodered获取方法
[{"id":"24f67c22c57985b5","type":"inject","z":"24354bb9d7926009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":510,"y":300,"wires":[["ad4a756f02cc6c9d"]]},{"id":"ad4a756f02cc6c9d","type":"api-call-service","z":"24354bb9d7926009","name":"","server":"fcd2d893af2660be","version":5,"debugenabled":false,"domain":"calendar","service":"get_events","areaId":[],"deviceId":[],"entityId":["calendar.wo_de_ri_li"],"data":"{"duration":{"hours": 17}}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"queue":"none","x":720,"y":260,"wires":[["ecb9f24b48153b3d"]]},{"id":"fcd2d893af2660be","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

改下日历实体和持续时间duration就可以
回复

使用道具 举报

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
 楼主| 发表于 2024-7-2 10:44:59 | 显示全部楼层
DDDear 发表于 2024-7-1 16:13
https://www.home-assistant.io/voice_control/assist_daily_summary/这个蓝图可以实现,让AI总结挺好玩的
...

感谢感谢,我试试
回复

使用道具 举报

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
 楼主| 发表于 2024-7-2 10:59:25 | 显示全部楼层
DDDear 发表于 2024-7-1 16:13
https://www.home-assistant.io/voice_control/assist_daily_summary/这个蓝图可以实现,让AI总结挺好玩的
...

您好,这个流导入报错,是哪里问题,请指教下。 Snipaste_2024-07-02_10-58-02.jpg
回复

使用道具 举报

5

主题

192

帖子

799

积分

高级会员

Rank: 4

积分
799
金钱
607
HASS币
0
发表于 2024-7-2 14:50:36 | 显示全部楼层
lzx986 发表于 2024-7-2 10:59
您好,这个流导入报错,是哪里问题,请指教下。

根据您提供的JSON代码片段,我发现其中可能存在一个问题。在 "data" 字段中,您传递了一个对象 {"duration": {"hours": 17}},但是在 JSON 中,需要确保字符串中的双引号正确转义。

您可以将这一行修改为 "data": "{\"duration\":{\"hours\": 17}}",这样JSON解析器就能正确识别该字段的值为一个嵌套的对象。

请尝试对您的JSON代码片段进行这样的修改,看看是否能够解决该错误。
回复

使用道具 举报

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
 楼主| 发表于 2024-7-2 15:22:46 | 显示全部楼层
生煎馒头 发表于 2024-7-2 14:50
根据您提供的JSON代码片段,我发现其中可能存在一个问题。在 "data" 字段中,您传递了一个对象 {"duratio ...

非常感谢,更改后,日历测试成功了! Snipaste_2024-07-02_15-21-50.jpg

能提供下,小爱接入流吗,谢谢
回复

使用道具 举报

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
 楼主| 发表于 2024-7-2 15:24:16 | 显示全部楼层
DDDear 发表于 2024-7-1 16:13
https://www.home-assistant.io/voice_control/assist_daily_summary/这个蓝图可以实现,让AI总结挺好玩的
...

您可以提供下,小爱部分的连接流吗,日历获取成功了,谢谢您
回复

使用道具 举报

5

主题

192

帖子

799

积分

高级会员

Rank: 4

积分
799
金钱
607
HASS币
0
发表于 2024-7-2 15:26:47 | 显示全部楼层
[{"id":"c762144bb4d16e91","type":"inject","z":"24354bb9d7926009","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":150,"y":180,"wires":[["ad4a756f02cc6c9d"]]},{"id":"ad4a756f02cc6c9d","type":"api-call-service","z":"24354bb9d7926009","name":"Get Calendar Events","server":"fcd2d893af2660be","version":5,"debugenabled":false,"service_domain":"calendar","service":"get_events","entityId":"calendar.wo_de_ri_li","data":"{\n    \"duration\": {\n        \"hours\": 17\n    }\n}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"queue":"none","x":370,"y":180,"wires":[["f6d8b87c81fbc7a4"]]},{"id":"f6d8b87c81fbc7a4","type":"function","z":"24354bb9d7926009","name":"Extract Events","func":"msg.payload = msg.payload.map(event => event.summary).join(', ');\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":180,"wires":[["ce3c6cb6ba3694d5"]]},{"id":"ce3c6cb6ba3694d5","type":"api-call-service","z":"24354bb9d7926009","name":"Text To Speech","server":"fcd2d893af2660be","version":5,"debugenabled":false,"service_domain":"tts","service":"play_media","entityId":"media_player.your_smart_speaker","data":"{\n    \"media_content_id\": \"{{payload}}\",\n    \"media_content_type\": \"audio/mp3\"\n}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":790,"y":180,"wires":[[]]},{"id":"fcd2d893af2660be","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
回复

使用道具 举报

2

主题

27

帖子

112

积分

注册会员

Rank: 2

积分
112
金钱
85
HASS币
0
 楼主| 发表于 2024-7-2 15:42:05 | 显示全部楼层
生煎馒头 发表于 2024-7-2 15:26
[{"id":"c762144bb4d16e91","type":"inject","z":"24354bb9d7926009","name":"","props":[{"p":"payload"}, ...

您好,"TypeError: msg.payload.map is not a function"  这里报错了
回复

使用道具 举报

46

主题

1654

帖子

6672

积分

论坛元老

Rank: 8Rank: 8

积分
6672
金钱
5008
HASS币
40
发表于 2024-7-2 15:59:27 | 显示全部楼层
禁止用ai答复,非常容易误导
折腾精神永存,感恩感谢论坛每一位愿意分享和帮助过我的大佬,论坛有你更精彩
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-21 20:12 , Processed in 2.138195 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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