Home Assistant - Database Management

Home Assistant Database Management Project Plan#

First establish safe Recorder purge and repack settings. Then create and validate an export target for historical Home Assistant data.

Keep approximately 30 days of detailed history locally. Complete and verify the Recorder maintenance setup before starting the export work.

1. Configure Recorder Purge and Repack#

  • 1.1 Set purge_keep_days to 30.
  • 1.2 Enable auto_purge.
  • 1.3 Enable auto_repack.
  • 1.4 Validate the configuration and restart Home Assistant if required.
  • 1.5 Confirm that automatic purge and repack are active.
  • 1.6 Confirm that the database remains within the 30-day retention period.
  • 1.7 Confirm that sufficient free space remains for maintenance operations.

Do not begin the export-target work until the Recorder purge and repack settings have been configured and verified.

Home Assistant - Cloudflare Pages Build Usage

Home Assistant - Cloudflare Pages Build Usage#

1. Project Objective#

Add a simple Home Assistant sensor that shows how much of the Cloudflare Pages monthly build allowance has been used.

The sensor should answer:

How many of my 500 Cloudflare Pages builds have I used this month?

2. Project Scope#

The project will deliver one Home Assistant entity:

sensor.cloudflare_pages_builds

The sensor will show:

  • builds used this month;
  • builds remaining;
  • percentage of the monthly allowance used;
  • usage by Pages project;
  • the current reporting month;
  • the time of the last successful update;
  • whether the information is current or unavailable.

This project does not include a dashboard, automation, custom integration, HACS component, or unrelated Home Assistant changes.

Frigate Installation Project Plan

Frigate Installation Project Plan#

codex resume 01a010cc-f385-7fb1-bda6-375f3a85e303

UniFi Protect remains the primary NVR. Frigate will be an additional detection and classification layer. No installation or configuration should begin until the read-only validation phase is complete.

1. Project Objectives#

1.1 Functional Objectives#

The system will detect animals using Frigate motion detection, object detection, tracking, and zones.

It will distinguish coyotes from chickens, dogs, cats, deer, raccoons, foxes, and unknown animals. The initial tuning priority is avoiding missed coyote detections; false positives can be reduced afterward.

Home Assistant - Local AI Camera Detection Documentation

Local AI Camera Detection Documentation#

codex resume 01a01163-4a3e-7cd2-b780-30eef5e8f62d Continuation: codex resume 01a01b8f-a60c-7f01-9173-c4c189929d3b

This document describes the working local visual-classification implementation and the information required to recreate it. It is documentation, not a task list.

1. Purpose and Design Principles#

1.1 Purpose#

The system adds a second-stage visual classifier to the existing UniFi Protect and Home Assistant installation.

UniFi Protect remains responsible for recording video and detecting broad event categories such as animal, person, or vehicle. Home Assistant receives the Protect event, obtains an image, sends it to a local vision-capable Ollama model, evaluates the structured result, records the decision, and sends a notification only when the objective-specific policy accepts the result.

Home Assistant - Stale & Unavailable Devices Cleanup Checklist

Home Assistant - Stale & Unavailable Devices Cleanup#

This checklist tracks all stale, orphaned, and currently unavailable entities in Home Assistant grouped by physical/virtual device. Use the interactive checkboxes (- [ ]) to track your manual cleanup in the Home Assistant UI or via SSH.

Summary Stats:

  • Total Devices / Groups: 5
  • Total Affected Entities: 21
  • Stale Restored Entities (Registry Orphans / Deprecated): 10
  • Currently Unavailable Entities (Offline Hardware / Connection Loss): 11

Cleanup Methods#

  1. UI Deletion (Recommended for Stale / Orphaned Entities):
    • Go to Settings > Devices & Services > Entities.
    • Filter by Status: Restored / Unavailable or search the entity ID.
    • Select the checkbox next to the entity and click Delete Selected (red button at top).
  2. Device / Integration Reconfiguration:
    • If an entire device is decommissioned (e.g. old Meross Coop Door opener replaced by ESPHome), go to Settings > Devices & Services > [Integration] > Devices, click the 3 dots on the device card, and click Delete.
  3. Companion App Cleanup:
    • On mobile devices, disable unused tracking sensors in HA App Settings > Companion App > Manage Sensors to remove them cleanly.

1. Meross Smart Plugs, Switches & Openers (1 Devices, 2 Entities)#

  • Garage Driveway Lights (Meross Dimmer) (Garage — 2 entities — Unavailable / Offline)
    • light.garage_driveway_lights_meross_dimmer — Garage Driveway Lights (Meross Dimmer) (light) — 🔴 Offline / Unavailable
    • sensor.garage_driveway_lights_meross_dimmer_signal_strength — Garage Driveway Lights (Meross Dimmer) - signal_strength (sensor) — 🔴 Offline / Unavailable

2. Aqara, Zigbee & Matter Sensors (3 Devices, 17 Entities)#

  • Aqara Motion Sensor (No Area — 5 entities — Stale Restored)

Home Assistant - Chicken Coop Door

Chicken Coop Door — ESP32 + IBT-2 + ESPHome#

codex resume 01a00aab-e96d-7aa3-8a96-579fe3727d04

Overview#

This note documents the final working configuration for controlling the chicken coop door using:

  • ESP32 development board
  • ESP32 screw-terminal breakout board
  • IBT-2 / BTS7960 H-bridge motor driver
  • 14 V DC linear actuator
  • 14 V DC power supply
  • ESPHome
  • Home Assistant

The ESP32 communicates with Home Assistant over Wi-Fi using ESPHome.

The IBT-2 controls the direction of the two-wire DC actuator by reversing the polarity applied to the actuator.

Home Assistant - Meross Ghost Entity & VLAN Routing Fix

1 Meross Ghost Entity & VLAN Routing Fix#

1.1 The Issue#

When deleting and re-adding a Meross device, Home Assistant might refuse to connect and continuously restore the old ghost entity name while throwing a KeyError and AttributeError: 'NoneType' object has no attribute 'attach' in the logs.

1.2 Why it happens#

  1. The Registry Ghost: When a device is deleted from the UI, Home Assistant sometimes keeps its UUID permanently trapped in the hidden deleted_devices and deleted_entities recycle bins inside the .storage registry. Whenever you re-add the device, HA automatically restores the old, corrupted data.
  2. The Cloud Profile Cache: The meross_lan integration caches the Meross Cloud Profile. If you re-add a device to the Meross app, meross_lan may still use an expired offline cache (e.g., meross_lan.profile.xxxxxx) which lacks the new UUID or MQTT keys, causing a KeyError.
  3. The VLAN Block: If Home Assistant is on a different VLAN than the IoT devices and HTTP (Port 80) is blocked, meross_lan cannot push the local MQTT configuration to the new device, leaving it “Unavailable”.

1.3 The Complete Fix & Automation Script#

Target SSH Host: root@10.1.2.200

Homelab Device Management

🏠 Homelab Device Management#

1. Executive Summary & Architecture#

This document defines the Single Source of Truth (SSOT) Device Management Architecture for the Homelab environment.

To optimize speed, usability, and data integrity:

  1. Google Sheets serves as the Primary User Entry Interface. Adding or editing devices in the spreadsheet is fast, accessible on mobile/desktop, and requires zero complex IPAM UI navigation.
  2. NetBox (v4.2) serves as the Automated IPAM & DCIM System of Record. It is hosted on 10.1.2.202:8082 and reconciled directly from Google Sheets via terminal alias.
flowchart LR
    A["Google Sheets (User Entry)"] -->|Mac Studio Alias: netbox| B["sync_gsheets_to_netbox.py"]
    B -->|Non-Destructive Delta Sync| C["NetBox v4.2 (10.1.2.202:8082)"]
    C -->|API & Interoperability| D["UniFi UDM / Home Assistant / Pi-hole"]

2. Standard Operating Procedure (SOP) for Device Management#

A. Adding or Editing Devices#

  1. Open the Google Sheet inventory (Devices tab).
  2. Add or edit any row (Location, Name, Serial, MAC, IP, Type, Brand).
  3. Open your Mac Studio terminal and type:
    netbox
  4. Outcome: The script fetches your spreadsheet, securely sends the inventory to NetBox on 10.1.2.202:8082, and updates your network records in seconds.

B. Retiring or Deleting a Device#

  • Option 1 (Archive / Keep Record): Change the Location column in Google Sheets to Z-Inactive.
    • Behavior: The sync script automatically skips all Z-Inactive rows during import, removing the device from active NetBox IPAM while preserving historical records in your spreadsheet.
  • Option 2 (Permanent Delete): Delete the row from the Google Sheet and run netbox.

3. Work Completed#

During the system implementation, the following key engineering milestones were achieved:

Home Assistant - SSH Configuration

1 Home Assistant SSH Configuration#

1.1 Add SSH Keys#

To enable passwordless SSH access to your Home Assistant instance, you must have the SSH & Web Terminal add-on installed and Advanced Mode enabled for your user profile.

1.2 Configure Authorized Keys#

  1. Open the terminal within Home Assistant or via a console.
  2. Edit the authorized keys file:
nano /data/.ssh/authorized_keys
  1. Paste your public SSH key (e.g., from your Mac Studio or MacBook Air) into the file.
  2. Save and exit (Ctrl+O, Enter, Ctrl+X).

Ensure the SSH add-on configuration has the correct port (usually 22 or 2222) and that the “SFTP” or “SSH” services are started in the add-on’s dashboard.

ser2net Zigbee USB Server

ser2net Zigbee USB Server Configuration#

This setup allows you to host a Zigbee USB dongle on one machine (e.g., MMDocker/Proxmox 230) and connect to it over the network from Home Assistant.


1. Installation#

Reference: Peter Kieser - ser2net and Zigbee Coordinator

# Install the software
apt-get update && apt-get install ser2net -y
# Verify version and status
ser2net -v
systemctl status ser2net

2. Identify USB Hardware#

# Locate the specific device ID (stable path)
ls -lah /dev/serial/by-id/
# Get detailed info for the specific port (if needed)
udevadm info -q all -a -n /dev/ttyUSB0
# SkyConnect
ls /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0*

3. Configuration (Version 4.0+)#

Modern versions of ser2net use YAML configuration files.