222 lines
8.5 KiB
YAML
222 lines
8.5 KiB
YAML
#:########################################################################################:#
|
|
# TITLE: ARCADE CABINET 1 POWER (ATHOM SMART PLUG V1)
|
|
# zorruno.com layout v1.1 2026
|
|
#:########################################################################################:#
|
|
# REPO:
|
|
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-arcademachine1.yaml
|
|
#:########################################################################################:#
|
|
# VERSIONS:
|
|
# v1.1 2026-03-04 Updated yaml to zorruno layout V1.1
|
|
# v1.0 Unknown date - Initial Version (date not present in source header)
|
|
#:########################################################################################:#
|
|
# HARDWARE:
|
|
# - Athom Smart Plug Power V1 (ESP8285 / ESP8266 family)
|
|
# - Load: MAME Arcade Cabinet 1 (Defender)
|
|
#:########################################################################################:#
|
|
# OPERATION NOTES:
|
|
# - Controls arcade cabinet mains power via Athom Smart Plug relay
|
|
# - Provides power monitoring via included Athom PowerMon V1 common package
|
|
# - Local power button toggles relay state
|
|
#:########################################################################################:#
|
|
# MQTT COMMANDS:
|
|
# - None device-specific in this YAML (uses common MQTT package for base connectivity).
|
|
#:########################################################################################:#
|
|
# OFFLINE NOTES:
|
|
# a) Home Assistant OFFLINE, WiFi OK
|
|
# - Local button still toggles the relay.
|
|
# - Power monitoring continues locally; HA updates resume when HA returns.
|
|
#
|
|
# b) MQTT OFFLINE (or broker unreachable)
|
|
# - Local button and HA API (if HA reachable) still operate the relay.
|
|
# - MQTT state/telemetry (from common packages) will not publish until MQTT returns.
|
|
#
|
|
# c) Entire WiFi/Network OFFLINE
|
|
# - Local button still toggles the relay.
|
|
# - Accurate time is NOT needed for operation (no schedules). SNTP not needed.
|
|
#:########################################################################################:#
|
|
|
|
|
|
#:########################################################################################:#
|
|
# SUBSTITUTIONS: Specific device variable substitutions
|
|
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
|
|
#:########################################################################################:#
|
|
substitutions:
|
|
# Device Naming
|
|
device_name: "esp-arcademachine1"
|
|
friendly_name: "Arcade Cabinet 1"
|
|
description_comment: "MAME Arcade 1 (Defender) machine power :: Athom Smart Plug Power V1 (Layout V1.1)"
|
|
device_area: "Downstairs Flat" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
|
|
|
|
# Project Naming
|
|
project_name: "Athom Technology.Smart Plug V1"
|
|
project_version: "v1.1"
|
|
|
|
# Passwords
|
|
api_key: !secret esp-api_key # unfortunately you can't use substitutions inside secrets names
|
|
ota_pass: !secret esp-ota_pass # unfortunately you can't use substitutions inside secrets names
|
|
static_ip_address: !secret esp-arcademachine1_ip
|
|
|
|
# If we are changing IP addresses, you must update the current IP address here, otherwise it remains
|
|
# Don't forget to switch it back when changed.
|
|
current_ip_address: ${static_ip_address}
|
|
|
|
# Device Settings
|
|
log_level: "NONE" # NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
|
|
update_interval: "10s" # update time for for general sensors etc
|
|
|
|
relay_icon: "mdi:power-socket-au"
|
|
current_limit: "10" # Current Limit in Amps. AU Plug = 10. IL, BR, EU, UK, US Plug = 16.
|
|
|
|
|
|
#:########################################################################################:#
|
|
# PACKAGES: Included Common Packages
|
|
# https://esphome.io/components/packages.html
|
|
#:########################################################################################:#
|
|
packages:
|
|
##################################################
|
|
# MANDATORY packages (won't compile without them!)
|
|
##################################################
|
|
|
|
#### WIFI, Network (Static/DHCP/IPV6 etc), Fallback AP, Safemode ####
|
|
common_wifi: !include
|
|
file: common/network_common.yaml
|
|
vars:
|
|
local_device_name: "${device_name}"
|
|
local_static_ip_address: "${static_ip_address}"
|
|
local_ota_pass: "${ota_pass}"
|
|
local_current_ip_address: "${current_ip_address}"
|
|
|
|
##################################################
|
|
# OPTIONAL packages (comment if you don't want them)
|
|
##################################################
|
|
|
|
#### HOME ASSISTANT API (choose encryption or no encryption options) ####
|
|
common_api: !include
|
|
file: common/api_common.yaml
|
|
#file: common/api_common_noencryption.yaml
|
|
vars:
|
|
local_api_key: "${api_key}"
|
|
|
|
#### WEB PORTAL ####
|
|
common_webportal: !include
|
|
file: common/webportal_common.yaml
|
|
|
|
#### MQTT ####
|
|
common_mqtt: !include
|
|
file: common/mqtt_common.yaml
|
|
vars:
|
|
local_device_name: "${device_name}"
|
|
|
|
#### SNTP (Only use if you want/need accurate timeclocks) ####
|
|
common_sntp: !include
|
|
file: common/sntp_common.yaml
|
|
|
|
#### DIAGNOSTICS Lite Sensors ####
|
|
common_lite_sensors: !include
|
|
file: common/sensors_common_lite.yaml
|
|
|
|
#### DIAGNOSTICS General Sensors ####
|
|
common_general_sensors: !include
|
|
file: common/sensors_common.yaml
|
|
|
|
# Device Specific included packages
|
|
common_athompowermonV1: !include
|
|
file: common/athompowermonv1_common.yaml
|
|
vars:
|
|
local_friendly_name: "${friendly_name}"
|
|
local_current_limit: "${current_limit}"
|
|
|
|
|
|
#:########################################################################################:#
|
|
# ESPHOME:
|
|
# https://esphome.io/components/esphome.html
|
|
#:########################################################################################:#
|
|
esphome:
|
|
name: "${device_name}"
|
|
friendly_name: "${friendly_name}"
|
|
comment: "${description_comment}" # Appears on the esphome page in HA
|
|
area: "${device_area}"
|
|
name_add_mac_suffix: false
|
|
min_version: 2024.6.0
|
|
project:
|
|
name: "${project_name}"
|
|
version: "${project_version}"
|
|
|
|
|
|
#:########################################################################################:#
|
|
# ESP PLATFORM AND FRAMEWORK:
|
|
# https://esphome.io/components/esp8266/
|
|
#:########################################################################################:#
|
|
esp8266:
|
|
board: esp8285
|
|
restore_from_flash: true # mainly for calculating cumulative energy, but not that important here
|
|
|
|
|
|
#:########################################################################################:#
|
|
# PREFERENCES:
|
|
# https://esphome.io/components/preferences.html
|
|
#:########################################################################################:#
|
|
preferences:
|
|
flash_write_interval: 10min
|
|
|
|
|
|
#:########################################################################################:#
|
|
# MDNS:
|
|
# https://esphome.io/components/mdns.html
|
|
#:########################################################################################:#
|
|
mdns:
|
|
disabled: false # binary size saving
|
|
|
|
|
|
#:########################################################################################:#
|
|
# LOGGING: ESPHome Logging Enable
|
|
# https://esphome.io/components/logger.html
|
|
#:########################################################################################:#
|
|
logger:
|
|
level: "${log_level}"
|
|
baud_rate: 0 # set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM)
|
|
|
|
|
|
#:########################################################################################:#
|
|
# BINARY SENSORS:
|
|
# https://esphome.io/components/binary_sensor/
|
|
#:########################################################################################:#
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin:
|
|
number: GPIO3
|
|
mode: INPUT_PULLUP
|
|
inverted: true
|
|
name: "Power Button"
|
|
id: power_button
|
|
filters:
|
|
- delayed_on: 20ms
|
|
on_click:
|
|
- min_length: 20ms
|
|
max_length: 500ms
|
|
then:
|
|
- lambda: |-
|
|
if (id(relay).state) {
|
|
id(relay).turn_off();
|
|
} else {
|
|
id(relay).turn_on();
|
|
}
|
|
|
|
- platform: template
|
|
name: "Relay Status"
|
|
lambda: |-
|
|
return id(relay).state;
|
|
|
|
|
|
#:########################################################################################:#
|
|
# SWITCH COMPONENT:
|
|
# https://esphome.io/components/switch/
|
|
#:########################################################################################:#
|
|
switch:
|
|
- platform: gpio
|
|
name: "Power Output"
|
|
pin: GPIO14
|
|
id: relay
|
|
restore_mode: RESTORE_DEFAULT_OFF # Ensures the relay is restored (or off) at boot
|
|
#internal: true # Hides the switch from Home Assistant
|
|
icon: "${relay_icon}" |