Skip to content

Home Assistant

2

Comments

  • So I went into Terminal on Mac and entered the curl command, and it executed. Went back into File Editor on HA and found this line in the debug for the appropriate time stamp...

    2020-07-15 00:46:20 DEBUG (MainThread) [homeassistant.components.webhook] Handling webhook POST payload for driveway_ss_trigger_1

    So if I'm thinking about this correctly, the curl command is getting to HA. HA is recognizing the webhook, but it is not executing. I can manually execute the automation in the Configuration and it works. here is the excerpt from the automations.yaml file...
    ```
    - id: '1593209500332'
    alias: ss_driveway_motion
    description: Activate lights on SS driveway camera motion
    trigger:
    - platform: webhook
    webhook_id: driveway_ss_trigger_1
    condition:
    - after: sunset
    before: sunrise
    condition: sun
    - condition: state
    entity_id: switch.shelly_shsw_1_115f00
    state: 'off'
    action:
    - device_id: e6629ba0af684d6890b50f41079b5a4d
    domain: switch
    entity_id: switch.shelly_shsw_1_115f00
    type: turn_on
    - delay: 00:10:00
    - device_id: e6629ba0af684d6890b50f41079b5a4d
    domain: switch
    entity_id: switch.shelly_shsw_1_115f00
    type: turn_off
    ```

    What am I missing?
  • So I won't know until dark if it's working, but some guys on the HA forum indicated that my condition for when it's dark to turn on a light was wrong and should be...

    condition:
    condition: state
    entity_id: sun.sun
    state: 'below_horizon'

    We'll check it out tonight, but wanted to reply back to anyone reading this...
  • edited July 2020
    Ok, another update. The activity is working (Yeah Baby!!!!), but I'm noticing that the amount of time to recognize the motion and then activate the lights is longer than I hoped. I observed that I walked almost 25 feet on my driveway before the light switched on. I thought it was still HA, but I confirmed that the signaling to the Shelly 1 switch is staying local and really quick. When I execute the Apple Script manually on the Mac Pro that acts as the server for SS, it's really fast. So the time from the script activating to the lights turning on is less than 1-2 seconds

    So it's the time from when the motion detection begins, the AI determines it's a person or vehicle (which works great and cuts down false positives enough to make this viable), and sends the Action script. For recording video, it works great. So without sounding ungrateful, how can I improve the timing on this for the switch relay? I like that the lights would not be set off by every insect that flies in front of the camera, but I also don't want to walk completely through the detection area before the lights turn on. Everything is currently set with defaults that Ben wrote.

    Thoughts?
  • I just installed Home-assistant on the same MacOS server as SecuritySpy. I was able to get a notification to work by using this tutorial as a basis: https://www.nabucasa.com/config/webhooks/#triggering-automation-with-a-webhook

    Start at "Triggering Automation with a Webhook. Once you've enable the web hook, select HTTP POST without parameters and replace the sample url with the one from home-assistant. One caveat is that I'm using the Home Assistant Cloud service. It might work differently without it. The service is $5/month at the time of this post.

    I was thinking it would be nice if Security Spy was one of the integration services, but I'm not sure that would help in this situation. Besides, it's not that much work to do the setup.
  • I hope I'm missing something obvious but after adding the camera and a valid SecuritySpy URL to my HomeAssistant configuration.yaml how do I then add a corresponding card to a Lovelace view?

    Alternatively I've read that the onvif integration is reliable and it detects and connects directly to my Dahua cameras. Is this a better approach for live monitoring?
  • i strongly recommend this integration.
    https://github.com/briis/securityspy
  • What a fantastic integration, thanks for posting the link to it!
  • edited April 2021
    In response to my question of Apr 19th, I found I needed to add a Lovelace card by entity.
    I now have a Picture Entity Card using the entity "camera.patiostream" which is defined in the following configuration.yaml definition:

    camera:
    - platform: mjpeg
    mjpeg_url: http://192.168.1.21:8000/++video?cameraNum=0&width=640&height=360&8325
    username: username_value_here
    password: password_value_here
    name: patiostream
    authentication: basic

    This works for both a dashboard image and a live video when the image is selected.
  • I have been so wrapped up with Home Assistant activities lately, and I just happened across the integration for SS into HA. Set up my cameras on picture entity cards, and now exploring. This works great!

    All my curls are still working to drive actions, but now it should be much more seamless. Now I got to figure out how to use all this stuff.

    Thanks Ben...ps: Dude!, you should have some form of update email/notification when you do all these cool updates for your customers. I could have been jamming months ago, but it's cool, I'm happy today. You're the best.
  • Hi @tlutrick great to hear this is working well for you! We do send in-app update notifications, and also sometimes send an email round to our SecuritySpy mailing list for more major updates and news. As for the "SecuritySpy for Home Assistant" project, this isn't our creation - it is all the excellent work of @briis - many thanks to briis for creating this!
  • Thanks for the kind words Ben.
    One thing that would really improve the HA Integration is a MOTION_OFF event being added to the EVENT STREAM. It is easy to detect when Motion starts but not when it ends. So hopefully you can put that on the 'list of things to do'
  • Hi @briis I'm happy to help here by adding additional information to the event stream, but I'm not sure about something like MOTION_OFF. Assuming you're using the latest version of the event stream (3), SecuritySpy sends MOTION events for each frame that contains motion. Absence of these events indicates no motion. So what you get now is a bunch of MOTION events, and then they will stop.

    But note that in a typical event (e.g. a person walks in front of the camera), you will get some frames with motion and other frames without motion (perhaps the person has stopped momentarily). So you could get something like [MOTION, MOTION, MOTION, MOTION_OFF, MOTION, MOTION, MOTION_OFF, MOTION, MOTION_OFF] for one particular event. I'm struggling to see how this would be particularly useful. Could you please explain how you would want to use these MOTION_OFF events?
  • Hi Ben,
    Basically what my program does is consume the event stream, and updates a State Machine when a new and relevant event happens, that State Machine is then fed back through a Callback to Home Assistant.

    So when a person walks in front of the Camera the Event Stream shows MOTION and the callback tells a binary sensor in Home Assistant that motion is active and turns it on.
    The issue is now when should I turn the Binary Sensor off again. The way it works right now, is that in the Motion Capture settings, I enable Movie Capture and the set the Capture Type to One Movie per Event. Then I watch the Event Stream for the FILE event, and when that occurs I turn the Binary Sensor off.
    But if people have another setting here, the Binary Sensor never gets turned off, or it turns off long after the Motion event is over.
    So therefore it would be great if SecuritySpy could send this MOTION_OFF when it no longer detects motion (Red light Turns back to Yellow in the UI) so that I can watch for this to turn off the Binary Sensor instead of the above workaround.

    I am aware that this can trigger the flow of events as you describe, but that is fine, the sensor will then turn on/off a few times, but that is also what is happening in front of the camera.

    Does this make sense? Or is there any other methods I could use to solve this?
  • Your current method uses the duration of the captured movie file, which is defined by the post-capture time setting, as a proxy for the motion end time. This is reasonable, though the post-capture time could vary a lot from system to system. Plus, as you say, this relies on movie capture being turned on, which is not always the case.

    Instead, how about using a short, fixed delay of a few seconds after the last MOTION event to set the motion end time? If you like, we could add this to SecuritySpy itself to avoid the need for you to implement it. I think this could be better than using the movie end time, and better than the multiple on/off events that would happen if this were done on a frame-by-frame basis. What do you think?
  • Hi Ben,
    Setting the motion end time is a great idea, and even better if you can do it right from SecuritySpy. I can work with that. So if you are going to do that, just let me know when there is something I can start testing. Thanks
  • OK, I've added this in the latest beta version of SecuritySpy (currently 5.3.4b3).

    Now, after one or more MOTION event, there will be a terminating MOTION_END event. The MOTION_END event is sent after there is no further motion trigger for a period of time equal to the "trigger time" setting under Preferences > Cameras > Triggers.

    When you implement this, you may then want to make SecuritySpy v5.3.4 a requirement - you can check the server version via the systemInfo call.

    I hope this does what you want, please let me know your thoughts!
  • Just gave it quick test, and it seems to be exactly what I needed. I will do some more testing later today, and give you feedback. Thanks Ben.
  • Did some more testing, and it works exactly as I had hoped. So thanks for this Ben. Looking forward to official release 5.34
  • Great to hear that!
  • edited May 2021
    Just found this thread. Super glad there is a Home Assistant integration! I can't wait to try it. @briis, I hope you make the plugin an official integration. Keep up the great work both you and @ben
  • @ben should know that thanks to @briis, I upgraded to SecuritySpy version 5, due to the HomeAssistant plugin saying: "The installed version of SecuritySpy is not compatible with this version of the Integration. Please upgrade SecuritySpy and try again."
  • Hmm. Well, that didn't work that well. Now I see that the latest release is 5.3.3, but 5.3.4 is needed. How/when do I get 5.3.4 @ben?
  • Hi Rick,
    It will work with the beta version of 5.3.4, which you can find a link to a few entries back in this post. Btw. I have been running that version for 2 weeks, without any errors.
  • Hi Ben,
    When I use the H.264 stream (RTSP) from the Web Server, what format is the Audio delivered in? I do get sound when using the command in VLC, but I do not get sound in Home Assistant. Home Assistant only supports AAC audio format, so could that be the reason?
  • Hi @briis that must be the reason - at this time, SecuritySpy sends audio in µLaw format only. We'll take a look at supporting AAC, but I can't promise anything in the near future.
  • Thanks Ben. At least I don't have to debug anymore on this. Hope it will be possible with AAC in the future.
  • Thanks for this amazing integration for Home Assistant. It was the missing link to get my cameras and sensors truly integrated. I also wanted to confirm that the video and sensors translated to homekit with very little issue using the homekit integration in home assistant. Great work!
  • I’d like to move from Indigo Domotics to Home Assistant and continue with the excellent SS. Is there a relatively straightforward plugin or similar available? Any integration instructions in the SS manual? Reading thru 2 years of posts here it appears @briis has made something. I’m seeking something for programming simpletons here…
  • Hi @stevieb, here is the excellent plugin made by @briis:

    SecuritySpy for Home Assistant

    Instructions on how to install this and integrate with SecuritySpy are on this page. The slightly tricky bits would be installing the plugin files in the right place, setting a manual IP for the Mac running SecuritySpy (so that it is fixed and does not change), and then configuring the plugin. Please let me know if you need any further info on any of these steps.
  • After years of off & on research and planning I'm finally getting Security Spy going in conjunction with some home automation (recently moved to Home Assistant from Indigo). I installed the SecuritySpy for Home Assistant plugin and the associated Motion Notification blueprint and got things working fairly quickly – I get a notification on my phone when the camera I'm testing detects motion. It even sends a photo thumbnail with the notification (I think… it's very small).

    What I'd really love is a notification on my phone and when I tap that notification I can watch a video clip of the event that triggered the notification, or at the very least a still photo. From what I've seen I'm sure this is possible but I don't really know where to start.

    Big picture, if it helps: eventually I'd like to a do a few things based on whether or not a person has been detected. For example, if a person is detected:

    • Send me a notification, with a way to watch the video. Or maybe a photo. Or a photo with a link to the video clip?
    • Turn on (or increase brightness) on the corresponding outdoor light (these are Lutron lights already in Home Assistant)
    • Play some audio (my cameras have built in speakers)
    • Wait a few seconds and then turn on a nearby indoor light (also Lutron/Home Assistant)
    • Etc.

    But I figured I'd start simple and try to just send myself a video or photo based on motion detection. I think I can piece together the other parts (triggering lights) if I can sort that out.

Sign In or Register to comment.