I think I don’t have any other options. If any, I don’t know them. AFAIK, HikVision devices API/SDK (at least the doorbell and the Access Control Terminal -ACT- I have), work with web based queries (what they call ISAPI protocol), although I could be wrong with the right terminology because I am not a specialist, that’s basically what I think HikVision offers.
The ACT also have the option to set up a kind of “webhook sender”:
But, the webhooks payload does not contain all the data I need (the name of the authenticated user, for example), so I need the webhook to trigger an automation and to identify event’s type (auth ok, auth nok, tampering…) and then fetch the rest of the data with cURL, link with the right webook event and parse everything accordingly.
For the doorbell, I have been using this awesome addon. However, I haven’t found any solution for the ACT, so I’ve been trying to build something that worked for my own scenario. I have been facing some challenges like the one posted here, but with some help from others, I think I have managed to get something working to be notified for the most important events. I guess that part is a bit off-topic as it is out of the scope of the REST sensor topic though.
Happy to assist when doing so if checking with my devices helps for the purpose.
You are right. That option works indeed. However, the sensor status and attributes don’t stay because the device sends three events in a row every time an authentication happens, and the last event is not the one containing the name:
Due to that, it is better to use the cURL command to get the full payload with the latest five or so events, so you can search for the relevant serial linked to the actual webhook event which triggered the automation, which appears also in the cURL POST returned payload. This can be done by handling a combination of the majorEventType and subEventType entries (webhook) and major and minor entries (cURL POST return), as they basically identify the type of event.
Long story short, I already managed to achieve what I wanted to do. Perhaps there is a cleaner way to do it because my automation became way too complex than I expected at the beggining (when I open the thread), but I am happy with the current outcome. I just was courious to know why the REST thing is behaving like it is, as this is an option that looks interesting to me for other applications that I will for sure need in the future.
If anyone is interested, I can try to create a blueprint or share the automation (it needs mqtt, shell_commands, sensors…), but I haven’t found information about this specific device anywhere, so I guess it is not becoming a mainstream thing like doorbells are…