I removed it from the example to make it more clear. In your template you can add {{ "\U0001F6A8" }} to have a siren. You can use this site to find the hex code for any emoji and just replace the hex in the example.
I am trying to get this working, but not sure exactly which sections i need to change to match my environment. Obviously i need to change the server address and API key, but the rest i am not sure about.
I am getting this error in the logs in HA. I think it is because I don’t have a camera named entryway?
Running Unifi Video version 3.9.9 and HA 0.79
2018-10-11 01:23:50 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: list object has no element -1 (value: {“data”:[],“meta”:{“totalCount”:0,“filteredCount”:0}}, t
emplate: {% set last = (value_json.data | count) - 1 %} {{ value_json.data[last][’_id’] }}
)
It looks like your Unifi NVR API is not returning any recordings. You should be able to paste https://<Unifi NVR domain name>/api/2.0/recording?apiKey=<Unifi NVR API KEY> into your browser and see all of the recording IDs in JSON format.
So i did that, ended up using
http://:7080/api/2.0/recording?apiKey=
at which pointed I realized i was using a view only API key. once i change it to the key with recording permissions, it is returning data.
Now I am getting this error.
[homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: , template: {% set last = (value_json.data | count) - 1 %} {
{ value_json.data[last][’_id’] }}
if i change it to use https://:7443 i get this error
2018-10-12 01:43:12 ERROR (SyncWorker_0) [homeassistant.components.sensor.rest] Error fetching data: <PreparedRequest [GET]> from https://10
.30.39:7443/api/2.0/recording?apiKey= failed with HTTPSConnectionPool(host=‘10.20.30.39’, port=7443): Max ret
s exceeded with url: /api/2.0/recording?apiKey= (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAI
] certificate verify failed (_ssl.c:841)’),))
2018-10-12 01:43:12 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet. Retrying in 60 seconds.
7080 is the correct port if you’re connecting over HTTP. 7443 is returning an untrusted certificate that Home Assistant is not going to connect to unless you somehow turn off certificate checking (which you should not do).
I’m not sure where you’re getting the API key from since in my Unifi NVR user setting page all I see is an option to enable/disable the API or regenerate the key. All the API is being used for is to grab the latest recording ID in order to build a URL to send to your iOS device.
I have everything almost working, I can see the current recording in states okay. I am just having issues with the JSON in the automation it is showing the single quote with the current recording. If I remove the single quotes I am able to get the recording downloaded with no problems. Is there any way to format the JSON to remove the extra single quotes to have a clean url.