Chicken Coop Door — ESP32 + IBT-2 + ESPHome

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.

Linux - Unattended-Upgrades

Unattended-Upgrades Configuration (VM & LXC)#

Not Used, as a reference only

The objective of this guide is to safely automate software updates across a high-density environment of virtual machines and LXC containers, significantly reducing daily manual maintenance without compromising infrastructure stability. By shifting from a manual execution model to a structured deployment using the native unattended-upgrades utility, the system handles the download, installation, and post-update cleanup of all packages automatically in the background. Rather than allowing unpredictable automated reboots that could disrupt active services or interfere with critical backup windows, this configuration enforces a strict “notify-only” baseline. It leverage a lightweight mail client to alert the administrator immediately when a reboot is pending, combining hands-free patching with complete operational control.

Cron Jobs

Cron Jobs#


1. Create a backup Scheduler every hour between 8:00 and 22:00#

8..22/1:00

1.1. Check if it was triggered#

grep CRON /var/log/syslog | tail -n 5

Crontab commands#

contab -e

2. Cronjob for MacMini#

ttps://crontab.guru/
#@reboot (sleep 60 && echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor)
@reboot setpci -s 0:1f.0 0xa4.b=0

#PVEBackup
30 3 * * * /bin/bash /mnt/pve/Software/Software/Scripts/Proxmox/proxmox_backup.sh > /dev/null 2>&1

#hp1
50 7 * * * /usr/bin/wakeonlan 94:57:a5:65:4e:90
55 7 * * * /usr/sbin/pvesm set HP1BackupServer -disable false
15 21 * * * /usr/sbin/pvesm set HP1BackupServer -disable true

#HP2
00 18 * * * /usr/bin/wakeonlan 94:57:a5:65:7e:88
#HP3
50 8 * * 7 /usr/bin/wakeonlan ec:b1:d7:7c:a9:48
#HP4
00 13 * * * /usr/bin/wakeonlan 20:67:7c:ee:63:80
#HP6
#50 7 * * * /usr/bin/wakeonlan 50:65:f3:f1:b8:90
#50 7 * * * /usr/sbin/pvesm set HP6BackupServer -disable false
#30 8 * * * /usr/sbin/pvesm set HP6BackupServer -disable true
#50 17 * * * /usr/bin/wakeonlan 50:65:f3:f1:b8:90
#50 17 * * * /usr/sbin/pvesm set HP6BackupServer -disable false
#30 18 * * * /usr/sbin/pvesm set HP6BackupServer -disable true
#HP7
50 8 * * * /usr/bin/wakeonlan ac:16:2d:6e:64:fc
#HP8
50 8 * * * /usr/bin/wakeonlan 80:30:e0:3b:a5:74 ​

#HP8OLD
#45 7 * * * /usr/bin/wakeonlan 3c:d9:2b:03:d8:f2

#HP9OLD
#45 7 * * * /usr/bin/wakeonlan 68:b5:99:77:17:c2

#HP10OLD
#30 8 * * * /usr/bin/wakeonlan 00:26:55:29:0d:cc

#MP5.2TrueNAS
#00 08 * * 7 /usr/sbin/pvesm set MP5.2Backups -disable false
#00 11 * * 7 /usr/sbin/pvesm set MP5.2Backups -disable true

3. Cronjob HP4#

30 18 * * * /usr/sbin/pvesm set HP4BackupServer -disable true                                      
15 12 * * * /usr/sbin/shutdown -h now
00 19 * * * /usr/sbin/shutdown -h now

4. Cron Job to Auto Start After Power Failure for MacMini (autostart)#

crontab -e (crontab -l for a list of jobs)

n8n AI & Database Management

n8n AI & Database Management#


1. Database Administration#

Access the backend Postgres instance to monitor or clear AI-related data.

Access the Database#

docker exec -it n8n_postgres16 psql -U n8n -d n8n

Table Inspection#

-- Count entries in knowledge base
SELECT COUNT(*) FROM n8n_knowledge_base;
-- Count entries in chat history
SELECT COUNT(*) FROM n8n_chat_histories;
-- View table structure
\d n8n_knowledge_base
-- Preview top 20 entries
SELECT * FROM n8n_knowledge_base LIMIT 20;

Maintenance (Data Deletion)#

-- Clear all chat histories
DELETE FROM n8n_chat_histories;
-- Clear all knowledge base vectors
DELETE FROM n8n_knowledge_base;

2. AI Agent: System Prompt (Wally)#

Copy and paste the following into the System Message field of your n8n AI Agent node.