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

 找回密码
 立即注册
查看: 7853|回复: 8

[教程系列] 入门NR发个 ha,摇杆控制485云台

[复制链接]

7

主题

397

帖子

2268

积分

金牌会员

Rank: 6Rank: 6

积分
2268
金钱
1871
HASS币
0
发表于 2019-7-9 22:01:18 | 显示全部楼层 |阅读模式
本帖最后由 qjiang 于 2019-7-9 22:04 编辑

做这个纯粹是为了不会用手机app的人设计的。 1111.jpg

刚玩这个能力有限 nr在ha这边的反馈没有弄好,还请大佬们指点下。
12222.jpg

摇杆淘宝买的最便宜的自复位4路
333.jpg
下面贴我自己的配置:
[{"id":"4218130b.03116c","type":"tab","label":"云台控制","disabled":false,"info":""},{"id":"984f3655.e194a8","type":"function","z":"4218130b.03116c","name":"停止-on","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":494,"y":269,"wires":[["424516f4.b0c178"]]},{"id":"f8597644.11b338","type":"mqtt in","z":"4218130b.03116c","name":"","topic":"cmnd/Left","qos":"0","datatype":"auto","broker":"c5fabff3.4f698","x":183.5,"y":193,"wires":[["6287f5a5.be995c"]]},{"id":"18b7ce8.85f1032","type":"mqtt in","z":"4218130b.03116c","name":"","topic":"cmnd/stop","qos":"0","datatype":"auto","broker":"c5fabff3.4f698","x":186.5,"y":269,"wires":[["e494fa5a.7fd168"]]},{"id":"6caa9430.6ad80c","type":"mqtt in","z":"4218130b.03116c","name":"","topic":"cmnd/right","qos":"0","datatype":"auto","broker":"c5fabff3.4f698","x":185.5,"y":340,"wires":[["712443ee.fcf9fc"]]},{"id":"33f3ce8b.330ef2","type":"function","z":"4218130b.03116c","name":"右转-ON","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x02,0x20,0x00,0x23]);\nreturn msg;","outputs":1,"noerr":0,"x":494.5,"y":318,"wires":[["424516f4.b0c178"]]},{"id":"549f37c7.1c53a8","type":"function","z":"4218130b.03116c","name":"左转-ON","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x04,0x3F,0x00,0x44]);\nreturn msg;","outputs":1,"noerr":0,"x":499.5,"y":174,"wires":[["424516f4.b0c178"]]},{"id":"424516f4.b0c178","type":"tcp out","z":"4218130b.03116c","host":"192.168.2.179","port":"9999","beserver":"server","base64":false,"end":false,"name":"","x":950.5,"y":268,"wires":[]},{"id":"6287f5a5.be995c","type":"switch","z":"4218130b.03116c","name":"左","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":320.5,"y":193,"wires":[["549f37c7.1c53a8"],["78217da8.4e00f4"]]},{"id":"e494fa5a.7fd168","type":"switch","z":"4218130b.03116c","name":"停","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":324.5,"y":269,"wires":[["984f3655.e194a8"]]},{"id":"712443ee.fcf9fc","type":"switch","z":"4218130b.03116c","name":"右","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":328.5,"y":339,"wires":[["33f3ce8b.330ef2"],["289499e.4e9aa66"]]},{"id":"78217da8.4e00f4","type":"function","z":"4218130b.03116c","name":"左转-OFF","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":499.5,"y":213,"wires":[["424516f4.b0c178"]]},{"id":"289499e.4e9aa66","type":"function","z":"4218130b.03116c","name":"右转-OFF","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":496.5,"y":359,"wires":[["424516f4.b0c178"]]},{"id":"c5fabff3.4f698","type":"mqtt-broker","z":"","name":"","broker":"192.168.2.253","port":"1883","clientid":"red2","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


ha的yamal:

esphome:
  name: yuntai
  platform: ESP32
  board: esp-wrover-kit
wifi:
  fast_connect: on
  ssid: "youssid"
  password: "password"
web_server:
  port: 80
  
ota:
logger:
mqtt:
  broker: ftp.it20.net
  username: mqtt
  password: mqtt

binary_sensor:
 - platform: gpio
   name: "left"
   id: left
   pin:
     number: GPIO13
     mode: INPUT_PULLUP
     inverted: True
   filters:
    - delayed_on: 100ms
   on_press:
       then:
        - mqtt.publish:
            topic: cmnd/Left
            payload: "ON"
   on_release:
       then:
        - mqtt.publish:
            topic: cmnd/Left
            payload: "OFF"
            
 - platform: gpio
   name: "right"
   id: right
   pin:
     number: GPIO14
     mode: INPUT_PULLUP
     inverted: True
   filters:
    - delayed_on: 100ms
   on_press:
       then:
        - mqtt.publish:
            topic: cmnd/right
            payload: "ON"
   on_release:
       then:
        - mqtt.publish:
            topic: cmnd/right
            payload: "OFF"
555.jpg 这个是控制协议,这个要看说明书才行,你什么协议就用什么协议的16进制命令。
你要左右转 上下转 配置预置点,调用预置点,只要你设备支持对应协议指令直接照葫芦加就是。




评分

参与人数 2金钱 +40 收起 理由
+ 20 这个就有点牛x了!
flashsoft + 20 感谢楼主分享!

查看全部评分

回复

使用道具 举报

8

主题

2073

帖子

6057

积分

论坛元老

流水无味

Rank: 8Rank: 8

积分
6057
金钱
3984
HASS币
145

灌水之王

发表于 2019-7-10 08:00:49 | 显示全部楼层
这个要收藏下 哪天弄到一个遥干
回复

使用道具 举报

27

主题

2143

帖子

8940

积分

论坛元老

Rank: 8Rank: 8

积分
8940
金钱
6792
HASS币
30

论坛元老

发表于 2019-7-10 08:13:41 | 显示全部楼层
感谢分享,话说这个摇杆的使用场景是什么?
回复

使用道具 举报

40

主题

3056

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11149
金钱
8042
HASS币
182
发表于 2019-7-10 09:41:00 | 显示全部楼层
这个摇杆那么像宇航员做轨道对接的时候用的操控杆
Nero
回复

使用道具 举报

5

主题

267

帖子

2861

积分

金牌会员

Rank: 6Rank: 6

积分
2861
金钱
2594
HASS币
0
发表于 2019-7-10 16:05:05 | 显示全部楼层
兄弟这玩意有现成的啊,直接插nvr上面
回复

使用道具 举报

7

主题

397

帖子

2268

积分

金牌会员

Rank: 6Rank: 6

积分
2268
金钱
1871
HASS币
0
 楼主| 发表于 2019-7-14 09:53:03 | 显示全部楼层
[{"id":"ee922008.d6158","type":"tab","label":"云台控制","disabled":false,"info":""},{"id":"c04c8b41.ae7c08","type":"inject","z":"ee922008.d6158","name":"左转关","topic":"","payload":"1-0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":250,"wires":[["e68a0401.621f18"]]},{"id":"10a4d2f8.f284ad","type":"inject","z":"ee922008.d6158","name":"左转开","topic":"","payload":"1-1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":290,"wires":[["e68a0401.621f18"]]},{"id":"7695e94d.851b18","type":"inject","z":"ee922008.d6158","name":"停止关","topic":"","payload":"2-0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":350,"wires":[["e68a0401.621f18"]]},{"id":"b071d5ac.d14858","type":"inject","z":"ee922008.d6158","name":"停止开","topic":"","payload":"2-1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":390,"wires":[["e68a0401.621f18"]]},{"id":"46434f02.07de2","type":"inject","z":"ee922008.d6158","name":"右转关","topic":"","payload":"3-0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":450,"wires":[["e68a0401.621f18"]]},{"id":"a06d6cad.1eaca","type":"inject","z":"ee922008.d6158","name":"右转开","topic":"","payload":"3-1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":191,"y":490,"wires":[["e68a0401.621f18"]]},{"id":"e68a0401.621f18","type":"switch","z":"ee922008.d6158","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1-1","vt":"str"},{"t":"eq","v":"1-0","vt":"str"},{"t":"eq","v":"2-1","vt":"str"},{"t":"eq","v":"2-0","vt":"str"},{"t":"eq","v":"3-1","vt":"str"},{"t":"eq","v":"3-0","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":432,"y":337,"wires":[["e21cfa79.194fe8","7b9100b6.8fee9"],["7b9100b6.8fee9"],["335fb401.299a2c"],["48e0d1eb.95683"],["f0ddbb5c.8b26e8","b7b2e94b.b3a6f8"],["b7b2e94b.b3a6f8"]]},{"id":"c61eab02.2da318","type":"function","z":"ee922008.d6158","name":"左转开","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x04,0x3F,0x00,0x44]);\nreturn msg;","outputs":1,"noerr":0,"x":805,"y":294,"wires":[["29472a57.11cfd6"]]},{"id":"7b9100b6.8fee9","type":"function","z":"ee922008.d6158","name":"左转关","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":805,"y":254,"wires":[["29472a57.11cfd6"]]},{"id":"48e0d1eb.95683","type":"function","z":"ee922008.d6158","name":"停止开","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":805,"y":394,"wires":[["29472a57.11cfd6"]]},{"id":"335fb401.299a2c","type":"function","z":"ee922008.d6158","name":"停止关","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":805,"y":354,"wires":[["29472a57.11cfd6"]]},{"id":"2158f8b6.ade818","type":"function","z":"ee922008.d6158","name":"右转开","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x02,0x20,0x00,0x23]);\nreturn msg;","outputs":1,"noerr":0,"x":805,"y":494,"wires":[["29472a57.11cfd6"]]},{"id":"b7b2e94b.b3a6f8","type":"function","z":"ee922008.d6158","name":"右转关","func":"msg.payload = new Buffer([0xFF,0x01,0x00,0x00,0x00,0x00,0x01 ]);\nreturn msg;","outputs":1,"noerr":0,"x":804,"y":441,"wires":[["29472a57.11cfd6"]]},{"id":"a14d226f.ada47","type":"mqtt in","z":"ee922008.d6158","name":"","topic":"cmnd/485/POWER","qos":"0","datatype":"auto","broker":"ace9fb1d.26f248","x":169,"y":148,"wires":[["e68a0401.621f18","9d3d8316.c8c01"]]},{"id":"6508ece8.895034","type":"function","z":"ee922008.d6158","name":"","func":"msg.payload = msg.payload[6]\nreturn msg;","outputs":1,"noerr":0,"x":339,"y":671,"wires":[["1b9189c0.8cb886","9f6723ce.067b9"]]},{"id":"1b9189c0.8cb886","type":"switch","z":"ee922008.d6158","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"68","vt":"num"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"35","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":542,"y":671,"wires":[["61f9663f.5e7ee8"],["61c29b10.69a264"],["37cb9f36.8a801"],["c0e91a77.d43618"],["629e4f2c.16c54"],["bcff6c3d.53d11"]]},{"id":"61f9663f.5e7ee8","type":"change","z":"ee922008.d6158","name":"返回左转开状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"1-1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":817,"y":579,"wires":[["cce87743.f95dd8"]]},{"id":"61c29b10.69a264","type":"change","z":"ee922008.d6158","name":"返回左转关状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"1-0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":816,"y":615,"wires":[["cce87743.f95dd8"]]},{"id":"cce87743.f95dd8","type":"mqtt out","z":"ee922008.d6158","name":"","topic":"stat/485/POWER","qos":"0","retain":"true","broker":"ace9fb1d.26f248","x":1195,"y":674,"wires":[]},{"id":"37cb9f36.8a801","type":"change","z":"ee922008.d6158","name":"返回停止开状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"2-1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":816,"y":655,"wires":[["cce87743.f95dd8"]]},{"id":"c0e91a77.d43618","type":"change","z":"ee922008.d6158","name":"返回停止关状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"2-0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":816,"y":695,"wires":[["cce87743.f95dd8"]]},{"id":"629e4f2c.16c54","type":"change","z":"ee922008.d6158","name":"返回右转开状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"3-1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":735,"wires":[["cce87743.f95dd8"]]},{"id":"bcff6c3d.53d11","type":"change","z":"ee922008.d6158","name":"返回右转关状态","rules":[{"t":"set","p":"payload","pt":"msg","to":"3-0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":815,"y":775,"wires":[["cce87743.f95dd8"]]},{"id":"e21cfa79.194fe8","type":"delay","z":"ee922008.d6158","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":626.5,"y":220,"wires":[["c61eab02.2da318"]]},{"id":"f0ddbb5c.8b26e8","type":"delay","z":"ee922008.d6158","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":606.5,"y":468,"wires":[["2158f8b6.ade818"]]},{"id":"89685537.c8d238","type":"debug","z":"ee922008.d6158","name":"接口返回","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":359,"y":535,"wires":[]},{"id":"9f6723ce.067b9","type":"debug","z":"ee922008.d6158","name":"函数输出数字","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":559,"y":535,"wires":[]},{"id":"9d3d8316.c8c01","type":"debug","z":"ee922008.d6158","name":"MQTT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":500,"y":99,"wires":[]},{"id":"e1f9beab.24a1f","type":"tcp in","z":"ee922008.d6158","name":"","server":"client","host":"192.168.2.252","port":"9999","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":141,"y":673,"wires":[["6508ece8.895034","89685537.c8d238"]]},{"id":"29472a57.11cfd6","type":"tcp out","z":"ee922008.d6158","host":"192.168.2.253","port":"9999","beserver":"server","base64":false,"end":false,"name":"Tcp_Server","x":1250,"y":386,"wires":[]},{"id":"ace9fb1d.26f248","type":"mqtt-broker","z":"","name":"","broker":"192.168.2.253","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


在大佬们的指点下反馈也弄好了
回复

使用道具 举报

1

主题

3

帖子

19

积分

新手上路

Rank: 1

积分
19
金钱
16
HASS币
0
发表于 2019-7-26 01:25:35 | 显示全部楼层

这个要收藏下哪天弄到一个遥干
回复

使用道具 举报

0

主题

150

帖子

1263

积分

金牌会员

Rank: 6Rank: 6

积分
1263
金钱
1113
HASS币
0
发表于 2019-11-25 20:17:45 | 显示全部楼层
邮箱没反应啊 发表于 2019-7-26 01:25
这个要收藏下哪天弄到一个遥干

谢谢分享
回复

使用道具 举报

5

主题

142

帖子

968

积分

高级会员

Rank: 4

积分
968
金钱
825
HASS币
0
发表于 2019-11-26 10:28:47 | 显示全部楼层
谢谢分享,这个有用
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-12-4 16:43 , Processed in 0.130249 second(s), 41 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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