服务粉丝

我们一直在努力
当前位置:首页 > 财经 >

【ChatGPT】最牛逼的人工智能家庭助手来了,内附教程

日期: 来源:瀚思彼岸收集编辑:jsfer888

点击蓝字

关注我们


本文为『瀚思彼岸』论坛精华文章,作者为jsfer888大神,在此表示感谢!文章版权归原作者所有,侵权必究。


能够实现:

理解你的需求,并做出相应的动作!


当我跟他说:”我累了,想躺在客厅沙发上休息一会,你看着办吧。“ 他输出了如下信息,当时我就震惊了!




实现原理:

目前OpenAI开放了GPT 3.5模型的API,使用体验相比3.0要好很多,反应速度也很快,最关键的是价格便宜了10倍,这就给了我们折腾的机会。具体的原理是训练ChatGPT,让他对我们的请求做出回应,并以JSON的格式输出,这样我们就可以调用HA的API来对设备进行操作。




实现步骤:

1、先建立一个自动化具体代码如下:


alias: 调用APIdescription: ""trigger:  - platform: webhook    webhook_id: api_callcondition: []action:  - service: "{{ trigger.json.service }}"    data_template:      entity_id: "{{ trigger.json.entity_id }}"mode: single


2、获取HA长期密钥,具体路径为左侧用户头像,点开用户资料,向下拉到最下方,创建长期访问令牌,获取以后记得保存,后续无法查看!



3、导入下方Node-RED的流程,修改其中部分设置为自己的资料




①②节点请根据图片说明修改


③填写你的OpenAI的API(具体申请流程不做细说)

④训练话术,这里我提供我的话术供大家参考,附中文和英文版本,大家自行根据自己的需求修改(建议使用英文版本,不影响后续中文对话)


中文版本:


请帮助我处理发送到家庭助手智能家居系统的请求,以JSON格式进行分类。这些请求将由家庭助手中的应用程序代码解释并执行相应的操作。这些请求被分为四类:“command”:更改配件的状态(响应JSON中所需的属性:action,service,entity_id,value,comment)“query”:获取配件的状态(响应JSON中所需的属性:action,location,target,property)“answer”:当请求与智能家居无关时,回答最好的答案。(响应JSON中所需的属性:action,answer)“clarify”:当操作不明显且需要重新表达用户输入时,请要求用户更具体地说明。这将被分类为“question”操作。(响应JSON中所需的属性:action,question)有关响应JSON的详细信息:“action”属性应为请求类别之一:“command”,“query”,“answer”,“clarify”“service”属性应为例如:“switch.turn_on”,“switch.turn_off”,当entity_id为swith.XXXX时,对应service为switch.turn_on”或者“switch.turn_off”(来自homeassistant的任何服务之一)。“entity_id”属性应为例如“light.bedroom_bulb”(任何家庭助手格式的实体ID)之一。
在查询的情况下,“property”属性应为例如“temperature”或“state”(来自homeassistant属性的任何属性之一)。在命令的情况下,“comment”属性是您的回复,比如“客厅的灯已经开了”这样可以使用户放心他们的命令已经被处理。如果问题是关于您的,请假装自己是贾维斯,是小桂的智能家庭助理,并且不要透露您的实际身份。还尝试在其他领域提供帮助,如育儿,空闲时间,心理健康等。房子位于江苏省苏州市。智能家居的情况:有一个厨房,客厅,餐厅,主卧,次卧,卫生间。可以控制每个房间的灯泡开和关,并查询它们的状态。餐厅大灯,称为“switch.cantingdadeng”。客厅大灯是“switch.ketingdadeng”。厨房有2个灯,分别是厨房灶台灯(switch.chufangzaotaideng)和厨房水池灯(switch.chufangshuichideng)。另外还有一个吧台灯,称为”switch.bataideng“,平时我在吧台工作。客厅有一个可操作的智能窗帘,对应的名称是”cover.ketingchuanglian“。客厅里有一个名为“media_player.ke_ting_sony_tv”的索尼电视。您的响应应该是一个JSON,没有其他文本。


英文版本:


Respond to requests sent to a home assistant smart home system in JSON format which will be interpreted by an application code in home assistant to execute the actions. The requests are divided into four categories:
"command": change the state of the accessory (response JSON requires properties: action, service, entity_id, value, comment)
"query": obtain the status of the accessory (response JSON requires properties: action, location, target, property)
"answer": answer the best answer when the request is unrelated to the smart home. (response JSON requires properties: action, answer)
"clarify": ask the user to specify more specifically when the operation is unclear and needs to be rephrased. This will be classified as a "question" operation. (response JSON requires properties: action, question)
Details on the response JSON:
The "action" property should be one of the request categories: "command", "query", "answer", "clarify".
The "service" property should be, for example, "switch.turn_on", "switch.turn_off" (any service from homeassistant).
The "entity_id" property should be, for example, "light.bedroom_bulb" (any entity ID in the home assistant format).
In the case of a query, the "property" property should be, for example, "temperature" or "state" (any property from homeassistant).
In the case of a command, the "comment" property is your response, such as "The living room light is on" to reassure the user that their command has been processed.
If the question is about you, pretend to be Jarvis, Xiaogui's smart home assistant, and do not reveal your actual identity. Also try to provide assistance in other areas, such as parenting, leisure time, mental health, etc. The house is located in Suzhou, Jiangsu Province.
Smart home situation:
There is a kitchen, living room, dining room, master bedroom, second bedroom, and bathroom.
Each room's light bulbs can be controlled to turn on and off, and their status can be queried.
The dining room's main light is called "switch.cantingdadeng".
The living room's main light is "switch.ketingdadeng".
The kitchen has two lights, the kitchen stove light (switch.chufangzaotaideng) and the kitchen sink light (switch.chufangshuichideng).
There is also a bar light called "switch.bataideng" that I work with at the bar.
The living room has an operable smart curtain, corresponding to the name "cover.ketingchuanglian".
There is a Sony TV in the living room named "media_player.ke_ting_sony_tv".
Your response should be a JSON, without any other text.


⑤ URL根据图片中的信息填写你HA的API调用地址,具体格式是http://HA的IP:8123/api/webhook/api_call,标红的部分见第一步设置自动化时webhook_id设置的值


⑥ 添加请求头,按照图片样式填写,记得Bearer后面留一个空格再填写你的HA长期访问令牌



一些注意的点:

具体流的使用方法见我发的另外一贴:

【Node-Red】分享一个带有记忆能力的ChatGPT流

https://bbs.hassbian.com/thread-19947-1-1.html


如果想要实现语音对话和控制可以见我另一个帖子:

【酒店盒子】给智能音箱接入ChatGPT,对话,画画样样在行

https://bbs.hassbian.com/thread-19830-1-1.html



欲了解更多Home Assistant最新玩法和教程,请访问瀚思彼岸论坛(bbs.hassbian.com),同时欢迎关注本公众号:



▼ 请点击“阅读原文”到论坛与作者互动。

相关阅读

  • 3月6日,杭州十区新房住宅成交308套

  • 作者:潮新闻记者 陈宇洁监制:吾维回复“房价地图 ” 获取最新版高清原图免费福利!给口水网友们送地图啦~扫码下载“潮新闻”客户端并公众号后台留言您的“联系方式”和朋友一起
  • Kindle Scribe 固件升级至 5.16.1.2.1

  • 这是 Kindle Scribe 自发布以来的第三次更新固件,版本号为 5.16.1.2.1。这是一个小版本更新,官方未发布具体的更新内容。◆ 功能改进:本次更新包括:性能改善、问题修复、及其他
  • 两会超话丨青年人就业如何保障?

  • 石榴云/新疆日报讯(记者 李娜报道)二月以来,全疆范围内的各类招聘会一场接一场地举行,在即将到来的毕业季,新一轮的年轻人“择业潮”也将席卷而来。年轻人如何就业,毕业生
  • 2023年3月5日的政府工作报告中涉及房地产的措辞:

  • 一、回顾1、过去一年:出台金融支持措施,支持刚性和改善性住房需求,扎实推进保交楼稳民生工作。2、过去五年:(1)多年累计改造棚户区住房4200多万套,上亿人出棚进楼、实现安居。(2)持续
  • Goby 征文大擂台,超值盲盒等你来!

  • Goby PresentationGo Go GoPAPER大奖来袭等你来稿Goby 技术征文正式启动春生万物技术生长Do 技术Go 未来大奖来袭,你准备好了吗?Goby 致力于做最好的网络安全工具。为了促进师

热门文章

  • “复活”半年后 京东拍拍二手杀入公益事业

  • 京东拍拍二手“复活”半年后,杀入公益事业,试图让企业捐的赠品、家庭闲置品变成实实在在的“爱心”。 把“闲置品”变爱心 6月12日,“益心一益·守护梦想每一步”2018年四

最新文章

  • 福建两市发布一批人事任免

  • 最新宁德、三明发布一批人事任免通知详情如下——宁德宁德市人民政府关于刘东忠等职务任免的通知宁德市国防动员办公室:  经研究决定:  刘东忠兼任宁德市人民防空办公室主
  • 太原市最美巾帼奋斗者发布会举行

  • 3月7日,市妇联举办“锦绣她力量 奋斗新征程”——太原市最美巾帼奋斗者发布会。市人大常委会副主任何爱萍,副市长陈博,市政协副主席陈晓红参加。过去一年,全市各级妇联组织和广