added WireViz and ESPHome
This commit is contained in:
195
esphome/afzuiginglageweg.yaml
Normal file
195
esphome/afzuiginglageweg.yaml
Normal file
@@ -0,0 +1,195 @@
|
||||
#' ==============================================================================
|
||||
#' ESP32-C3 SUPER MINI - CT RELAY CONTROLLER WITH OLED & ROTARY ENCODERS
|
||||
#' ==============================================================================
|
||||
#' UPDATED GPIO ASSIGNMENTS OVERVIEW:
|
||||
#' ------------------------------------------------------------------------------
|
||||
#' GPIO 0 : Rotary Encoder 1 - Phase A (Current Threshold)
|
||||
#' GPIO 1 : Rotary Encoder 1 - Phase B (Current Threshold)
|
||||
#' GPIO 2 : Rotary Encoder 1 - Push Button (Toggle Display On/Off)
|
||||
#' GPIO 3 : Rotary Encoder 2 - Phase A (Off-Delay)
|
||||
#' GPIO 4 : CT Current Sensor (Analog Input ADC1_CH4) [MOVED FROM GPIO7]
|
||||
#' GPIO 7 : Rotary Encoder 2 - Phase B (Off-Delay) [MOVED FROM GPIO4]
|
||||
#' GPIO 5 : I2C - SCL (SH1106 Display)
|
||||
#' GPIO 6 : I2C - SDA (SH1106 Display)
|
||||
#' GPIO 8 : Relay Output (Active High)
|
||||
#' ==============================================================================
|
||||
|
||||
esphome:
|
||||
name: afzuiginglageweg
|
||||
|
||||
esp32:
|
||||
board: esp32-c3-devkitm-1
|
||||
variant: esp32c3
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
logger:
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
manual_ip:
|
||||
static_ip: 192.168.1.173
|
||||
gateway: 192.168.1.1
|
||||
subnet: 255.255.255.0
|
||||
dns1: 192.168.1.1
|
||||
|
||||
ap:
|
||||
ssid: "CT-Relay Fallback AP"
|
||||
password: !secret ap_password
|
||||
|
||||
i2c:
|
||||
sda: GPIO6
|
||||
scl: GPIO5
|
||||
scan: true
|
||||
|
||||
font:
|
||||
- file: "gfonts://Roboto"
|
||||
id: font_main
|
||||
size: 10
|
||||
|
||||
globals:
|
||||
- id: current_threshold
|
||||
type: float
|
||||
restore_value: true
|
||||
initial_value: '0.5'
|
||||
|
||||
- id: off_delay_seconds
|
||||
type: int
|
||||
restore_value: true
|
||||
initial_value: '5'
|
||||
|
||||
- id: display_timeout_timer
|
||||
type: int
|
||||
restore_value: false
|
||||
initial_value: '0'
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO2
|
||||
mode: INPUT_PULLUP
|
||||
id: encoder_1_button
|
||||
name: "Display Toggle Button"
|
||||
on_press:
|
||||
then:
|
||||
- lambda: |-
|
||||
id(display_timeout_timer) = 10;
|
||||
id(main_display).turn_on();
|
||||
|
||||
- id: load_detected
|
||||
platform: template
|
||||
name: "Load Detected"
|
||||
lambda: |-
|
||||
return id(ct_current).state >= id(current_threshold);
|
||||
on_state:
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
binary_sensor.is_on: load_detected
|
||||
then:
|
||||
- switch.turn_on: relay_output
|
||||
- script.stop: delay_off_script
|
||||
else:
|
||||
- script.execute: delay_off_script
|
||||
|
||||
sensor:
|
||||
# Current Transformer Reading on valid ADC Pin (GPIO4)
|
||||
- platform: ct_clamp
|
||||
sensor: adc_sensor
|
||||
name: "CT Measured Current"
|
||||
id: ct_current
|
||||
update_interval: 500ms
|
||||
sample_duration: 200ms
|
||||
accuracy_decimals: 0
|
||||
force_update: true
|
||||
filters:
|
||||
- calibrate_linear:
|
||||
- 0.01 -> 0
|
||||
- 1 -> 1
|
||||
|
||||
- platform: adc
|
||||
pin: GPIO4
|
||||
id: adc_sensor
|
||||
attenuation: 12db
|
||||
|
||||
# Rotary Encoder 1: Threshold Control
|
||||
- platform: rotary_encoder
|
||||
name: "Threshold Setting"
|
||||
pin_a: GPIO0
|
||||
pin_b: GPIO1
|
||||
id: encoder_threshold
|
||||
on_value:
|
||||
then:
|
||||
- lambda: |-
|
||||
static int last_val = 0;
|
||||
int diff = x - last_val;
|
||||
last_val = x;
|
||||
id(current_threshold) += (diff * 0.1);
|
||||
if (id(current_threshold) < 0.0) id(current_threshold) = 0.0;
|
||||
id(display_timeout_timer) = 10;
|
||||
id(main_display).turn_on();
|
||||
|
||||
# Rotary Encoder 2: Delay Control
|
||||
- platform: rotary_encoder
|
||||
name: "Delay Setting"
|
||||
pin_a: GPIO3
|
||||
pin_b: GPIO7
|
||||
id: encoder_delay
|
||||
on_value:
|
||||
then:
|
||||
- lambda: |-
|
||||
static int last_val = 0;
|
||||
int diff = x - last_val;
|
||||
last_val = x;
|
||||
id(off_delay_seconds) += diff;
|
||||
if (id(off_delay_seconds) < 0) id(off_delay_seconds) = 0;
|
||||
id(display_timeout_timer) = 10;
|
||||
id(main_display).turn_on();
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin: GPIO8
|
||||
inverted: true
|
||||
name: "Relay Output"
|
||||
id: relay_output
|
||||
|
||||
script:
|
||||
- id: delay_off_script
|
||||
mode: restart
|
||||
then:
|
||||
- delay: !lambda "return id(off_delay_seconds) * 1000;"
|
||||
- switch.turn_off: relay_output
|
||||
|
||||
display:
|
||||
- platform: ssd1306_i2c
|
||||
model: "SH1106 128x64"
|
||||
address: 0x3C
|
||||
id: main_display
|
||||
update_interval: 0.1s
|
||||
lambda: |-
|
||||
it.printf(0, 0, id(font_main), "Current: %.2f A", id(ct_current).state);
|
||||
it.printf(0, 11, id(font_main), "Threshold: %.1f A", id(current_threshold));
|
||||
it.printf(0, 22, id(font_main), "Delay Set: %d s", id(off_delay_seconds));
|
||||
it.printf(0, 33, id(font_main), "Relay State: %s", id(relay_output).state ? "ON" : "OFF");
|
||||
it.printf(0, 44, id(font_main), "Delay: %d s", id(display_timeout_timer));
|
||||
|
||||
|
||||
|
||||
interval:
|
||||
- interval: 1s
|
||||
then:
|
||||
- lambda: |-
|
||||
if (id(display_timeout_timer) > 0) {
|
||||
id(display_timeout_timer)--;
|
||||
if (id(display_timeout_timer) == 0) {
|
||||
id(main_display).turn_off();
|
||||
}
|
||||
}
|
||||
371
esphome/x.html
Normal file
371
esphome/x.html
Normal file
@@ -0,0 +1,371 @@
|
||||
# Configuration Parameters Reference
|
||||
|
||||
Any information about this page goes here.
|
||||
|
||||
| `logger` | `[]` | |
|
||||
| `api` | `[]` | |
|
||||
|
||||
## `esphome`
|
||||
|
||||
============================================================================== ESP32-C3 SUPER MINI - CT RELAY CONTROLLER WITH OLED & ROTARY ENCODERS ============================================================================== UPDATED GPIO ASSIGNMENTS OVERVIEW: ------------------------------------------------------------------------------ GPIO 0 : Rotary Encoder 1 - Phase A (Current Threshold) GPIO 1 : Rotary Encoder 1 - Phase B (Current Threshold) GPIO 2 : Rotary Encoder 1 - Push Button (Toggle Display On/Off) GPIO 3 : Rotary Encoder 2 - Phase A (Off-Delay) GPIO 4 : CT Current Sensor (Analog Input ADC1_CH4) [MOVED FROM GPIO7] GPIO 7 : Rotary Encoder 2 - Phase B (Off-Delay) [MOVED FROM GPIO4] GPIO 5 : I2C - SCL (SH1106 Display) GPIO 6 : I2C - SDA (SH1106 Display) GPIO 8 : Relay Output (Active High) ==============================================================================
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `name` | `afzuiginglageweg` | |
|
||||
|
||||
## `esp32`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `board` | `esp32-c3-devkitm-1` | |
|
||||
| `variant` | `esp32c3` | |
|
||||
|
||||
## `preferences`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `flash_write_interval` | `1min` | |
|
||||
|
||||
## `ota`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `esphome` | |
|
||||
|
||||
## `wifi`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `ssid` | `!secret wifi_ssid` | |
|
||||
| `password` | `!secret wifi_password` | |
|
||||
| `manual_ip` | | |
|
||||
| `ap` | | |
|
||||
|
||||
### `manual_ip`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `static_ip` | `192.168.1.173` | |
|
||||
| `gateway` | `192.168.1.1` | |
|
||||
| `subnet` | `255.255.255.0` | |
|
||||
| `dns1` | `192.168.1.1` | |
|
||||
|
||||
### `ap`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `ssid` | `"CT-Relay Fallback AP"` | |
|
||||
| `password` | `!secret ap_password` | |
|
||||
|
||||
## `i2c`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `sda` | `GPIO6` | |
|
||||
| `scl` | `GPIO5` | |
|
||||
| `scan` | `true` | |
|
||||
|
||||
## `font`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `file` | `"gfonts://Roboto"` | |
|
||||
| `id` | `font_main` | |
|
||||
| `size` | `10` | |
|
||||
|
||||
## `globals`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `id` | `current_threshold` | |
|
||||
| `type` | `float` | |
|
||||
| `restore_value` | `true` | |
|
||||
| `initial_value` | `'0.5'` | |
|
||||
| `id` | `off_delay_seconds` | |
|
||||
| `type` | `int` | |
|
||||
| `restore_value` | `true` | |
|
||||
| `initial_value` | `'5'` | |
|
||||
| `id` | `display_timeout_timer` | |
|
||||
| `type` | `int` | |
|
||||
| `restore_value` | `false` | |
|
||||
| `initial_value` | `'0'` | |
|
||||
|
||||
## `binary_sensor`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `gpio` | |
|
||||
| `pin` | | |
|
||||
| `id` | `encoder_1_button` | |
|
||||
| `name` | `"Display Toggle Button"` | |
|
||||
| `on_press` | | |
|
||||
| `id` | `load_detected` | |
|
||||
| `platform` | `template` | |
|
||||
| `name` | `"Load Detected"` | |
|
||||
| `lambda` | `|-` | |
|
||||
| `return id(ct_current).state >= id(current_threshold);` | | |
|
||||
| `on_state` | | |
|
||||
|
||||
### `pin`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `number` | `GPIO2` | |
|
||||
| `mode` | `INPUT_PULLUP` | |
|
||||
|
||||
### `on_press`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
### `on_state`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `if` | | |
|
||||
|
||||
##### `if`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `condition` | | |
|
||||
| `then` | | |
|
||||
| `else` | | |
|
||||
|
||||
###### `condition`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `binary_sensor.is_on` | `load_detected` | |
|
||||
|
||||
###### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `switch.turn_on` | `relay_output` | |
|
||||
| `script.stop` | `delay_off_script` | |
|
||||
|
||||
###### `else`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `script.execute` | `delay_off_script` | |
|
||||
|
||||
## `sensor`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `# Current Transformer Reading on valid ADC Pin (GPIO4)` | | |
|
||||
| `platform` | `ct_clamp` | |
|
||||
| `sensor` | `adc_sensor` | |
|
||||
| `name` | `"CT Measured Current"` | |
|
||||
| `id` | `ct_current` | |
|
||||
| `update_interval` | `500ms` | |
|
||||
| `sample_duration` | `200ms` | |
|
||||
| `accuracy_decimals` | `0` | |
|
||||
| `force_update` | `true` | |
|
||||
| `filters` | | |
|
||||
| `platform` | `adc` | |
|
||||
| `pin` | `GPIO4` | |
|
||||
| `id` | `adc_sensor` | |
|
||||
| `attenuation` | `12db` | |
|
||||
| `# Rotary Encoder 1` | `Threshold Control` | |
|
||||
| `platform` | `rotary_encoder` | |
|
||||
| `name` | `"Threshold Setting"` | |
|
||||
| `pin_a` | `GPIO0` | |
|
||||
| `pin_b` | `GPIO1` | |
|
||||
| `id` | `encoder_threshold` | |
|
||||
| `on_value` | | |
|
||||
| `# Rotary Encoder 2` | `Delay Control` | |
|
||||
| `platform` | `rotary_encoder` | |
|
||||
| `name` | `"Delay Setting"` | |
|
||||
| `pin_a` | `GPIO3` | |
|
||||
| `pin_b` | `GPIO7` | |
|
||||
| `id` | `encoder_delay` | |
|
||||
| `on_value` | | |
|
||||
|
||||
### `filters`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `calibrate_linear` | `['0.01 -> 0', '1 -> 1']` | |
|
||||
|
||||
### `on_value`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `static int last_val = 0;` | | |
|
||||
| `int diff = x - last_val;` | | |
|
||||
| `last_val = x;` | | |
|
||||
| `id(current_threshold) += (diff * 0.1);` | | |
|
||||
| `if (id(current_threshold) < 0.0) id(current_threshold) = 0.0;` | | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
### `on_value`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `static int last_val = 0;` | | |
|
||||
| `int diff = x - last_val;` | | |
|
||||
| `last_val = x;` | | |
|
||||
| `id(off_delay_seconds) += diff;` | | |
|
||||
| `if (id(off_delay_seconds) < 0) id(off_delay_seconds) = 0;` | | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
## `switch`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `gpio` | |
|
||||
| `pin` | `GPIO8` | |
|
||||
| `inverted` | `true` | |
|
||||
| `name` | `"Relay Output"` | |
|
||||
| `id` | `relay_output` | |
|
||||
|
||||
## `script`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `id` | `delay_off_script` | |
|
||||
| `mode` | `restart` | |
|
||||
| `then` | | |
|
||||
|
||||
### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `delay` | `!lambda "return id(off_delay_seconds) * 1000;"` | |
|
||||
| `switch.turn_off` | `relay_output` | |
|
||||
|
||||
## `display`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `ssd1306_i2c` | |
|
||||
| `model` | `"SH1106 128x64"` | |
|
||||
| `address` | `0x3C` | |
|
||||
| `id` | `main_display` | |
|
||||
| `update_interval` | `0.1s` | |
|
||||
| `lambda` | `|-` | |
|
||||
| `it.printf(0, 0, id(font_main), "Current` | `%.2f A", id(ct_current).state);` | |
|
||||
| `it.printf(0, 11, id(font_main), "Threshold` | `%.1f A", id(current_threshold));` | |
|
||||
| `it.printf(0, 22, id(font_main), "Delay Set` | `%d s", id(off_delay_seconds));` | |
|
||||
| `it.printf(0, 33, id(font_main), "Relay State` | `%s", id(relay_output).state ? "ON" : "OFF");` | |
|
||||
| `it.printf(0, 44, id(font_main), "Delay` | `%d s", id(display_timeout_timer));` | |
|
||||
|
||||
## `interval`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `interval` | `1s` | |
|
||||
| `then` | | |
|
||||
|
||||
### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `if (id(display_timeout_timer) > 0) {` | | |
|
||||
| `id(display_timeout_timer)--;` | | |
|
||||
| `if (id(display_timeout_timer) == 0) {` | | |
|
||||
| `id(main_display).turn_off();` | | |
|
||||
| `}` | | |
|
||||
| `}` | | |
|
||||
|
||||
---
|
||||
Generated by [yamldoc](https://github.com/chris1221/yaml.doc) v0.4.1 on 2026-09-07
|
||||
371
esphome/x.md
Normal file
371
esphome/x.md
Normal file
@@ -0,0 +1,371 @@
|
||||
# Configuration Parameters Reference
|
||||
|
||||
Any information about this page goes here.
|
||||
|
||||
| `logger` | `[]` | |
|
||||
| `api` | `[]` | |
|
||||
|
||||
## `esphome`
|
||||
|
||||
============================================================================== ESP32-C3 SUPER MINI - CT RELAY CONTROLLER WITH OLED & ROTARY ENCODERS ============================================================================== UPDATED GPIO ASSIGNMENTS OVERVIEW: ------------------------------------------------------------------------------ GPIO 0 : Rotary Encoder 1 - Phase A (Current Threshold) GPIO 1 : Rotary Encoder 1 - Phase B (Current Threshold) GPIO 2 : Rotary Encoder 1 - Push Button (Toggle Display On/Off) GPIO 3 : Rotary Encoder 2 - Phase A (Off-Delay) GPIO 4 : CT Current Sensor (Analog Input ADC1_CH4) [MOVED FROM GPIO7] GPIO 7 : Rotary Encoder 2 - Phase B (Off-Delay) [MOVED FROM GPIO4] GPIO 5 : I2C - SCL (SH1106 Display) GPIO 6 : I2C - SDA (SH1106 Display) GPIO 8 : Relay Output (Active High) ==============================================================================
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `name` | `afzuiginglageweg` | |
|
||||
|
||||
## `esp32`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `board` | `esp32-c3-devkitm-1` | |
|
||||
| `variant` | `esp32c3` | |
|
||||
|
||||
## `preferences`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `flash_write_interval` | `1min` | |
|
||||
|
||||
## `ota`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `esphome` | |
|
||||
|
||||
## `wifi`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `ssid` | `!secret wifi_ssid` | |
|
||||
| `password` | `!secret wifi_password` | |
|
||||
| `manual_ip` | | |
|
||||
| `ap` | | |
|
||||
|
||||
### `manual_ip`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `static_ip` | `192.168.1.173` | |
|
||||
| `gateway` | `192.168.1.1` | |
|
||||
| `subnet` | `255.255.255.0` | |
|
||||
| `dns1` | `192.168.1.1` | |
|
||||
|
||||
### `ap`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `ssid` | `"CT-Relay Fallback AP"` | |
|
||||
| `password` | `!secret ap_password` | |
|
||||
|
||||
## `i2c`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `sda` | `GPIO6` | |
|
||||
| `scl` | `GPIO5` | |
|
||||
| `scan` | `true` | |
|
||||
|
||||
## `font`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `file` | `"gfonts://Roboto"` | |
|
||||
| `id` | `font_main` | |
|
||||
| `size` | `10` | |
|
||||
|
||||
## `globals`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `id` | `current_threshold` | |
|
||||
| `type` | `float` | |
|
||||
| `restore_value` | `true` | |
|
||||
| `initial_value` | `'0.5'` | |
|
||||
| `id` | `off_delay_seconds` | |
|
||||
| `type` | `int` | |
|
||||
| `restore_value` | `true` | |
|
||||
| `initial_value` | `'5'` | |
|
||||
| `id` | `display_timeout_timer` | |
|
||||
| `type` | `int` | |
|
||||
| `restore_value` | `false` | |
|
||||
| `initial_value` | `'0'` | |
|
||||
|
||||
## `binary_sensor`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `gpio` | |
|
||||
| `pin` | | |
|
||||
| `id` | `encoder_1_button` | |
|
||||
| `name` | `"Display Toggle Button"` | |
|
||||
| `on_press` | | |
|
||||
| `id` | `load_detected` | |
|
||||
| `platform` | `template` | |
|
||||
| `name` | `"Load Detected"` | |
|
||||
| `lambda` | `|-` | |
|
||||
| `return id(ct_current).state >= id(current_threshold);` | | |
|
||||
| `on_state` | | |
|
||||
|
||||
### `pin`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `number` | `GPIO2` | |
|
||||
| `mode` | `INPUT_PULLUP` | |
|
||||
|
||||
### `on_press`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
### `on_state`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `if` | | |
|
||||
|
||||
##### `if`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `condition` | | |
|
||||
| `then` | | |
|
||||
| `else` | | |
|
||||
|
||||
###### `condition`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `binary_sensor.is_on` | `load_detected` | |
|
||||
|
||||
###### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `switch.turn_on` | `relay_output` | |
|
||||
| `script.stop` | `delay_off_script` | |
|
||||
|
||||
###### `else`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `script.execute` | `delay_off_script` | |
|
||||
|
||||
## `sensor`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `# Current Transformer Reading on valid ADC Pin (GPIO4)` | | |
|
||||
| `platform` | `ct_clamp` | |
|
||||
| `sensor` | `adc_sensor` | |
|
||||
| `name` | `"CT Measured Current"` | |
|
||||
| `id` | `ct_current` | |
|
||||
| `update_interval` | `500ms` | |
|
||||
| `sample_duration` | `200ms` | |
|
||||
| `accuracy_decimals` | `0` | |
|
||||
| `force_update` | `true` | |
|
||||
| `filters` | | |
|
||||
| `platform` | `adc` | |
|
||||
| `pin` | `GPIO4` | |
|
||||
| `id` | `adc_sensor` | |
|
||||
| `attenuation` | `12db` | |
|
||||
| `# Rotary Encoder 1` | `Threshold Control` | |
|
||||
| `platform` | `rotary_encoder` | |
|
||||
| `name` | `"Threshold Setting"` | |
|
||||
| `pin_a` | `GPIO0` | |
|
||||
| `pin_b` | `GPIO1` | |
|
||||
| `id` | `encoder_threshold` | |
|
||||
| `on_value` | | |
|
||||
| `# Rotary Encoder 2` | `Delay Control` | |
|
||||
| `platform` | `rotary_encoder` | |
|
||||
| `name` | `"Delay Setting"` | |
|
||||
| `pin_a` | `GPIO3` | |
|
||||
| `pin_b` | `GPIO7` | |
|
||||
| `id` | `encoder_delay` | |
|
||||
| `on_value` | | |
|
||||
|
||||
### `filters`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `calibrate_linear` | `['0.01 -> 0', '1 -> 1']` | |
|
||||
|
||||
### `on_value`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `static int last_val = 0;` | | |
|
||||
| `int diff = x - last_val;` | | |
|
||||
| `last_val = x;` | | |
|
||||
| `id(current_threshold) += (diff * 0.1);` | | |
|
||||
| `if (id(current_threshold) < 0.0) id(current_threshold) = 0.0;` | | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
### `on_value`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `then` | | |
|
||||
|
||||
#### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `static int last_val = 0;` | | |
|
||||
| `int diff = x - last_val;` | | |
|
||||
| `last_val = x;` | | |
|
||||
| `id(off_delay_seconds) += diff;` | | |
|
||||
| `if (id(off_delay_seconds) < 0) id(off_delay_seconds) = 0;` | | |
|
||||
| `id(display_timeout_timer) = 10;` | | |
|
||||
| `id(main_display).turn_on();` | | |
|
||||
|
||||
## `switch`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `gpio` | |
|
||||
| `pin` | `GPIO8` | |
|
||||
| `inverted` | `true` | |
|
||||
| `name` | `"Relay Output"` | |
|
||||
| `id` | `relay_output` | |
|
||||
|
||||
## `script`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `id` | `delay_off_script` | |
|
||||
| `mode` | `restart` | |
|
||||
| `then` | | |
|
||||
|
||||
### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `delay` | `!lambda "return id(off_delay_seconds) * 1000;"` | |
|
||||
| `switch.turn_off` | `relay_output` | |
|
||||
|
||||
## `display`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `platform` | `ssd1306_i2c` | |
|
||||
| `model` | `"SH1106 128x64"` | |
|
||||
| `address` | `0x3C` | |
|
||||
| `id` | `main_display` | |
|
||||
| `update_interval` | `0.1s` | |
|
||||
| `lambda` | `|-` | |
|
||||
| `it.printf(0, 0, id(font_main), "Current` | `%.2f A", id(ct_current).state);` | |
|
||||
| `it.printf(0, 11, id(font_main), "Threshold` | `%.1f A", id(current_threshold));` | |
|
||||
| `it.printf(0, 22, id(font_main), "Delay Set` | `%d s", id(off_delay_seconds));` | |
|
||||
| `it.printf(0, 33, id(font_main), "Relay State` | `%s", id(relay_output).state ? "ON" : "OFF");` | |
|
||||
| `it.printf(0, 44, id(font_main), "Delay` | `%d s", id(display_timeout_timer));` | |
|
||||
|
||||
## `interval`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `interval` | `1s` | |
|
||||
| `then` | | |
|
||||
|
||||
### `then`
|
||||
|
||||
**Member variables:**
|
||||
|
||||
| Key | Value | Information |
|
||||
| :-: | :-: | :-- |
|
||||
| `lambda` | `|-` | |
|
||||
| `if (id(display_timeout_timer) > 0) {` | | |
|
||||
| `id(display_timeout_timer)--;` | | |
|
||||
| `if (id(display_timeout_timer) == 0) {` | | |
|
||||
| `id(main_display).turn_off();` | | |
|
||||
| `}` | | |
|
||||
| `}` | | |
|
||||
|
||||
---
|
||||
Generated by [yamldoc](https://github.com/chris1221/yaml.doc) v0.4.1 on 2026-09-07
|
||||
Reference in New Issue
Block a user