- 积分
- 695
- 金钱
- 620
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
高级会员
- 积分
- 695
- 金钱
- 620
- HASS币
- 0
|
本帖最后由 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}]
然后就可以让小爱同学帮我们找遥控器了
|
|