briis/securityspy

Alarm Switches

stbrun opened this issue · 23 comments

Hello. Would it be possible to add also the alarm switches additionally to the continuous and motion switches. Als the SS presets would be really great. Thank for you great work! Stefan

briis commented

Sure. I will need to get the basics fixed first, and have a stable system. Then I will look at this.

+1
Will be nice to have ss presets switches

briis commented

Honestly I havn't used SecuritySpy for quite a while, as my prime system now is Unifi Protect. So I am not an experienced user.

Could you elaborate more on the ss preset switches? How do you use this, and how would you expect the behaviour in Home Assistant?

For the alarm switches, do we agree that this runs on its own? Meaning that if you set motion recording to off, this should not affect the action setting and vice versa?

briis commented

Hi both,
I did a bit more digging on the Schedule Settings. I realize that this is what you have been using to control when to arm/disarm cameras. But when having this in to Home Assistant, I don't really see the need for it anymore.
Home Assistant is built to actually control all this. You would make automations based on events, time of day, presence etc, that would then do something to the arming state of the cameras or sending you a notification if something happens.

So unless I missed the purpose of the Schedule Settings, I can't see the need for it???? Please explain?

briis commented

OK. I have nothing against doing it, just want to make sure it makes sense. I will need to think bit about how to do this.
It is easy to switch to a setting if you know the ID, but it would be nice if I could present a list of these ID's and this is the challenge.
How do you use the Schedule Overrides? Are these relevant in this context?

briis commented

Basically as I see it:

  • Schedules are setting arming mode (A,C,M) on a specific time or all day or not.
  • Schedule Overrides can then extend or shorten that time.

It is easy to do the Preset Schedules like unarmed 24/7, armed 24/7, Armed Sunrise to Sunset and Armed Sunset to Sunset. But you can also define your own Schedules, and these will get an ID number that you need to know in order to activate it from Home Assistant.

i have the following
camara_interior:
url: 'http://usr:pw@ipss:8000/++setPreset?id=1806564977'
just to set the preset
but from ha i dont have any control, ie is setted or not

and i simulate status with.:
binary_sensor:
sensor:
exterior_set:
value_template: >-
{{
states('switch.record_motion_cocina') == "off" and
states('switch.record_motion_salon') == "off" and
states('switch.record_motion_salon_2') == "off" and
states('switch.record_motion_garaje') == "on" and
states('switch.record_motion_terraza') == "on" and
states('switch.record_motion_piscina') == "on" and
states('switch.record_motion_trasera') == "on" and
states('switch.record_motion_entrada_jardin') == "on"
}}

briis commented

I will soon release, what I think will be the final beta, before I call this version 1. (I still need to fix the Video)
This release has added a new Service called securityspy.enable_schedule_preset which only takes 1 argument, and that is the Schedule Preset id. When running this service, the defined preset will active.
If you look at the camera entities, you will be able to find all preset id's that are defined on SecuritySpy. That was the only idea I had to help with getting the id.

Btw, I don't know if you seen it, but if there is a motion event and the binary_sensor goes to on, there is also an Attribute called event_object if you have enabled the Human and/or vehicle AI functions in SecuritySpy, this will contain the value Human or Vehicle, if either of these are detected.

Let me know how this goes, and if you find new issues have new requests, just create an issue description.

briis commented

No problem Stefan.
In Home Assistant you will find a menu to the left called Developer Tools. If you click on that you will get a new Top menu where you can see STATES SERVICES TEMPLATES EVENTS.
Click on STATES and then you will get a list of all the entities in your system. You can scroll down and find your cameras. They will start with camera. and then the name of the Camera. On the left you can then see all the Attributes. Here is a picture of what I see on one of my Cameras. (I have created two Schedule Presets as you can see under preset_id)

Skærmbillede 2021-03-28 kl  20 34 01

This is a very good menu to see more details on all the things defined in Home Assistant.
Hope this helps.

briis commented

Yes, create an automation and then call the service. Here is an example that sets the Schedule Preset I Arm Outdoor (See above) at Sunset.

alias: Switch on Outdoor cameras at Sunset
description: ''
trigger:
  - platform: sun
    event: sunset
condition: []
action:
  - service: securityspy.enable_schedule_preset
    data:
      preset_id: '1641865187'
mode: single

The trigger can be any other thing, like you leaving the house, or something else.
Does this help?

briis commented

I will close this now, as I see it solved.