Giter Club home page Giter Club logo

securityspy's Introduction

SecuritySpy for Home Assistant

GitHub release hacs_badge

This Integration will no longer be maintained

I did give it a try, but I simply don't have the resources to maintain this integration anymore, and therefore I will remove it from the default HACS store. I will leave the Github Repository open, and I hope that someone else will be able to take it over.

Overview

This is a Home Assistant Integration for Ben Software's SecuritySpy Surveillance system.

Basically what this does, is integrating the Camera feeds from SecuritySpy in to Home Assistant, adds switches to adjust recording settings and adds Binary Motion Sensors to show if motion has occurred. This project uses a local push model to get data from the SecuritySpy Server.

There is support for the following devices types within Home Assistant:

  • Camera
  • Binary Sensor
  • Button
  • Sensor
  • Switch

Please use the Issues tab on the repository, to report any errors you may find.

Prerequisites

Before you install this Integration you need to ensure that the following settings are applied in SecuritySpy:

  1. Enable the Web Server Open SecuritySpy on your Mac. Select Preferences from the SecuritySpy Menu and click the Web icon on the Top Left. Make sure that HTTP enabled on Port is selected and note the Port number as you need this later. Default is port 8000, but you are free to select another port if you want to. Currently SSL is not supported, so it does not have to be selected, but you can do, if you want to use this with external access.

  2. Add a Web Server User You must add a user with either Administrator privileges or at least Get Live Video and Images and Arm and Disarm, set schedules privileges. Note: This might not be enough, as I have seen some errors, when using a user like that. If you want to be sure that it works for now, give the user Administrative rights.

  3. This Integration is only guaranteed to work on version 5.3.4 and greater of SecuritySpy.

Web Server Setup User Setup

Note As Home Assistant only supports AAC audio format and SecuritySpy only sends audio in µLaw, there is NO AUDIO on the Live Stream. Hopefully this can be corrected in future updates of either of these programs.

Installation

HACS Installation

This Integration is part of the default HACS store. Search for securityspy under Integrations and install from there. After the installation of the files you must restart Home Assistant, or else you will not be able to add SecuritySpy from the Integration Page.

If you are not familiar with HACS, or haven't installed it, we would recommend to look through the HACS documentation, before continuing. Even though you can install the Integration manually, we recommend using HACS, as you would always be reminded when a new release is published.

Please note: All HACS does, is copying the needed files to Home Assistant, and placing them in the right directory. To get the Integration to work, you now need to go through the steps in the Configuration section.

Manual Installation

To add SecuritySpy to your installation, create this folder structure in your /config directory:

custom_components/securityspy. Then, drop the following files into that folder:

__init__.py
binary_sensor.py
button.py
camera.py
config_flow.py
const.py
data.py
entity.py
manifest.json
models.py
sensor.py
services.yaml
strings.json
switch.py
<translations> (Copy the directory and the files within it)

Configuration

To add SecuritySpy to your installation, go to the Integrations page inside the configuration panel and add a Server by providing the IP Address, Port Username and Password for the SecuritySpy Webserver you set up above.

If the Server is found on the network it will be added to your installation. After that, you can add additional Servers if you have more than one in your network.

You can only add SecuritySpy through the integrations page, not in configuration files.

host: (string)(Required) Type the IP address of your SecuritySpy Server. Example: 192.168.1.10

port: (int)(required) Type the Port number you setup under the Prerequisites section. Example: 8000

username: (string)(Required) The username you setup under the Prerequisites section.

password (string)(Required) The password you setup under the Prerequisites section.

disable rtsp stream (boolean)(Optional) Mark this box, if you want to diable the RTSP stream - Gives better realtime live streaming.

Automation Examples

As part of the integration, we provide a couple of blueprints that you can use or extend to automate stuff.

Motion Notifications

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Here are examples of different automations that can be used with this integration.

Capture Image when Person is detected

This automation captures an image, when a Person is detected on the Camera. For the example, the Camera is called camera.outdoor so the motion sensor will then be named binary_sensor.motion_outdoor It is a very basic example, but it can be used to illustrate the use case. event_object can be human or vehicle.

alias: Capture snapshot when person is detected
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.motion_outdoor
    attribute: event_object
    to: human
condition: []
action:
  - service: camera.snapshot
    target:
      entity_id: camera.outdoor
    data:
      filename: /config/www/camera_outdoor.jpg
mode: single

Download Video Recording when motion is complete

If you want to have a copy of the latest Video recording on your local Home Assistant, then the below is an example on how to do that. Again the Camera is called camera.outdoor so the motion sensor will then be named binary_sensor.motion_outdoor

alias: Download Recording after motion
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.motion_outdoor
    from: 'on'
    to: 'off'
condition: []
action:
  - service: securityspy.download_latest_motion_recording
    data:
      entity_id: camera.outdoor
      filename: /media/outdoor_latest.m4v
mode: restart

Enable Debug Logging

If logs are needed for debugging or reporting an issue, use the following configuration.yaml:

logger:
  default: error
  logs:
    custom_components.securityspy: debug

securityspy's People

Contributors

briis avatar dependabot[bot] avatar wrt54g avatar yesthatallen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

securityspy's Issues

Error handling request

Home Assistant 2022.3.1
SecuritySpy for Home Assistant 1.1.1

Error on HA Register:

`Logger: aiohttp.server
Source: custom_components/securityspy/camera.py:177
Integration: SecuritySpy for Home Assistant (documentation, issues)
First occurred: 16:28:54 (5 occurrences)
Last logged: 16:32:14

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 752, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 770, in handle
image = await _async_get_image(
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 168, in _async_get_image
image_bytes = await camera.async_camera_image(
File "/config/custom_components/securityspy/camera.py", line 177, in async_camera_image
last_image = await self.secspy.get_snapshot_image(
File "/usr/local/lib/python3.9/site-packages/pysecspy/secspy_server.py", line 221, in get_snapshot_image
raise RequestError(
pysecspy.errors.RequestError: Fetching Snapshot Image failed: 404 - Reason: Not Found
`

No wey to add server

in instructions its says "To add SecuritySpy to your installation, go to the Integrations page inside the configuration panel and add a Server by providing the IP Address, Port Username and Password for the SecuritySpy Webserver you set up above." There does not appear a away to do this in ANY of the Integration pages either the "main" one nor the HACS . Appears to be a step missing.

HA SS Error after HA Core Update from 2023.4.5 to 2023.4.6

Hello Briis

I got the following error and SS was not able to start in HA:

Logger: homeassistant.setup
Source: setup.py:213
First occurred: 09:54:50 (1 occurrences)
Last logged: 09:54:50

Setup failed for custom integration securityspy: Unable to import component: cannot import name 'InvalidCredentials' from 'pysecspy.errors' (/usr/local/lib/python3.10/site-packages/pysecspy/errors.py)

The error occurred after upgrading HA core from 2023.4.5 to 2023.4.6.

Could you please help me with this? Thanks for your support!
Stefan

Alarm Switches

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

HA not receiving motion triggers from Security Spy but does control PTZ and recording functions of Security Spy.

I added the Security Spy integration using HACS and all cameras appeared in HA. I can change camera settings and control their PTZ through HA.

The problem - No movement recognized on the SecuritySpy side is showing up on the HA side. The movement sensors never trip and show as UNKNOWN for status in sensor history.

Im running additional home automation software (Indigo) that also has a security spy plugin. That software seems to be getting consistent movement triggers from Security Spy, so they are firing. HA is not recognizing them for some reason.

Im running HTTPS Security Level 1 in Security Spy. The integration has Admin access and is set up through the HTTPS enabled port.

Thanks in advance for any help.

Feature Request: Binary Sensor for camera online status

Having a binary sensor for the online status of a camera would be useful. I also noticed that occasionally the plugin will show a camera as online, even though it is currently offline. So updating the frequency of checking the online status of a camera might be useful as well.

SS enable/disable camera with HA integration switch

Hello Briss
I would like to be able to enable/disable the usb webcam in SS on my mac with a HA switch. Both SS and HA are running on the same mac. I would like to automate that if I go out I can enable the camera with an automation. The reason for that is, that the usb camera uses recourses on the mac which I don't want to spend when I'm at home. Do you see a possibility to do this? Thanks for your support. Best regards, Stefan

data.py 'NoneType' object has no attribute 'items'

Logger: homeassistant
Source: custom_components/securityspy/data.py:59
First occurred: 12:49:46 PM (262 occurrences)
Last logged: 1:40:49 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/securityspy/data.py", line 47, in async_refresh
self._async_process_updates(
File "/config/custom_components/securityspy/data.py", line 59, in _async_process_updates
for device_id, data in updates.items():
AttributeError: 'NoneType' object has no attribute 'items'

Update HA to 2022.4.0 - Problem?

Hi Briis! Thanks for your valuable work and support!
I have update HA to 2022.4.0 but I have lost sensors and switches of each camera .. What could have happened?
Thank you
Schermata 2022-04-07 alle 08 16 32

Security spy motion alerts in Home assistant stoped working

I have Security Spy running on a mac mini and it works well.
I have home assistant running on another computer on the same network and mostly the integration works fine.

However, after a few days, motion alerts stop working. I have a few node-red flows that rely on the motion alerts to show the latest image triggering an alert.

I have also had a few instances where the SecuritySpy integration lost connection.

Any ideas on how to troubleshoot this?

Best wishes,
Kasper

error when setting recording mode

Hi, just installed integration, but when i try to setup any camera in recording mode I've got always error calling service switch turn on or off.
Will be posible to have motion sensor?

Human and Vehicle not reported in Node-Red

SecuritySpy running on MacBook Pro. Home Assistant running on RPi.
Been running SS for many years. New (few months) to Home Assistant. Very happy to find your integration !

All has been running smoothly from the start.
I have recently implemented a Node-Red flow that depends on the camera identifying Human or Vehicle. SS correctly sends my phone a notification of Human/Vehicle, but HA Node-Red for the same event always returns:
msg.data.new_state.attributes.event_object == "None"

I am triggering on and binary_sensor.parking_motion (camera named "parking") and using the returned msg for the value.

I see in your release notes the example YAML of human or vehicle, but am preferring to create the automation in Node-Red instead of YAML.
I am sure I probably missed something, but have been debugging this for a while and just wanted to check.

Threshold setting for Human / Vehicle classification to reduce false positives?

First, thank you for making and maintaining this plugin – it is immensely helpful in my home automation journey!

I've got Home Assistant configured to send me a notification when a Human is detected in one of my cameras. It works when a person is there, but I'm getting a lot of false positives: it says a person is there, but there isn't. Also, SecuritySpy doesn't capture a video clip for these false positive events so SecuritySpy seems to know it's not really a person, but Home Assistant thinks it is.

I wasn't sure where the problem was coming from so I asked about this on the SecuritySpy forum, and Ben explained that the event stream sends a CLASSIFY event, with the percentage probability of both a human and vehicle is included, e.g. "CLASSIFY HUMAN 80 VEHICLE 0".

Based on that, my best guess is that the SecuritySpy for Home Assistant plugin is reporting a human when the HUMAN probability is any value over 0 – or perhaps some other value that I don't know and don't know how to adjust?

@briis could you provide any insight into how the SecuritySpy for Home Assistant plugin is handling the data from the SecuritySpy event stream? Is it registering a Human event_object for any value of HUMAN in the CLASSIFY event? If so, is there some way to set a threshold to reduce the number of false positives? For example, in SecuritySpy I have it set to only record if the probability of Human is 50 or higher (the recommended setting).

If it's possible to include the percentage probability number from SecuritySpy as an attribute in the motion binary_sensor we could potentially trigger different automations in Home Assistant based on the probability of human? e.g. if >30 turn on a light… if >60 and in the middle of the night, start flashing lights and making noise, etc. But I think just being able to set a single threshold in the settings would hugely help to decrease my false positives here.

Motion status setting needs rework

SecuritySpy can have both continuous, on motion and action enabled at the same time, and that is not how I have designed it. This can cause the Integration to not display the right setting if settings for these are done from the SecuritySpy Interface.

Running HA and SS on the same mac

Hello

I'm running ss and ha via vm on the same mac. Now I can not access the camera feed (no live video). Has someone experience with this?

Best regards, Stefan

Live image feed

Hi, I have this installed added my cameras but only the badge shows an image, I don't get a live image in a picture element - what am I doing wrong?

Too many state attribute changes

Is there a way to consolidate the many state attribute changes to ones that can more readily be used in automations? I didn't get the expected results from my automations so I took a look at the HA database (MariaDB in my case). The attached table shows 4 events with a confusing list of attribute changes, in particular for event_object.

Picture1

SQL statement used:
SELECT
a.entity_id,
a.last_updated,
a.state,
json_extract(b.shared_attrs, '$.last_tripped_time') AS last_tripped_time,
json_extract(b.shared_attrs, '$.event_length') AS event_length,
json_extract(b.shared_attrs, '$.event_object') AS event_object,
json_extract(b.shared_attrs, '$.event_score_human') AS event_score_human,
json_extract(b.shared_attrs, '$.event_score_vehicle') AS event_score_vehicle
FROM states a INNER JOIN state_attributes b ON a.attributes_id = b.attributes_id
WHERE a.entity_id = 'binary_sensor.courtyard_motion'
ORDER BY a.state_id

SecuritySpy for Home Assistant v1.1.4
Home Assistant Core 2022.5.5
Home Assistant Supervisor 2022.05.3
Home Assistant OS 8.1

error loading config

hi, i just delete integration and hacs, reinstall everything but after setting up integration i've got the following error

Error
Config flow could not be loaded

also i have no entities just blank

Cannot unload Integration. Throws error

When the Integration unloads (Stopping Home Assistant or Reloading the Integration) the below error is thrown:

021-03-26 13:17:52 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry SecuritySpy for securityspy
Traceback (most recent call last):
  File "/usr/local/python/lib/python3.9/site-packages/homeassistant/config_entries.py", line 341, in async_unload
    result = await component.async_unload_entry(hass, self)  # type: ignore
  File "/config/custom_components/securityspy/__init__.py", line 125, in async_unload_entry
    await entry_data["secspy_data"].async_stop()
  File "/config/custom_components/securityspy/data.py", line 42, in async_stop
    await self._secspyserver.async_disconnect_ws()
  File "/usr/local/python/lib/python3.9/site-packages/pysecspy/secspy_server.py", line 128, in async_disconnect_ws
    await self.ws_connection.close()
TypeError: object NoneType can't be used in 'await' expression
``

Error Message

Hello I get this error message when I switch on or of motion:

Fehler beim Aufrufen des Diensts switch/turn_on. Recording mode could not be set for Camera x

Thanks for your help.

Stefan

Object detection keep reporting vehicle

Hi

Great Integration.

I have an issue with the object detection sensor it keep remembering the object so it some times trigger the automation
again but there is no vehicle and security spy do not report any either.
and the snapshot is with no object.

is there any way to reduce this ?
i have set a timer now for 1 sec on the trigger automation.

image

Changing schedules problem

Hi @briis , when changing schedules is working in SS but not reflecting in HA, now for example i have all sensors for motion recording and action of cameras off and in SS are on, is like there are not updating.
if i call again some schedule then is updating, happens overnight when i put alarm mode on wich will call the schedule for activate cameras on motion and action.

Can be cause i set up the option of close and reopen SS everyday at midnight? maybe it causes lost of conection and not update anymore

Update not work for me..

Hi, I have try update the to version 1.0.0 but my camera not work, i have try to update SecuritySpy to version 5.3.2 but is the same. HA asks me for the data: IP, port, authentication. I put them in but it doesn't seem to work.
Thanks

Schermata 2021-04-08 alle 10 10 48

Repeated notifications

I have a simple automation set up to test out this integration.

`platform: state
entity_id:

  • sensor.incoming_driveway_detected_object
    to: Vehicle
    from: null
    for:
    hours: 0
    minutes: 0
    seconds: 1`

The Home Assistant log shows frequent Vehicle "detections" that are not recorded in Security Spy as an object detection and the footage does not show any vehicle. This triggers the automation way more often than it should.

switch entity error

Logger: homeassistant.components.switch
Source: custom_components/securityspy/data.py:59
Integration: Switch (documentation, issues)
First occurred: 12:44:46 PM (32 occurrences)
Last logged: 1:34:47 PM

securityspy: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
await task
File "/config/custom_components/securityspy/entity.py", line 57, in async_update
await self.secspy_data.async_refresh()
File "/config/custom_components/securityspy/data.py", line 47, in async_refresh
self._async_process_updates(
File "/config/custom_components/securityspy/data.py", line 59, in _async_process_updates
for device_id, data in updates.items():
AttributeError: 'NoneType' object has no attribute 'items'

One-way communications only?

Hello Bjarne, long term SSpy user but fairly new to HA (coming from OpenHab). Running SSpy with 4 cameras on Macmini and HA is on the new HA Blue unit. Everything is on same LAN. Running ver 1.1.1 of your SSpy integration.
SSpy doesn't seem to talk to HA in all cases but HA can instruct SSpy.
Example-1: Cameras offline are NOT picked up by HA entity 'binary-sensor.cam-online'. I tested all 4 cameras, deliberately taking them offline by disconnecting the ethernet cables. They DO show as offline in SSpy but HA still believes they are all perfectly online! I waited for ages.
Example-2: Setting Continuous capture mode to ON from within the SSpy web interface itself is NOT picked up by HA entity 'switch.cam-record-continuous' nor by the HA 'sensor.cam-continuous recording'. However, if continuous recording is initiated FROM HA with the 'switch' entity, SSPy does respond and start recording. So it seems one-way. HA can talk to/instruct SSpy but things initiating from SSpy are not seen by the entities in HA integration.
Am I missing something obvious? I CAN see the video streams from SSpy in HA ok using Picture Glance cards. I was testing the sensor/switch entities with glance card. Any advice very welcome. Great job btw on producing this integration. Thanks, Denis

Feature Request: Camera Online Sensor

It would be nice to have a boolean sensor to show if a camera is online/offline. I have a couple of cheap wifi cameras for random things around the house that annoyingly go offline every so often, and which can be fixed by power cycling a smart switch. It would be nice to be able to use a boolean sensor to trigger that to happen automatically if they're offline for a few minutes.

Motion Sensor not Work

Home Assistant 2022.3.3
SecuritySpy for Home Assistant 1.1.1

Hi briss, I configured SS on my Macmini where I also run HA with VMware in virtual machine. Everything seems to work correctly, I see my cameras on HA and sensors. The only thing I can't get to work is the motion sensors. I have read the issues and I have configured correctly SS, arming the cam that I want to signal me the movement. I have also activated the debug but it does not report any errors .. What can I check??
Thanks!!

Schermata 2022-03-08 alle 13 58 35

Schermata 2022-03-08 alle 13 58 44

Schermata 2022-03-08 alle 14 03 25

Schermata 2022-03-08 alle 13 59 10

Motion stuck on "detected"

Hi,

When my camera (Hikvision DS-2TD1228T-2/QA) triggers an intrusion rule, then Security Spy is triggered via the "Notify Surveillance Center" rule. This works fine, Security Spy sends me a push notification when this happens.

The SecuritySpy integration for Home Assistant gets triggers and the camera motion detection shows "detected" state. The problem is that this state never changes, it keeps in "detected" state.

I tried to manually set the state to "off" / "clear", but after a few seconds the state changes to "detected". To make sure SecuritySpy didn't send that state, I closed SecuritySpy and again it changes back to "detected" even though SecuritySpy is offline.

Could you please help me out here? I'm using this camera for my security system.

async_setup_platforms issue

Hello

I got the following error message in my log:

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 11:15:40 (1 occurrences)
Last logged: 11:15:40

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for securityspy using this method at custom_components/securityspy/init.py, line 107: hass.config_entries.async_setup_platforms(entry, SECURITYSPY_PLATFORMS)

HA 2023.2.0 / Supervisor 2023.01.1 / OS 9.5 / SS HACS 1.1.6

Best regards, Stefan

question for setting up Capture Image and Download Video Recording

Hi,
I have the SecuritySpy integration set up and controls, video feed, and motion notifications (using the blueprint) are working excellent - thanks for this.

I'm trying to set up Capture Image and/or Download Video Recording but I can't figure out how to do this.

How do I set up these two great features?
Thanks for any pointers.

Best wishes, Kasper

Integration failing when adding

When i try to add the integration i get a message "Error retrieving data from SecuritySpy."

I have confirmed that i can ping the HA machine from the MAC and i can Ping the MAC from the HA machine.

Not sure how to track down why the integration will not complete

Motion state

Using Motion detection as a button to show when detection is triggered.
Motion Detection shows triggered, yet does not reset to clear state.

Live stream does not have audio

The stream that is delivered from the IO module does contain audio, as it works when streaming through VLC, but in HA it does not have any audio.

error handling request

i show this error showing many times
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 129, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 496, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 513, in handle
image = await camera.async_camera_image()
File "/config/custom_components/securityspy/camera.py", line 166, in async_camera_image
last_image = await self.secspy.get_snapshot_image(self._device_id)
File "/usr/local/lib/python3.8/site-packages/pysecspy/secspy_server.py", line 202, in get_snapshot_image
response = await self.req.get(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 544, in _request
await resp.start(conn)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 890, in start
message, payload = await self._protocol.read() # type: ignore
File "/usr/local/lib/python3.8/site-packages/aiohttp/streams.py", line 604, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

Integration is using deprecated `DEVICE_CLASS_*` constants

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

SecuritySpy 5.5.0 added Animals to Human and Vehicle detection

Thanks so much for providing this to glue together my favorite 2 Home Automation programs.
The latest version of SS has now included Animals along with Humans and Vehicles. It appears that a score is provided for Animals similar to H & Vs. It would be terrific if the sensor.camera_detected_object were updated to report the Animal in state and also provide the event_score_animal from zero to 100.

Feature Request: Enable/Disable Camera

Great integration, thank you Bjarne!

At the moment I have an automation in HA that disables an internal camera when presence detects we are home, and then enables it when we're out. I currently do this via the following API call:

Disable:
/usr/bin/curl -d 'cameraNum=6&camEnabledCheck=0&action=save' 'http://192.168.199.105:8000/camerasettings?auth=xxxxx'"
Enable:
/usr/bin/curl -d 'cameraNum=6&camEnabledCheck=1&action=save' 'http://192.168.199.105:8000/camerasettings?auth=xxxxx'"

Would it be possible to add a switch to do this natively with your HA integration please?

Thanks.

Great Code

Hello

Thanks very much for that great code. This is exactly what I was looking for. I have one recommendation: Would it be possible to also add the "alarm" state. This would be even more perfect.

Thanks for your great work!
Stefan

Old cameras not removed from devices

I have recently replaced some cameras in SecuritySpy with new alternatives. I have removed the old cameras from SS and restarted the SS server.

I have pressed 'reload' on the integration in HomeAssistant. It has successfully picked up the new cameras and I've got all my HA automations etc moved over to the new devices.

However, the old devices still show in HA. Clearly 'reloading' the integration polls for new devices but doesn't check the presence of old ones.

In the short term please can you advise if there is a manual method for removing the old devices, and longer term it would be great if a 'reload' polled the existing devices as well.

Many thanks.

No motion triggers after Security Spy restarts

If Security Spy restarts after Home Assistant is up and running, the integration does not send any motion detections on to Home Assistant.
Motion detection automations work again after restarting Home Assistant; i.e. HA needs to be started after SS else no motion alerts in HA. (Reloading integration might also work.)

Integration v1.1.8
SS v5.5.9

Can not discover new devices

i have installed and used the guide from you.

but no devices appear automatic have tried restart server many times

Intergration no longer starting

This is first part of the error message I am gettting

File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
raise exceptions[0]

Update Home Assistant 2021.9.1

Hi I ha ve update Home Assistant to 2021.9.1 but the log say:

2021-09-03 14:39:54 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 590, in get return await self.handle(request, camera) File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 608, in handle image = await _async_get_image( File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image image_bytes = await camera.async_camera_image() File "/config/custom_components/securityspy/camera.py", line 179, in async_camera_image last_image = await self.secspy.get_snapshot_image(self._device_id) File "/usr/local/lib/python3.9/site-packages/pysecspy/secspy_server.py", line 212, in get_snapshot_image raise RequestError( pysecspy.errors.RequestError: Fetching Snapshot Image failed: 404 - Reason: Not Found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.