I have a dashboard showing the front entrance to our house. It displays a mix of the Axis integration sensors as well as some of the SSpy sensors. In addition it's showing pure motion sensor data from other sensors via the ElkM1 integration.
Some of the SSpy integration's prooffered sensors seem inverted to me, and others less useful.
I have the display widget thingys show last time of activation. I have a goal to cook up a timeline, esp with the SSpy object detection reports.
in parallel I have the SSPy 'logging' http thingy dumping into MQTT.
The SS integration for HA pulls all your cameras in and makes them available for viewing. It also generates binary sensors for motion.
In order to use object detection as a binary switch you need to play with the YAML for the automation to pull that hidden sensor info.
I've found, though, that the object detected sensor isn't working right. It seems to generate an object detected event when SS doesn't actually show one.
For example, if I watch the HA log for my driveway camera, it will trigger that it sees Vehicle about once every 20 min despite no vehicles entering, and no SS motion event for vehicle being recorded. There was some previous discussion on this about 2 years ago by @benish so I'm not sure if I'm seeing the same issue or a new one. Either way, it's a bit of a letdown that I'm having the same issue 2 years later (for the record, I understand that is a 3rd party integration and Ben is not responsible for it).
I have used the HK helper app, and that does work well, but requires an additional layer that I would love to avoid if I can.
@caseyd When you say "in parallel I have the SSPy 'logging' http thingy dumping into MQTT." can you expound a bit more?
I'm having a tough time with the SS integration in HA. It's simply useless as is because there seems to be a hidden threshold for object identification that is lower than what is used in the app itself. So it fires about 300% more than it should.
I am wondering if I could get SS to post object identifications to an MQTT topic and bypass the integration. Though I fear I'll see the same result.
Is there any other way to reliably notify a HA instance of an object being identified on a camera besides going through HK Helper (which I could do as last resort but with many extra dummy switches to clutter my HK experience).
Will also note there's nothing wrong with using the HK helper app. It's nice for what it does. Just looking for a higher-level solution for my somewhat complicated needs. For example, I'd need to start duplicating cameras to isolate actions and build switches for each permutation.
@jimmyjohnson I use Webhooks via Apple Script with my Home Assistant so that automation triggers rely on Security Spy's object detection rather than the HA integration's binary sensors.
e.g. my Reolink Doorbell camera has an Action that runs a specific Apple Script. Amongst other things, this script sends a call to a HA webhook:
on run args
set cameraNum to item 1 of args
set cameraName to item 2 of args
set reason to item 3 of args
if (cameraName = "ReolinkDoorCam") then
do shell script "curl -d '' http://192.168.1.10:8123/api/webhook/kiosk_doorcam_motion"
end if
The HA automation picks this up like so (along with a doorbell press):
automation:
- alias: "Kiosk Screen On Doorcam Motion"
id: kiosk_screen_on_doorcam_motion
initial_state: 'on'
trigger:
- platform: webhook
webhook_id: kiosk_doorcam_motion
local_only: true
- platform: state
entity_id: binary_sensor.frontdoor_visitor
from: 'off'
to: 'on'
Hope this helps.
As a side note, I have a cheap battery-less Android tablet by the door running Fully Kiosk that automatically displays a video from my doorbell cam as a result of this automation. Very wife friendly. ;)
@paul2020 Thanks for this. AppleScript has been a black box for me so I'll need to learn some basics (like where do these scripts live, etc). But this sounds exactly like what could help.
I'm sure the v5 Settings window used to have an Edit Script button that helped you see where they were being stored, but anyway they can be found in your home folder, e.g
I've spent some time reading about AppleScript. This seems like it's going to be awesome. Just before I get too far down the road, and maybe this will help others, does this script seem like it's going to work how it looks like I'd want it to work? and I can just list out the 20 different combinations of triggers I want?
BTW, @Ben since there's an option to exclude birds now, does that mean that you pass Bird as a discrete object in the args now? Or is just still just Human, Vehicle, Animal?
<script>
on run args
set cameraNum to item 1 of args
set cameraName to item 2 of args
set reason to item 3 of args
if (cameraNum = "0") and (reason = "Vehicle") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/driveway_car"
else
if (cameraNum = "22") and (reason = "Vehicle") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/parking_lot_car"
else
if (cameraNum = "11") and (reason = "Human") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/human_on_porch"
end if
I've also seen examples of using this syntax, but either way, AppleScript editor gives me an error that it's expecting end of line and finds end of script.
on run args
set cameraNum to item 1 of args
set cameraName to item 2 of args
set reason to item 3 of args
if (cameraNum = "0") and (reason = "Vehicle") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/driveway_car"
else if (cameraNum = "22") and (reason = "Vehicle") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/parking_lot_car"
else if (cameraNum = "11") and (reason = "Human") then
do shell script "curl -d '' http://10.10.0.3:8123/api/webhook/human_on_porch"
end if
on run args
set reason to item 3 of args
if reason contains "Human" then
do shell script "afplay /System/Library/Sounds/Morse.aiff"
end if
if reason contains "Vehicle" then
do shell script "afplay /System/Library/Sounds/Frog.aiff"
end if
if reason contains "Animal" then
do shell script "afplay /System/Library/Sounds/Ping.aiff"
end if
end run
I too was getting funky motion triggers from the third party integration, and have now scripted the appropriate commands directly into home assistant... which is much more elegant and allowed me to remove the integration..
I think my next order of business will be to figure out how to deliver a preview image, or use one of the fancy scripts to send a mini movie (@paul2020 posted IIRC).
If anyone has this already figured out and would be so kind to post some examples, I'd appreciate it, and would probably be nice to have archived on this thread for future users.
Yes I posted a way to do this via Telegram as I do find sending a short fast moving video clip to my phone a very useful feature. I use Signal now instead (I trust the platform for these clips more than Telegram), but it's not easy to set up as it requires a Signal relay installed via Docker in your home network. I believe the Telegram method still works though: https://bensoftware.com/forum/discussion/3149/sending-a-short-fast-video-of-motion-to-telegram-example
Comments
Hi there; I'm using it.
I have a dashboard showing the front entrance to our house. It displays a mix of the Axis integration sensors as well as some of the SSpy sensors. In addition it's showing pure motion sensor data from other sensors via the ElkM1 integration.
Some of the SSpy integration's prooffered sensors seem inverted to me, and others less useful.
I have the display widget thingys show last time of activation. I have a goal to cook up a timeline, esp with the SSpy object detection reports.
in parallel I have the SSPy 'logging' http thingy dumping into MQTT.
Can you share screenshots of options the SS plug in for home assistant offers? for like making automations and stuff?
perhaps I will simply list the presented HA entities for one of my cameras. OC your specific cameras may well be different. ( later today )
The SS integration for HA pulls all your cameras in and makes them available for viewing. It also generates binary sensors for motion.
In order to use object detection as a binary switch you need to play with the YAML for the automation to pull that hidden sensor info.
I've found, though, that the object detected sensor isn't working right. It seems to generate an object detected event when SS doesn't actually show one.
For example, if I watch the HA log for my driveway camera, it will trigger that it sees Vehicle about once every 20 min despite no vehicles entering, and no SS motion event for vehicle being recorded. There was some previous discussion on this about 2 years ago by @benish so I'm not sure if I'm seeing the same issue or a new one. Either way, it's a bit of a letdown that I'm having the same issue 2 years later (for the record, I understand that is a 3rd party integration and Ben is not responsible for it).
I have used the HK helper app, and that does work well, but requires an additional layer that I would love to avoid if I can.
Which entity card are you using to display live streaming on the dashboard?
I'm a beginner at dashboards... I think the answer is "camera" entity.
@caseyd When you say "in parallel I have the SSPy 'logging' http thingy dumping into MQTT." can you expound a bit more?
I'm having a tough time with the SS integration in HA. It's simply useless as is because there seems to be a hidden threshold for object identification that is lower than what is used in the app itself. So it fires about 300% more than it should.
I am wondering if I could get SS to post object identifications to an MQTT topic and bypass the integration. Though I fear I'll see the same result.
Is there any other way to reliably notify a HA instance of an object being identified on a camera besides going through HK Helper (which I could do as last resort but with many extra dummy switches to clutter my HK experience).
Will also note there's nothing wrong with using the HK helper app. It's nice for what it does. Just looking for a higher-level solution for my somewhat complicated needs. For example, I'd need to start duplicating cameras to isolate actions and build switches for each permutation.
@jimmyjohnson I use Webhooks via Apple Script with my Home Assistant so that automation triggers rely on Security Spy's object detection rather than the HA integration's binary sensors.
e.g. my Reolink Doorbell camera has an Action that runs a specific Apple Script. Amongst other things, this script sends a call to a HA webhook:
The HA automation picks this up like so (along with a doorbell press):
Hope this helps.
As a side note, I have a cheap battery-less Android tablet by the door running Fully Kiosk that automatically displays a video from my doorbell cam as a result of this automation. Very wife friendly. ;)
@paul2020 Thanks for this. AppleScript has been a black box for me so I'll need to learn some basics (like where do these scripts live, etc). But this sounds exactly like what could help.
I'm sure the v5 Settings window used to have an Edit Script button that helped you see where they were being stored, but anyway they can be found in your home folder, e.g
/Users/paul/SecuritySpy/Scripts
Also ChatGPT can help with the code these days!
ahh nice one @killerdan56
Thanks, all!
I've spent some time reading about AppleScript. This seems like it's going to be awesome. Just before I get too far down the road, and maybe this will help others, does this script seem like it's going to work how it looks like I'd want it to work? and I can just list out the 20 different combinations of triggers I want?
BTW, @Ben since there's an option to exclude birds now, does that mean that you pass Bird as a discrete object in the args now? Or is just still just Human, Vehicle, Animal?
edited for syntax
I've also seen examples of using this syntax, but either way, AppleScript editor gives me an error that it's expecting end of line and finds end of script.
Thanks @killerdan56. Looks like I need an "end run" that I was missing. Appreciate the example!
Just a quick thank you to all in this thread.
I too was getting funky motion triggers from the third party integration, and have now scripted the appropriate commands directly into home assistant... which is much more elegant and allowed me to remove the integration..
I think my next order of business will be to figure out how to deliver a preview image, or use one of the fancy scripts to send a mini movie (@paul2020 posted IIRC).
If anyone has this already figured out and would be so kind to post some examples, I'd appreciate it, and would probably be nice to have archived on this thread for future users.
Yes I posted a way to do this via Telegram as I do find sending a short fast moving video clip to my phone a very useful feature. I use Signal now instead (I trust the platform for these clips more than Telegram), but it's not easy to set up as it requires a Signal relay installed via Docker in your home network. I believe the Telegram method still works though: https://bensoftware.com/forum/discussion/3149/sending-a-short-fast-video-of-motion-to-telegram-example
I'd like to try to do via the Home Assistant App as part of a series of automations.