Supergiovane / node-red-contrib-hikvision-ultimate

A native set of node for Hikvision Cameras, Doorbells, Alarms, Radars etc.
https://www.facebook.com/supergiovaneDev
MIT License
46 stars 12 forks source link

AXPRO - force arm by-passing triggered sensors #71

Closed JacekKac closed 2 weeks ago

JacekKac commented 2 weeks ago

hi:) it's me again :)

i need some help to connect this flow to MQTT.

1/ Working: receving zone updates / cid events to flow and forwarding them to my mqtt broker for further handling in home automation software.

2/ NOT working publishing to AXPRO/SET channel to forward commands to AXPRO flow.

image

I was playing arroud with function to transform the mqtt message into this "inject" message but can not achieve my goal:(

i want to publish: armAwayArea: 2 to mqtt and run this command on axpro node AXPRO/SET : msg.payload : string[14] "armAwayArea: 2" not sure what kind of transformation / function will be ok for this.

Function: 
var newmsg;
if (msg.payload === "armStayArea: 1") {
    newmsg = { armStayArea: 1 }
    return newmsg;
}
if (msg.payload === "armStayArea: 2") {
    newmsg = { armStayArea: 2 }
    return newmsg;
}
if (msg.payload === "clearAlarmArea: 1") {
    newmsg = { clearAlarmArea: 1 }
    return newmsg;
}
if (msg.payload === "clearAlarmArea: 2") {
    newmsg = { clearAlarmArea: 2 }
    return newmsg;
}
if (msg.payload === "disarmArea: 1") {
    newmsg = { disarmArea: 1 }
    return newmsg;
}
if (msg.payload === "disarmArea: 2") {
    newmsg = { disarmArea: 2 }
    return newmsg;
}
if (msg.payload === "armAwayArea: 1") {
    newmsg = { armAwayArea: 1 }
    return newmsg;
}
if (msg.payload === "armAwayArea: 2") {
    newmsg = { armAwayArea: 2 }
    return newmsg;
}

but i get undefined in the debug window

please help :)

JacekKac commented 2 weeks ago

i think it's working - the function is transforming the messages right, but what i noticed is: Arming zone 2 gives me "Arming" message in the APP but it's not changing to "Armed".

The location has more than zero zones with need to by bypassed - in the app i have a popup - "Error: ZoneName is opened would you like to continue to arm" is there a way to accept this prompt ?

JacekKac commented 2 weeks ago

When i am arming this zone from the hikconnect app im receving this status codes:

ARM: {"CIDEvent":{"code":1570,"name":"XXX","userName":"XXX","type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":5,"zoneName":"Drzwi tarasowe","zoneCompatible":true,"ipcChannel":254}}

{"CIDEvent":{"code":1570,"name":"XXX","userName":"jXXX","type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":5,"zoneName":"Drzwi tarasowe","zoneCompatible":true,"ipcChannel":254}}

{"CIDEvent":{"code":1570,"name":"XXX","userName":"XXX,"type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":10,"zoneName":"Okno Gościnny","zoneCompatible":true,"ipcChannel":254}}

{"CIDEvent":{"code":1570,"name":"XXX","userName":"XXX","type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":10,"zoneName":"Okno Gościnny","zoneCompatible":true,"ipcChannel":254}}

{"CIDEvent":{"code":1570,"name":"","userName":"jxxxxx","type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":11,"zoneName":"Dom","zoneCompatible":true,"ipcChannel":254}}

{"CIDEvent":{"code":1570,"name":"xxxxx","userName":"xxxxxx","type":"detectorStatusEvent","trigger":"2024-07-07T17:36:03+01:00","upload":"2024-07-07T17:36:04+01:00","zone":11,"zoneName":"Dom","zoneCompatible":true,"ipcChannel":254}}

========================================================================================= and finally :

{"CIDEvent":{"code":3441,"name":"xx","userName":"xxx","type":"armAndDisarm","trigger":"2024-07-07T17:36:05+01:00","upload":"2024-07-07T17:36:05+01:00","system":2,"subSystemName":"kontraktony"}} so it seems that the app is calling /ISAPI/SecurityCP/control/bypass? and then calling arming endpoint maybe we can introduce a Force Arm Function to this node to:

1/ Get a list of all triggered sensors in a zone 2/ By-pass all of them 3/ Arm this zone

Supergiovane commented 2 weeks ago

Hi bypassing zones isn't currently implemented, as there was some issues with old axpro firmwares. I suggest you to allow the arming of the axpro when zones are open, directly in the axpro panel.