Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aneisch committed Sep 27, 2023
1 parent ded04ef commit da890cc
Show file tree
Hide file tree
Showing 19 changed files with 217 additions and 85 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ 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 | 8008
Lines of Home Assistant YAML | 8051
[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

Description | value
-- | --
Entities in the [`alarm_control_panel`](https://www.home-assistant.io/components/alarm_control_panel) domain | 1
Entities in the [`automation`](https://www.home-assistant.io/components/automation) domain | 105
Entities in the [`automation`](https://www.home-assistant.io/components/automation) domain | 108
Entities in the [`binary_sensor`](https://www.home-assistant.io/components/binary_sensor) domain | 131
Entities in the [`button`](https://www.home-assistant.io/components/button) domain | 12
Entities in the [`calendar`](https://www.home-assistant.io/components/calendar) domain | 1
Expand All @@ -90,7 +90,7 @@ Entities in the [`remote`](https://www.home-assistant.io/components/remote) doma
Entities in the [`scene`](https://www.home-assistant.io/components/scene) domain | 2
Entities in the [`script`](https://www.home-assistant.io/components/script) domain | 39
Entities in the [`select`](https://www.home-assistant.io/components/select) domain | 2
Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 379
Entities in the [`sensor`](https://www.home-assistant.io/components/sensor) domain | 381
Entities in the [`siren`](https://www.home-assistant.io/components/siren) domain | 1
Entities in the [`sun`](https://www.home-assistant.io/components/sun) domain | 1
Entities in the [`switch`](https://www.home-assistant.io/components/switch) domain | 152
Expand All @@ -100,7 +100,7 @@ Entities in the [`update`](https://www.home-assistant.io/components/update) doma
Entities in the [`vacuum`](https://www.home-assistant.io/components/vacuum) domain | 1
Entities in the [`weather`](https://www.home-assistant.io/components/weather) domain | 2
Entities in the [`zone`](https://www.home-assistant.io/components/zone) domain | 6
**Total state objects** | **1042**
**Total state objects** | **1047**
## The HACS integrations/plugins that I use:
**Appdaemon**:<br>
[aneisch/follow_me_appdaemon](https://github.com/aneisch/follow_me_appdaemon)<br>
Expand Down
13 changes: 13 additions & 0 deletions automations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,19 @@
Rain started!
- delay: 300

- alias: "Frozen Refrigerator"
id: frozen_refrigerator
trigger:
- platform: numeric_state
entity_id: sensor.refrigerator_power
above: 50
for: "03:00:00"
action:
- service: notify.signal_self
data:
message: >
Refrigerator power consumption >50W for three hours. Is it frozen up?
- alias: "Lower and Raise Blinds"
id: "lower_raise_blinds"
trigger:
Expand Down
12 changes: 12 additions & 0 deletions command_line.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
- StartDate
- EndDate

- sensor:
name: Utilities Cycle Start
scan_interval: 60
command: !secret utilities_curl_start
value_template: "{{ value }}"

- sensor:
name: Utilities Cycle End
scan_interval: 60
command: !secret utilities_curl_end
value_template: "{{ value }}"

- sensor:
name: CPU Temperature
command: "echo $(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))"
Expand Down
10 changes: 4 additions & 6 deletions configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,14 @@ lovelace:
type: module
- url: /hacsfiles/lovelace-slider-entity-row/slider-entity-row.js
type: module
- url: /hacsfiles/lovelace-hass-aarlo/hass-aarlo.js
type: module
- url: /hacsfiles/mini-media-player/mini-media-player-bundle.js
type: module
- url: /hacsfiles/simple-thermostat/simple-thermostat.js
type: module
#- url: /hacsfiles/custom-header/custom-header.js
# type: module
- url: /hacsfiles/favicon-counter/favicon-counter.js
type: module
# - url: /hacsfiles/favicon-counter/favicon-counter.js
# type: module
- url: /hacsfiles/vertical-stack-in-card/vertical-stack-in-card.js
type: module
- url: /hacsfiles/zha-network-visualization-card/zha-network-visualization-card.js
Expand All @@ -304,8 +302,8 @@ lovelace:
type: module
- url: /hacsfiles/bignumber-card/bignumber-card.js
type: module
- url: /hacsfiles/ozw-network-visualization-card/ozw-network-visualization-card.js
type: module
# - url: /hacsfiles/ozw-network-visualization-card/ozw-network-visualization-card.js
# type: module
- url: /hacsfiles/lovelace-text-input-row/lovelace-text-input-row.js
type: module
- url: /hacsfiles/uptime-card/uptime-card.js
Expand Down
4 changes: 3 additions & 1 deletion custom_components/frigate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except FrigateApiClientError as exc:
raise ConfigEntryNotReady from exc

if AwesomeVersion(server_version) <= AwesomeVersion(FRIGATE_VERSION_ERROR_CUTOFF):
if AwesomeVersion(server_version.split("-")[0]) <= AwesomeVersion(
FRIGATE_VERSION_ERROR_CUTOFF
):
_LOGGER.error(
"Using a Frigate server (%s) with version %s <= %s which is not "
"compatible -- you must upgrade: %s",
Expand Down
20 changes: 20 additions & 0 deletions custom_components/frigate/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ async def async_retain(
)
return cast(dict[str, Any], result) if decode_json else result

async def async_export_recording(
self,
camera: str,
playback_factor: str,
start_time: float,
end_time: float,
decode_json: bool = True,
) -> dict[str, Any] | str:
"""Export recording."""
result = await self.api_wrapper(
"post",
str(
URL(self._host)
/ f"api/export/{camera}/start/{start_time}/end/{end_time}"
),
data={"playback": playback_factor},
decode_json=decode_json,
)
return cast(dict[str, Any], result) if decode_json else result

async def async_get_recordings_summary(
self, camera: str, timezone: str, decode_json: bool = True
) -> list[dict[str, Any]] | str:
Expand Down
25 changes: 25 additions & 0 deletions custom_components/frigate/camera.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Support for Frigate cameras."""
from __future__ import annotations

import datetime
import logging
from typing import Any, cast

Expand Down Expand Up @@ -36,15 +37,19 @@
ATTR_CLIENT,
ATTR_CONFIG,
ATTR_COORDINATOR,
ATTR_END_TIME,
ATTR_EVENT_ID,
ATTR_FAVORITE,
ATTR_PLAYBACK_FACTOR,
ATTR_PTZ_ACTION,
ATTR_PTZ_ARGUMENT,
ATTR_START_TIME,
CONF_RTMP_URL_TEMPLATE,
CONF_RTSP_URL_TEMPLATE,
DEVICE_CLASS_CAMERA,
DOMAIN,
NAME,
SERVICE_EXPORT_RECORDING,
SERVICE_FAVORITE_EVENT,
SERVICE_PTZ,
STATE_DETECTED,
Expand Down Expand Up @@ -91,6 +96,15 @@ async def async_setup_entry(

# setup services
platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service(
SERVICE_EXPORT_RECORDING,
{
vol.Required(ATTR_PLAYBACK_FACTOR, default="realtime"): str,
vol.Required(ATTR_START_TIME): str,
vol.Required(ATTR_END_TIME): str,
},
SERVICE_EXPORT_RECORDING,
)
platform.async_register_entity_service(
SERVICE_FAVORITE_EVENT,
{
Expand Down Expand Up @@ -324,6 +338,17 @@ async def async_disable_motion_detection(self) -> None:
False,
)

async def export_recording(
self, playback_factor: str, start_time: str, end_time: str
) -> None:
"""Export recording."""
await self._client.async_export_recording(
self._cam_name,
playback_factor,
datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S").timestamp(),
datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S").timestamp(),
)

async def favorite_event(self, event_id: str, favorite: bool) -> None:
"""Favorite an event."""
await self._client.async_retain(event_id, favorite)
Expand Down
6 changes: 5 additions & 1 deletion custom_components/frigate/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
ATTR_CLIENT_ID = "client_id"
ATTR_CONFIG = "config"
ATTR_COORDINATOR = "coordinator"
ATTR_END_TIME = "end_time"
ATTR_EVENT_ID = "event_id"
ATTR_FAVORITE = "favorite"
ATTR_MQTT = "mqtt"
ATTR_PLAYBACK_FACTOR = "playback_factor"
ATTR_PTZ_ACTION = "action"
ATTR_PTZ_ARGUMENT = "argument"
ATTR_START_TIME = "start_time"

# Frigate Attribute Labels
# These are labels that are not individually tracked as they are
Expand Down Expand Up @@ -70,7 +73,7 @@
MAX_THRESHOLD = 255

# Min Values
MIN_CONTOUR_AREA = 15
MIN_CONTOUR_AREA = 1
MIN_THRESHOLD = 1

# States
Expand All @@ -83,5 +86,6 @@
STATUS_STARTING = "starting"

# Frigate Services
SERVICE_EXPORT_RECORDING = "export_recording"
SERVICE_FAVORITE_EVENT = "favorite_event"
SERVICE_PTZ = "ptz"
2 changes: 1 addition & 1 deletion custom_components/frigate/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/blakeblackshear/frigate-hass-integration/issues",
"requirements": ["pytz==2022.7"],
"version": "5.0.0-beta.1"
"version": "5.0.0-beta.2"
}
36 changes: 36 additions & 0 deletions custom_components/frigate/services.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
---
export_recording:
name: Export recording
description: Export a custom recording or timelapse.
target:
entity:
integration: frigate
domain: camera
device_class: camera
fields:
playback_factor:
name: Playback Factor
description: Playback factor for recordings
required: true
advanced: false
example: realtime
default: realtime
selector:
select:
options:
- "realtime"
- "timelapse"
start_time:
name: Export Start Time
description: Start time of exported recording
required: true
advanced: false
selector:
datetime:
end_time:
name: Export End Time
description: End time of exported recording
required: true
advanced: false
selector:
datetime:

favorite_event:
name: Favorite or unfavorite Event
description: >
Expand Down
2 changes: 1 addition & 1 deletion extras/Node-RED/flows.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions github_action_secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ roborock_token: d41d8cd98f00b204e4400998ec111111
utilities_curl_summary: "exit"
utilities_curl_daily: "exit"
utilities_curl_realtime: "exit"
utilities_curl_start: "exit"
utilities_curl_end: "exit"

xbox_id: 1
xbox_secret: s
zoom_webhook: zoomzoom
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.
Loading

0 comments on commit da890cc

Please sign in to comment.