Skip to content

Commit

Permalink
add amcrest, remove dahua
Browse files Browse the repository at this point in the history
- Add Amcrest integration
- Remove Dahua custom integration
- Update automations and UI
  • Loading branch information
zanix committed Mar 23, 2024
1 parent 222339b commit 62f43cd
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 92 deletions.
4 changes: 4 additions & 0 deletions .stubs/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
# Example Secrets
#
amcrest_host: 10.10.10.10
amcrest_username: username
amcrest_password: password

dreamscreen_family_room: 10.10.10.10

canon_host: 10.10.10.10
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ If you want to back up your own Home Assistant configuration to GitHub, follow [

| Description | Value |
| -------------- | -- |
| All Entities | 2625 |
| All Entities | 2619 |
| Sensors | 1158 |
| Binary Sensors | 209 |
| Lights | 60 |
| Switches | 130 |
| Binary Sensors | 210 |
| Lights | 58 |
| Switches | 128 |

<details><summary>Stock Integrations</summary>

Expand All @@ -49,6 +49,10 @@ The AdGuard integration allows you to control and monitor your AdGuard Home inst

The airnow integration uses the AirNow web service as a source for air quality data for your location

### [Amcrest](https://www.home-assistant.io/integrations/amcrest)

The amcrest camera platform allows you to integrate your Amcrest or Dahua IP camera or doorbell in Home Assistant.

### [Android Debug Bridge](https://www.home-assistant.io/integrations/androidtv)

The Android Debug Bridge integration allows you to control an Android device or Amazon Fire TV device
Expand Down Expand Up @@ -261,7 +265,7 @@ The Z-Wave integration allows you to control a Z-Wave network via the [Z-Wave JS

</details>

<details><summary>18 Custom Integrations</summary>
<details><summary>17 Custom Integrations</summary>

### [Adaptive Lighting](https://github.com/basnijholt/adaptive-lighting) [v1.20.0]

Expand All @@ -273,12 +277,6 @@ Authors: [@basnijholt](https://github.com/basnijholt), [@RubenKelevra](https://g

🔹 A Home Assistant integration to turn your browser into a controllable entity and media player

### [Dahua](https://github.com/rroller/dahua) [v0.9.51]

Dahua Camera and Doorbell Home Assistant Integration

Authors: [@rroller](https://github.com/rroller).

### [Dreamscreen Service](https://github.com/J3n50m4t/Home-Assistant-DreamScreen-Service)

Home Assistant Service for sending commands to a Wifi enabled DreamScreen
Expand Down Expand Up @@ -593,7 +591,7 @@ Minimalistic uptime card for Home Assistant Lovelace UI

> For more details, see the [automations.xml][automations] file and `automation:` blocks in [integrations].
<details><summary>155 Automations</summary>
<details><summary>154 Automations</summary>

- ⏯ Ensure PiPup is Running
- ⏯ Family Room Media Auto Off
Expand Down Expand Up @@ -731,7 +729,6 @@ Minimalistic uptime card for Home Assistant Lovelace UI
- 🔒 Front Door Re-lock after Unlock
- 🔔 Doorbell Object or Ring
- 🔔 Doorbell Ring
- 🔔 Doorbell Unavailable
- 🔔 Frigate Doorbell - Event Handler
- 🔔 Frigate Doorbell - Object Seen
- 🖥️ [Ardena] Power Actions
Expand Down
73 changes: 3 additions & 70 deletions automations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_alarm_local
- binary_sensor.doorbell_ring
to: 'on'
condition: []
action:
Expand Down Expand Up @@ -1624,7 +1624,7 @@
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_alarm_local
- binary_sensor.doorbell_ring
to: 'on'
- platform: event
event_type: custom_frigate_doorbell_object
Expand Down Expand Up @@ -3915,73 +3915,6 @@
holiday_entity: calendar.recycle_holiday
year: '{{ now().year + 1 }}'
mode: single
- id: '1686541200011'
alias: "\U0001F514 Doorbell Unavailable"
description: Notifies when the Doorbell becomes unavailable
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_alarm_local
- binary_sensor.doorbell_motion_alarm
to: unavailable
for:
minutes: 1
condition: []
action:
- service: homeassistant.reload_config_entry
data: {}
target:
device_id: 507344f5684d2af09535c985be65953e
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_alarm_local
from: unavailable
timeout:
minutes: 2
- if:
- condition: state
entity_id: binary_sensor.doorbell_alarm_local
state: unavailable
then:
- parallel:
- service: script.notify_mobile
data:
who: joshua
title: Doorbell
message: The service is unavilable and needs to be reloaded
notification_icon: mdi:doorbell-video
color: '#e91e63'
icon_url: local/icons/doorbell-video.png
url: config/integrations
group: Doorbell
- service: script.notify_hass_agent
data:
entity:
- media_player.erebus
title: Doorbell
message: The service is unavilable and needs to be reloaded
duration: 10
else:
- parallel:
- service: script.notify_mobile
data:
who: joshua
title: Doorbell
message: The service was unavilable and was reloaded
notification_icon: mdi:doorbell-video
color: '#e91e63'
icon_url: local/icons/doorbell-video.png
url: config/integrations
group: Doorbell
- service: script.notify_hass_agent
data:
entity:
- media_player.erebus
title: Doorbell
message: The service was unavilable and was reloaded
duration: 10
mode: single
- id: '1691002589029'
alias: ⚡ SolarAssistant Not Updating
description: Sends a notification when SolarAssistant is not updating.
Expand Down Expand Up @@ -4047,7 +3980,7 @@
fps: '{{ states(''sensor.'' + camera + ''_camera_fps'') | int(5) }}'
state_entities:
binary_sensor.front_door_contact_door_is_open: 2
binary_sensor.doorbell_alarm_local: 1
binary_sensor.doorbell_ring: 1
states_filter:
- 'off'
debug: false
Expand Down
4 changes: 2 additions & 2 deletions entities/template/sensor/change_history.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ trigger:
- cover.opengarage
- input_boolean.dryer_status
- input_boolean.washer_status
- binary_sensor.doorbell_alarm_local
- binary_sensor.doorbell_motion_alarm
- binary_sensor.doorbell_ring
- binary_sensor.doorbell_camera_motion
- sensor.doorbell_person_count
not_to:
- unavailable
Expand Down
105 changes: 105 additions & 0 deletions packages/amcrest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# The amcrest camera platform allows you to integrate your Amcrest or Dahua IP
# camera or doorbell
#
# https://www.home-assistant.io/integrations/amcrest
#
amcrest:
- host: !secret amcrest_host
username: !secret amcrest_username
password: !secret amcrest_password
name: Doorbell
resolution: low
stream_source: snapshot
binary_sensors:
- online

# Shell command to get/change settings.
shell_command:
doorbell_set_config: >-
curl \
-X GET \
-s --digest \
-u {{ username }}:{{ password }} \
'http://{{ ip_address }}/cgi-bin/configManager.cgi?action=setConfig&{{ setting }}={{ value }}'
doorbell_get_config: >-
curl \
-X GET \
-s --digest \
-u {{ username }}:{{ password }} \
'http://{{ ip_address }}/cgi-bin/configManager.cgi?action=getConfig&name={{ setting }}'
# Binary sensor that triggers on the start/stop AlarmLocal event
template:
- trigger:
- platform: event
event_type: amcrest
id: start
event_data:
camera: Doorbell
event: AlarmLocal
payload:
Code: AlarmLocal
action: Start
- platform: event
event_type: amcrest
id: stop
event_data:
camera: Doorbell
event: AlarmLocal
payload:
Code: AlarmLocal
action: Stop
binary_sensor:
- name: Doorbell Ring
icon: "{{ (trigger.platform == 'event') | iif('mdi:bell-ring', 'mdi:bell-outline') }}"
device_class: safety
state: >-
{{ iif(trigger.id == "start", "on", "off") }}
- trigger:
- platform: time_pattern
seconds: "/30"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- service: shell_command.doorbell_get_config
data:
ip_address: !secret amcrest_host
username: !secret amcrest_username
password: !secret amcrest_password
setting: ExternalDoorBell.Enable
response_variable: response
binary_sensor:
- name: Doorbell Chime
icon: '{{ iif(response["stdout"].split("=")[-1] == "true", "mdi:bell-ring", "mdi:bell-outline") }}'
device_class: connectivity
state: >-
{{ iif(response["stdout"].split("=")[-1] == "true", "on", "off") }}
# Switch to control the mechanical door chime
switch:
- platform: template
switches:
doorbell_chime:
friendly_name: Doorbell Chime
icon_template: '{{ is_state("binary_sensor.doorbell_chime", "on") | iif("mdi:bell-ring", "mdi:bell-outline") }}'
value_template: '{{ is_state("binary_sensor.doorbell_chime", "on") }}'
turn_on:
service: shell_command.doorbell_set_config
data:
ip_address: !secret amcrest_host
username: !secret amcrest_username
password: !secret amcrest_password
setting: ExternalDoorBell.Enable
value: 'true'
turn_off:
service: shell_command.doorbell_set_config
data:
ip_address: !secret amcrest_host
username: !secret amcrest_username
password: !secret amcrest_password
setting: ExternalDoorBell.Enable
value: 'false'
4 changes: 4 additions & 0 deletions templates/README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ The AdGuard integration allows you to control and monitor your AdGuard Home inst

The airnow integration uses the AirNow web service as a source for air quality data for your location

### [Amcrest](https://www.home-assistant.io/integrations/amcrest)

The amcrest camera platform allows you to integrate your Amcrest or Dahua IP camera or doorbell in Home Assistant.

### [Android Debug Bridge](https://www.home-assistant.io/integrations/androidtv)

The Android Debug Bridge integration allows you to control an Android device or Amazon Fire TV device
Expand Down
14 changes: 7 additions & 7 deletions ui-lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4638,12 +4638,12 @@ views:
variables:
- entity: light.outside_lights
- type: template
entity: binary_sensor.doorbell_person_occupancy
icon: "{%- if is_state(\"binary_sensor.doorbell_motion_alarm\"\
entity: binary_sensor.doorbell_all_occupancy
icon: "{%- if is_state(\"binary_sensor.doorbell_camera_motion\"\
, \"on\") -%}\n mdi:motion-sensor\n{%- elif is_state(entity,\
\ \"on\") -%}\n mdi:walk\n{%- else -%}\n mdi:motion-sensor-off\n\
{%- endif -%}"
icon_color: "{%- if is_state(\"binary_sensor.doorbell_motion_alarm\"\
icon_color: "{%- if is_state(\"binary_sensor.doorbell_camera_motion\"\
, \"on\") -%}\n orange\n{%- elif is_state(entity, \"on\") -%}\n\
\ light-green\n{%- else -%}\n disabled\n{%- endif -%}"
tap_action:
Expand Down Expand Up @@ -6318,11 +6318,11 @@ views:
- chips:
- type: template
entity: binary_sensor.doorbell_person_occupancy
icon: "{%- if is_state(\"binary_sensor.doorbell_motion_alarm\", \"\
icon: "{%- if is_state(\"binary_sensor.doorbell_camera_motion\", \"\
on\") -%}\n mdi:motion-sensor\n{%- elif is_state(entity, \"on\"\
) -%}\n mdi:walk\n{%- else -%}\n mdi:motion-sensor-off\n{%- endif\
\ -%}"
icon_color: "{%- if is_state(\"binary_sensor.doorbell_motion_alarm\"\
icon_color: "{%- if is_state(\"binary_sensor.doorbell_camera_motion\"\
, \"on\") -%}\n orange\n{%- elif is_state(entity, \"on\") -%}\n\
\ light-green\n{%- else -%}\n disabled\n{%- endif -%}"
tap_action:
Expand Down Expand Up @@ -9165,7 +9165,7 @@ views:
tap_action:
action: more-info
- type: state-icon
entity: binary_sensor.doorbell_motion_alarm
entity: binary_sensor.doorbell_camera_motion
icon: mdi:motion-sensor
state_color: true
style:
Expand All @@ -9177,7 +9177,7 @@ views:
- type: vertical-stack
cards:
- type: custom:mushroom-template-card
entity: binary_sensor.doorbell_alarm_local
entity: binary_sensor.doorbell_ring
primary: Last Ring
secondary: '{% from "util.jinja" import custom_timedelta %} {{
custom_timedelta(entity) }}'
Expand Down

0 comments on commit 62f43cd

Please sign in to comment.