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

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

[流程系列] 【node-red】小爱同学,我的遥控器呢

[复制链接]

5

主题

75

帖子

695

积分

高级会员

Rank: 4

积分
695
金钱
620
HASS币
0
发表于 2023-3-28 09:10:17 | 显示全部楼层 |阅读模式
本帖最后由 reggie 于 2023-3-28 09:10 编辑

经常找不到遥控,于是开始查询各种资料通过Homeassistant来解决这个问题。
设备要求安卓有找寻遥控器的选项,遥控器也要支持,这里用的Nvidia Sheild 2019Pro
原理是通过adb把盒子接入hass,然后通过scripts生成一个服务叫remote_finder,通过小爱同学来调用服务
remote_finder:
  alias: Remote Finder
  icon: mdi:target
  mode: single
  sequence:
    - data:
        command: am start -a android.intent.action.VIEW -d -n com.nvidia.remotelocator/.ShieldRemoteLocatorActivity
        entity_id: media_player.android_tv_192_168_1_144
      service: androidtv.adb_command
然后在小爱音箱里做一个训练

                               
登录/注册后可看大图

下面就可以在node_red里调用了

                               
登录/注册后可看大图

原理很简单,获取对话,里面带有遥控器就触发remote_finder服务
下面是相关流
[{"id":"d4dd5cd19d67d519","type":"tab","label":"misc","disabled":false,"info":"","env":[]},{"id":"428735d9d56d0e86","type":"server-state-changed","z":"d4dd5cd19d67d519","name":"Get Conversation","server":"9827bb1a.d22488","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.xiaomi_s12_075e_conversation","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":200,"wires":[["9c25d19dc283e43a"]]},{"id":"9c25d19dc283e43a","type":"switch","z":"d4dd5cd19d67d519","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"遥控器","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":200,"wires":[["7ad8e4bce4b27df8"]]},{"id":"7ad8e4bce4b27df8","type":"api-call-service","z":"d4dd5cd19d67d519","name":"remote_finder","server":"9827bb1a.d22488","version":5,"debugenabled":false,"domain":"script","service":"remote_finder","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":200,"wires":[[]]},{"id":"9827bb1a.d22488","type":"server","name":"hass","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

然后就可以让小爱同学帮我们找遥控器了



回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 13:23 , Processed in 0.064171 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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