Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aneisch committed Oct 5, 2023
1 parent d7ea8e8 commit b4d96fb
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 87 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Build Status](https://github.com/aneisch/home-assistant-config/actions/workflows/check-ha-release-compatibility.yml/badge.svg)](https://github.com/aneisch/home-assistant-config/actions)
[![GitHub last commit](https://img.shields.io/github/last-commit/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/commits/master)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/aneisch/home-assistant-config)](https://github.com/aneisch/home-assistant-config/graphs/commit-activity)
[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant%20-2023.10.0b4%20(Out%20of%20Date)-Red)](https://github.com/home-assistant/home-assistant/releases/latest)
[![HA Version](https://img.shields.io/badge/Running%20Home%20Assistant-2023.10.0%20(Latest)-brightgreen)](https://github.com/home-assistant/home-assistant/releases/latest)
<br><a href="https://www.buymeacoffee.com/aneisch" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-black.png" width="150px" height="35px" alt="Buy Me A Coffee" style="height: 35px !important;width: 150px !important;" ></a>


Expand Down Expand Up @@ -56,7 +56,7 @@ Also using Grafana/Influx for graphing, both running in Docker containers on NUC
Description | value
-- | --
Lines of ESPHome YAML | 2467
Lines of Home Assistant YAML | 8105
Lines of Home Assistant YAML | 8121
[Integrations](https://www.home-assistant.io/integrations/) in use | 52
Zigbee devices in [`zha`](https://www.home-assistant.io/integrations/zha/) | 26
Z-Wave devices in [`zwave_js`](https://www.home-assistant.io/integrations/zwave_js/) | 37
Expand Down
12 changes: 12 additions & 0 deletions automations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,21 @@
event_type: folder_watcher
event_data:
event_type: modified
file: 'database.sqlite'
action:
- service: shell_command.sync_cloudflare_records

- alias: "Commit Frigate Config"
id: "commit_frigate_config"
trigger:
platform: event
event_type: folder_watcher
event_data:
event_type: modified
file: 'config.yml'
action:
- service: shell_command.commit_frigate_changes

- alias: "Compost Turn Reset"
id: "compost_turn_reset"
trigger:
Expand Down
10 changes: 7 additions & 3 deletions configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ homeassistant:
allowlist_external_dirs:
- "/tmp"
- "/config"
- "/frigate_config"
allowlist_external_urls:
- "http://localhost:8123/api/frigate/notifications"
media_dirs:
Expand Down Expand Up @@ -65,12 +66,15 @@ config:

energy:

# Watch for nginx proxy manager changes
folder_watcher:
- folder: /tmp
use_polling: True
- folder: '/tmp'
#use_polling: True
patterns:
- "database.sqlite"
- folder: '/frigate_config'
#use_polling: True
patterns:
- "config.yml"

monitor_docker:
#scan_interval: 60
Expand Down
14 changes: 14 additions & 0 deletions custom_components/dahua/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# This service handles setting the video profile mode to day or night
SERVICE_SET_VIDEO_PROFILE_MODE = "set_video_profile_mode"
SERVICE_SET_FOCUS_ZOOM = "set_focus_zoom"
SERVICE_SET_PRIVACY_MASKING = "set_privacy_masking"
SERVICE_SET_CHANNEL_TITLE = "set_channel_title"
SERVICE_SET_TEXT_OVERLAY = "set_text_overlay"
SERVICE_SET_CUSTOM_OVERLAY = "set_custom_overlay"
Expand Down Expand Up @@ -83,6 +84,15 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entitie
"async_adjustfocus"
)

platform.async_register_entity_service(
SERVICE_SET_PRIVACY_MASKING,
{
vol.Required("index", default=0): int,
vol.Required("enabled", default=False): bool,
},
"async_set_privacy_masking"
)

platform.async_register_entity_service(
SERVICE_ENABLE_CHANNEL_TITLE,
{
Expand Down Expand Up @@ -315,6 +325,10 @@ async def async_adjustfocus(self, focus: str, zoom: str):
""" Handles the service call from SERVICE_SET_INFRARED_MODE to set zoom and focus """
await self._coordinator.client.async_adjustfocus_v1(focus, zoom)
await self._coordinator.async_refresh()

async def async_set_privacy_masking(self, index: int, enabled: bool):
""" Handles the service call from SERVICE_SET_PRIVACY_MASKING to control the privacy masking """
await self._coordinator.client.async_setprivacymask(index, enabled)

async def async_set_enable_channel_title(self, enabled: bool):
""" Handles the service call from SERVICE_ENABLE_CHANNEL_TITLE """
Expand Down
11 changes: 11 additions & 0 deletions custom_components/dahua/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ async def async_adjustfocus_v1(self, focus: str, zoom: str):

url = "/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus={0}&zoom={1}".format(focus, zoom)
return await self.get(url, True)

async def async_setprivacymask(self, index: int, enabled: bool):
"""
async_setprivacymask will enable or disable the privacy mask
"""


url = "/cgi-bin/configManager.cgi?action=setConfig&PrivacyMasking[0][{0}].Enable={1}".format(
index, str(enabled).lower()
)
return await self.get(url, True)

async def async_set_night_switch_mode(self, channel: int, mode: str):
"""
Expand Down
27 changes: 27 additions & 0 deletions custom_components/dahua/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,30 @@ set_focus_zoom:
selector:
text:

set_privacy_masking:
name: Set the Dahua Privacy Masking
description: Enables or disabled the cameras privacy masking
target:
entity:
integration: dahua
domain: camera
fields:
index:
name: Index
description: "The mask index. 0 is the first mask"
example: 0
required: true
default: 0
selector:
number:
mode: box
min: 0
max: 100
enabled:
name: Enabled
description: "If true enables the mask, otherwise disables it"
example: true
required: true
default: true
selector:
boolean:
2 changes: 1 addition & 1 deletion extras/Node-RED/flows.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions extras/appdaemon/apps/apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ TV Automation Smallgroup:
Pumkin Patch Smallgroup:
module: entity_timer
constrain_days: wed
constrain_presence: anyone
class: Timer
time_off: "18:00:00"
time_on: "22:00:00"
Expand Down
23 changes: 12 additions & 11 deletions extras/docker-compose/homeassistant/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
version: '3.2'

volumes:
# https://rclone.org/docker/
frigate-drive:
driver: rclone:latest
driver_opts:
remote: 'frigate-drive:Frigate Offsite'
allow_other: 'true'
vfs_cache_mode: full
poll_interval: 0
#volumes:
# # https://rclone.org/docker/
# frigate-drive:
# driver: rclone
# driver_opts:
# remote: 'frigate-drive:Frigate Offsite'
# allow_other: 'true'
# vfs_cache_mode: full
# poll_interval: 0

services:
homeassistant:
container_name: hass
image: ghcr.io/home-assistant/home-assistant:beta
image: ghcr.io/home-assistant/home-assistant:stable
labels:
com.centurylinklabs.watchtower.monitor-only: "true"
volumes:
Expand All @@ -24,7 +24,8 @@ services:
- /tmp/radar.gif:/tmp/radar.gif
- /sys/class/hwmon/hwmon1/temp1_input:/sys/class/thermal/thermal_zone0/temp:ro
- /etc/localtime:/etc/localtime:ro
- frigate-drive:/frigate
- /frigate-drive:/frigate
- /opt/frigate:/frigate_config:ro
devices:
- /dev/zigbee
- /dev/usb_modem_sim7080g:/dev/cellular_modem
Expand Down
1 change: 1 addition & 0 deletions extras/docker-compose/other/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ services:
- '/opt/appdaemon/:/config/appdaemon'
- '/opt/docker-compose/:/config/docker-compose'
- '/opt/github:/config/github_projects'
- '/opt/frigate:/config/frigate'
- '/home/aneisch/.backup:/config/homeassistant-git'
environment:
- TZ=America/Chicago
Expand Down
24 changes: 13 additions & 11 deletions extras/docker-compose/unified/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Concat 'homeassistant' and 'other' docker-compose files
version: '3.2'

volumes:
# https://rclone.org/docker/
frigate-drive:
driver: rclone:latest
driver_opts:
remote: 'frigate-drive:Frigate Offsite'
allow_other: 'true'
vfs_cache_mode: full
poll_interval: 0
#volumes:
# # https://rclone.org/docker/
# frigate-drive:
# driver: rclone
# driver_opts:
# remote: 'frigate-drive:Frigate Offsite'
# allow_other: 'true'
# vfs_cache_mode: full
# poll_interval: 0

services:
homeassistant:
container_name: hass
image: ghcr.io/home-assistant/home-assistant:beta
image: ghcr.io/home-assistant/home-assistant:stable
labels:
com.centurylinklabs.watchtower.monitor-only: "true"
volumes:
Expand All @@ -25,7 +25,8 @@ services:
- /tmp/radar.gif:/tmp/radar.gif
- /sys/class/hwmon/hwmon1/temp1_input:/sys/class/thermal/thermal_zone0/temp:ro
- /etc/localtime:/etc/localtime:ro
- frigate-drive:/frigate
- /frigate-drive:/frigate
- /opt/frigate:/frigate_config:ro
devices:
- /dev/zigbee
- /dev/usb_modem_sim7080g:/dev/cellular_modem
Expand Down Expand Up @@ -307,6 +308,7 @@ services:
- '/opt/appdaemon/:/config/appdaemon'
- '/opt/docker-compose/:/config/docker-compose'
- '/opt/github:/config/github_projects'
- '/opt/frigate:/config/frigate'
- '/home/aneisch/.backup:/config/homeassistant-git'
environment:
- TZ=America/Chicago
Expand Down
Binary file modified images/nodered_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/nodered_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/frigate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ automation:
data:
attachments:
- /config/images/logo.jpg
- delay: "00:00:30"

- alias: Doorbell Ring
id: "frigate_doorbell_ring"
Expand Down
2 changes: 1 addition & 1 deletion packages/hass_update_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ script:
hass_update_notify:
# Notify and enable update button on frontend
sequence:
- service: shell_command.pull_hass
#- service: shell_command.pull_hass
- service: notify.signal_self
data:
message: >
Expand Down
3 changes: 2 additions & 1 deletion packages/leak_detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ automation:
and is_state('switch.maples_zone', 'off')
and is_state('group.trackers', 'not_home' )
and is_state('input_boolean.guest_mode', 'off')
and not (now().hour == 12 and now.minute in [0,1,2,3,4,5]) }}"
and not (now().hour == 12 and now.minute in [0,1,2,3,4,5])
and not (now().hour == 10 and now.minute in [16,17,18,19,20,21]) }}"
then:
- service: script.notify_wrapper
data:
Expand Down
7 changes: 7 additions & 0 deletions scripts/commit_frigate_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd /opt/frigate

git add config.yml
git commit -m 'Autocommit by Home Assistant on change'
git push
2 changes: 1 addition & 1 deletion scripts/frigate_clips_drive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
clip_id=$1

cd /frigate
wget -O /frigate/`date +%m_%d_%Y_%H_%M_%S_1690389398.964135-kk1s6p.mp4` http://localhost:5000/api/events/$clip_id/clip.mp4
wget -O /frigate/`date +%m_%d_%Y_%H_%M_%S.mp4` http://localhost:5000/api/events/$clip_id/clip.mp4

# Remove all but latest 90 clips
#rm `ls -tr /frigate | awk 'NR>90'` &> /dev/null
Expand Down
55 changes: 0 additions & 55 deletions scripts/gsm_send.sh

This file was deleted.

2 changes: 2 additions & 0 deletions shell_command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ turn_off_mirroring: ssh weasel '/usr/bin/automator /Users/aneisch/Library/Servic
weasel_shortcut: ssh weasel 'shortcuts run "{{ shortcut }}"'

sync_cloudflare_records: ssh nuc '/opt/homeassistant/scripts/nginx_proxy_manager_sync.py'

commit_frigate_changes: ssh nuc '/opt/homeassistant/scripts/commit_frigate_changes.sh'

0 comments on commit b4d96fb

Please sign in to comment.