max on time for LED in V1.3

This commit is contained in:
root
2025-08-22 00:28:23 +12:00
parent a0588bf6c2
commit 77f2af3d74

View File

@@ -1,57 +1,54 @@
########################################################################################## ##########################################################################################
########################################################################################## ##########################################################################################
# Title: DOWNSTAIRS KITCHEN - OVER PANTRY LEDS # Title: DOWNSTAIRS KITCHEN - OVER PANTRY LEDS
# Hardware: Sinilink Mosfet Board XY-VFMS (ESP8266) # Hardware: Sinilink MOSFET Board XY-WFMS (ESP8266) — sometimes listed as “XY-VFMS”
# https://devices.esphome.io/devices/Sinilink-XY-VFMS # https://devices.esphome.io/devices/Sinilink-XY-VFMS
# Repo: https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-downstairskitchleds.yaml # Repo: https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-downstairskitchleds.yaml
# #
# V1.2 - 2025-08-21 Added some defaults to "Device Specific settings" in substitutions & a PWM % View # v1.3 - 2025-08-22 Added a “max on time” setting (148 h, 0 = no limit)
# V1.1 - 2025-08-18 Full tidyup as general purpose LED strip controller # v1.2 - 2025-08-21 Added defaults to “Device Specific Settings” in substitutions & a PWM % view
# V1.0 - 2025-08-17 First Setup (and replacement of Tasmota) # v1.1 - 2025-08-18 Full tidy-up as general-purpose LED strip controller
# v1.0 - 2025-08-17 First setup (and replacement of Tasmota)
# #
# ------------------------------------------ # ------------------------------------------
# DEVICE GPIO Sinilink XY-VFMS # DEVICE GPIO (Sinilink XY-WFMS)
# ------------------------------------------ # ------------------------------------------
# GPIO02 Blue LED (We'll use this for ESPHome status) # GPIO02 Blue LED (used for ESPHome status)
# GPIO04 Mosfet Output (0V when switched) and Red LED # GPIO04 MOSFET output (0 V when switched) and Red LED
# GPIO12 Toggle Button # GPIO12 Toggle button
# GPIO13 Green LED (We'll use this to display fading status) # GPIO13 Green LED (used to display fading status)
# #
# ------------------------------------------ # ------------------------------------------
# OPERATION (as at V1.2) # OPERATION (as of v1.3)
# ------------------------------------------ # ------------------------------------------
# 1. General Purpose LED controller # 1. General-purpose LED controller.
# 2. Designed for a Sinilink XY-VFMS board that has a mosfet output and supposedly will handle # 2. Designed for the Sinilink XY-WFMS board with a MOSFET output (claimed ~5 A, 536 V DC).
# 5A and a DC input of 5V-36V. # 3. Global setting for MAX % output to extend LED life.
# 3. Has global setting for MAX % PWM output for the LEDs so you can give them a longer life. # 4. Minimum output setting; switches fully OFF at/below the minimum to avoid low-PWM flicker.
# 4. Has a min setting for the LEDs and it will switch off if it goes below that to stop any # 5. PWM frequency is set to 500 Hz by default. You can increase it, but higher values caused
# flicker at very low PWM outputs. # resets on this device. On ESP32 you can run much higher (~40 kHz).
# 5. PWM freq is set to 2kHz, but you could potentially ramp it up. I was getting resets at # 6. Min/Max output settings are not exposed in Home Assistant/MQTT by default, but can be.
# higher values with this device, but other devices may be better. Obviously if yoou use # With a 1 MB flash, space is tight and only minimal optimisation has been done so far.
# an esp32 you can set it much higher (40kHz I think is the max?) # 7. PACKAGES include common items: network settings, diagnostic entities, MQTT, and SNTP (optional).
# 6. Min and Max output settings aren't set in Home assistant/MQTT, but you could do this if # 8. Default behaviour is to fade slowly up to full at power-up (so it can run with no network).
# needed. With a 1MB flash, it is starting to get tight. I have done minimal optimising # 9. The green LED flashes while fading (different patterns for up/down). The red LED follows the
# at this stage though. # output (it shares the MOSFET GPIO).
# 7. There are PACKAGES included for the common things such as the network # 10. Fade timing scales with the configured values (proportionally when starting mid-brightness).
# items, diagnostic entities, MQTT and SNTP (if needed, get them from the repo or use your own) # 11. Useful 3D-printed case: https://cults3d.com/en/3d-model/tool/snapfit-enclosure-for-esp8266-sinilink-xy-wfms-5v-36v-mosfet-switch-module
# 8. Default config is to always fade slowly up to full when powered up (so can be deployed with # 12. Exposed in Home Assistant/MQTT:
# no network etc) # - Startup action
# 9. The green LED on the sinilink flashes whilst fading (differently for up/down). The red LED # - Fade Up / Fade Down / Fade Stop buttons
# follows the output (it is the same GPIO as the MOSFET) # - Fade Up/Down switch
# 10.Timing of fades should be based on settings, or a percentage of them if eg already half brightness. # - Normal On/Off switch (quick ramp up/down)
# 11.A useful 3D printed case: https://cults3d.com/en/3d-model/tool/snapfit-enclosure-for-esp8266-sinilink-xy-wfms-5v-36v-mosfet-switch-module # - Fade up/down times (060 s)
# 12.Some things you can change in Home Assistant/MQTT # - Output % (pre-gamma) and PWM % (post-gamma)
# - Start up function # - Output Set (1100, respects min/max)
# - Up/Down/Stop fade buttons # - Device diagnostics (from the included package)
# - A fade up/fade down switch # - Maximum “on” time before automatic fade-down (148 h; 0 = no limit)
# - Normal on/off switch (quick ramp up/down)
# - Setting for fade up and fade times (0-60 seconds)
# - Output display of % output (before gamma), and the PWM % output (after gamma)
# - Ability to set output to any value (1-100, but respects min/max)
# - Default has a bunch of device diagnostic in the PACKAGE included (Sensors_Common)
# #
###########################################################################################
########################################################################################## ##########################################################################################
##########################################################################################
########################################################################################## ##########################################################################################
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS # SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
@@ -62,16 +59,16 @@ substitutions:
device_name: "esp-downstairskitchleds" device_name: "esp-downstairskitchleds"
friendly_name: "Downstairs Kitchen LEDs" friendly_name: "Downstairs Kitchen LEDs"
description_comment: "Downstairs Kitchen Over Pantry LEDs :: Sinilink XY-WFMS" description_comment: "Downstairs Kitchen Over Pantry LEDs :: Sinilink XY-WFMS"
device_area: "Downstairs Kitchen" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant. device_area: "Downstairs Kitchen" # Allows the ESP device to be automatically linked to an 'Area' in Home Assistant.
# Project Naming # Project Naming
project_name: "Sinilink.XY-WFMS" # Project Details project_name: "Sinilink.XY-WFMS" # Project details
project_version: "v1.2" # Project V denotes release of yaml file, allowing checking of deployed vs latest version project_version: "v1.3" # Project version denotes release of the YAML file, allowing checking of deployed vs latest version
# Passwords & Secrets # Passwords & Secrets
api_key: !secret esp-api_key api_key: !secret esp-api_key
ota_pass: !secret esp-ota_pass ota_pass: !secret esp-ota_pass
static_ip_address: !secret esp-downstairskitchleds_ip # unfortunately you can't use substitutions inside secrets names static_ip_address: !secret esp-downstairskitchleds_ip # Unfortunately, you can't use substitutions inside secret names
mqtt_local_command_main_topic: !secret mqtt_local_command_main_topic mqtt_local_command_main_topic: !secret mqtt_local_command_main_topic
mqtt_local_status_main_topic: !secret mqtt_local_status_main_topic mqtt_local_status_main_topic: !secret mqtt_local_status_main_topic
@@ -83,12 +80,12 @@ substitutions:
mqtt_local_device_command_OFF: "OFF" mqtt_local_device_command_OFF: "OFF"
# Device Specific Settings # Device Specific Settings
log_level: "NONE" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE log_level: "NONE" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (default), VERBOSE, VERY_VERBOSE
update_interval: "20s" # update time for for general sensors etc update_interval: "20s" # Update time for general sensors, etc.
led_gamma: "1.2" # Gamma from 1.2 - 3 is sensible to normalise the lED fading vs PWM led_gamma: "1.2" # Gamma from 1.23 is sensible to normalise the LED fading vs PWM
minimum_led_output: "1" # % If at this value or below, we'll switch it completely off minimum_led_output: "1" # % If at this value or below, we'll switch it completely off
maximum_led_output: "90" # % Maximum output, it is sometimes nice to limit the output for longevity or aesthetic maximum_led_output: "90" # % Maximum output; it is sometimes nice to limit the output for longevity or aesthetics
max_on_default_hours: "6" # The max the LEDs will be on for, in case they get left on. 0 = no automatic turn-off max_on_default_hours: "6" # The maximum time the LEDs will be on, in case they get left on. 0 = no automatic turn-off
########################################################################################## ##########################################################################################
# PACKAGES: Included Common Packages # PACKAGES: Included Common Packages