|
发表于 2020-4-21 20:09:36
|
显示全部楼层
本帖最后由 zhenxiwen 于 2020-4-21 20:12 编辑
我抓到的包,内容如下(敏感数值做了处理),按照你的方法配置后,打不开门禁,请问大神是什么原因呀。
Request Head:
POST /erp//front/interface/door/openDoor/three HTTP/1.1
Accept-Encoding: gzip, deflate
deviceType: EVR-AN
locale: zh_CN
Content-Type: application/json; charset=utf-8
Content-Length: 264
Host: www.91hilife.com
Connection: Keep-Alive
User-Agent: okhttp/3.11.0
Body:
{
"access_token":"0f5aae91-ae9d-41f4-988e-1ce7",
"doorName":"K7主梯通道门",
"doorCommunityId":"25",
"communityId":"25",
"doorId":1372,
"cardNo":"103982",
"userId":"3235435759",
"customID":"2432229587",
"version":"6.2.0",
"isScan":2
}
我的配置如下:
## 虚拟开关
input_boolean:
# test11111:
# name: 虚拟开关
k7_diku_zhuti:
name: k7主梯门
switch:
- platform: template
switches:
k7_diku_zhuti: #南区大门
friendly_name: k7主梯门
value_template: "{{is_state('input_boolean.k7_diku_zhuti', 'on')}}"
turn_on:
service: rest_command.k7_diku_zhuti
turn_off:
service: rest_command.k7_diku_zhuti
rest_command:
k7_diku_zhuti: #南区大门
url: https://www.hilife.com/erp//front/interface/door/openDoor/three
method: POST
payload: '{"access_token":"0f5aae91-ae9d-41f4-988e-1ce7","doorName":"K7主梯通道门","doorCommunityId":"25","communityId":"25","doorId":1372,"cardNo":"103982","userId":"3235435759","customID":"2432229587","version":"6.2.0","isScan":2}' #这里的xxxxxxx就是抓包的内容
content_type: 'application/json; charset=utf-8'
verify_ssl: true
另外,你帖子中的switch.60487543500291b29acc是什么,时虚拟开关吗。我是做了一个虚拟开关,用来触发开门。
- platform: template
switches:
nanqudamen: #南区大门
friendly_name: 南大门
value_template: "{{ is_state('switch.60487543500291b29acc', 'on') }}"
turn_on:
service: rest_command.nanqudamen
turn_off:
service: rest_command.nanqudamen |
|