-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added field detection detection target and region id in bus event data (
#193) * detection_target and region id passed to hikvision_next_event on event bus * saving image file from event notification * take multiple snapshots blueprint
- Loading branch information
Showing
6 changed files
with
223 additions
and
5 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
blueprints/automation/hikvision_next/take_pictures_on_motion_detection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
blueprint: | ||
name: Take Multiple Snapshots On Detection Event | ||
description: | | ||
Takes pictures from multiple cameras when motion is detected on sensors. | ||
Pictures are saved into /media/hikvision_next/snapshots folder | ||
domain: automation | ||
input: | ||
motion_entities: | ||
name: Sensor | ||
description: An event sensor | ||
selector: | ||
entity: | ||
multiple: true | ||
domain: binary_sensor | ||
device_class: | ||
- motion | ||
integration: hikvision_next | ||
camera_entities: | ||
name: Camera | ||
description: A camera that takes a photo | ||
selector: | ||
entity: | ||
multiple: true | ||
domain: camera | ||
integration: hikvision_next | ||
mode: single | ||
variables: | ||
camera_entities: !input camera_entities | ||
month: "{{now().strftime('%Y-%m')}}" | ||
day: "{{now().strftime('%d')}}" | ||
timestamp: "{{ now().strftime('%Y-%m-%d__%H-%M-%S') }}" | ||
trigger: | ||
- platform: state | ||
entity_id: !input motion_entities | ||
to: "on" | ||
condition: [] | ||
action: | ||
- repeat: | ||
count: "{{ camera_entities | count }}" | ||
sequence: | ||
- variables: | ||
camera_entity: "{{ camera_entities[repeat.index - 1] }}" | ||
camera_name: "{{ states[camera_entity].name }}" | ||
- service: camera.snapshot | ||
data: | ||
filename: /media/hikvision_next/snapshots/{{month}}/{{day}}/{{timestamp}}__{{camera_name}}.jpg | ||
target: | ||
entity_id: "{{ camera_entity }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
tests/fixtures/ISAPI/EventNotificationAlert/fielddetection_human.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<EventNotificationAlert version="2.0" | ||
xmlns="http://www.hikvision.com/ver20/XMLSchema"> | ||
<ipAddress>1.0.0.255</ipAddress> | ||
<ipv6Address>::ffff:192.168.2.5</ipv6Address> | ||
<portNo>80</portNo> | ||
<protocol>HTTP</protocol> | ||
<macAddress>ac:b9:2f:49:44:75</macAddress> | ||
<channelID>1</channelID> | ||
<dateTime>2022-01-31T13:53:05+01:00</dateTime> | ||
<activePostCount>1</activePostCount> | ||
<eventType>fielddetection</eventType> | ||
<eventState>active</eventState> | ||
<eventDescription>fielddetection alarm</eventDescription> | ||
<DetectionRegionList> | ||
<DetectionRegionEntry> | ||
<regionID>3</regionID> | ||
<sensitivityLevel>50</sensitivityLevel> | ||
<RegionCoordinatesList> | ||
<RegionCoordinates> | ||
<positionX>572</positionX> | ||
<positionY>100</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>572</positionX> | ||
<positionY>995</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>999</positionX> | ||
<positionY>998</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>992</positionX> | ||
<positionY>210</positionY> | ||
</RegionCoordinates> | ||
</RegionCoordinatesList> | ||
<detectionTarget>human</detectionTarget> | ||
<TargetRect> | ||
<X>0.6</X> | ||
<Y>0.215278</Y> | ||
<width>0.135937</width> | ||
<height>0.505556</height> | ||
</TargetRect> | ||
</DetectionRegionEntry> | ||
</DetectionRegionList> | ||
<channelName>COUR NORD</channelName> | ||
<detectionPictureTransType>binary</detectionPictureTransType> | ||
<detectionPicturesNumber>1</detectionPicturesNumber> | ||
<isDataRetransmission>false</isDataRetransmission> | ||
</EventNotificationAlert> |
49 changes: 49 additions & 0 deletions
49
tests/fixtures/ISAPI/EventNotificationAlert/fielddetection_vehicle.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<EventNotificationAlert version="2.0" | ||
xmlns="http://www.hikvision.com/ver20/XMLSchema"> | ||
<ipAddress>1.0.0.255</ipAddress> | ||
<ipv6Address>::ffff:192.168.2.5</ipv6Address> | ||
<portNo>80</portNo> | ||
<protocol>HTTP</protocol> | ||
<macAddress>ac:b9:2f:49:44:75</macAddress> | ||
<channelID>1</channelID> | ||
<dateTime>2022-01-19T07:51:17+01:00</dateTime> | ||
<activePostCount>1</activePostCount> | ||
<eventType>fielddetection</eventType> | ||
<eventState>active</eventState> | ||
<eventDescription>fielddetection alarm</eventDescription> | ||
<DetectionRegionList> | ||
<DetectionRegionEntry> | ||
<regionID>2</regionID> | ||
<sensitivityLevel>50</sensitivityLevel> | ||
<RegionCoordinatesList> | ||
<RegionCoordinates> | ||
<positionX>118</positionX> | ||
<positionY>327</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>999</positionX> | ||
<positionY>326</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>999</positionX> | ||
<positionY>626</positionY> | ||
</RegionCoordinates> | ||
<RegionCoordinates> | ||
<positionX>0</positionX> | ||
<positionY>630</positionY> | ||
</RegionCoordinates> | ||
</RegionCoordinatesList> | ||
<detectionTarget>vehicle</detectionTarget> | ||
<TargetRect> | ||
<X>0.779688</X> | ||
<Y>0.409722</Y> | ||
<width>0.209375</width> | ||
<height>0.459722</height> | ||
</TargetRect> | ||
</DetectionRegionEntry> | ||
</DetectionRegionList> | ||
<channelName>COUR NORD</channelName> | ||
<detectionPictureTransType>binary</detectionPictureTransType> | ||
<detectionPicturesNumber>1</detectionPicturesNumber> | ||
<isDataRetransmission>false</isDataRetransmission> | ||
</EventNotificationAlert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters