- Replace gauge.py (MicroPython) references with gaugecontroller.yaml (ESPHome) - Update CLAUDE.md and README.md to document ESPHome-native API integration - Update LED wiring docs for separate main/indicator strips (D22/D36) - Refactor Arduino firmware to drive two WS2812 strips independently - Add per-gauge physical offset caching for main and indicator LEDs - Frame-limit breathe effect (16ms) to reduce unnecessary strip refreshes
2395 lines
93 KiB
YAML
2395 lines
93 KiB
YAML
substitutions:
|
|
# --- Device identity ---
|
|
device_name: gaugecontroller
|
|
device_friendly_name: Selsyn Multi
|
|
device_area: Control Panels
|
|
|
|
# --- WiFi ---
|
|
wifi_ssid: !secret wifi_ssid
|
|
wifi_password: !secret wifi_password
|
|
|
|
# --- Arduino UART bridge ---
|
|
arduino_tx_pin: GPIO4
|
|
arduino_rx_pin: GPIO5
|
|
arduino_baud: "38400"
|
|
|
|
# --- Gauge 1 ---
|
|
gauge0_name: Selsyn 1
|
|
gauge0_entity_name: Selsyn 1 Power
|
|
gauge0_min: "0.0"
|
|
gauge0_max: "7612.0"
|
|
gauge0_max_steps: "3780"
|
|
gauge0_unit: W
|
|
gauge0_step: "1.0"
|
|
gauge0_speed_step: "1"
|
|
gauge0_accel_step: "1"
|
|
gauge0_default_speed: "5000"
|
|
gauge0_default_accel: "6000"
|
|
|
|
# --- Gauge 2 ---
|
|
gauge1_name: Selsyn 2
|
|
gauge1_entity_name: Selsyn 2 Temperature
|
|
gauge1_min: "0.0"
|
|
gauge1_max: "76.0"
|
|
gauge1_max_steps: "3780"
|
|
gauge1_unit: Deg
|
|
gauge1_step: "1.0"
|
|
gauge1_speed_step: "100"
|
|
gauge1_accel_step: "100"
|
|
gauge1_default_speed: "5000"
|
|
gauge1_default_accel: "6000"
|
|
|
|
# --- Gauge 3 ---
|
|
gauge2_name: Selsyn 3
|
|
gauge2_entity_name: Selsyn 3 Power
|
|
gauge2_min: "0.0"
|
|
gauge2_max: "7612.0"
|
|
gauge2_max_steps: "3780"
|
|
gauge2_unit: W
|
|
gauge2_step: "1.0"
|
|
gauge2_speed_step: "100"
|
|
gauge2_accel_step: "100"
|
|
gauge2_default_speed: "5000"
|
|
gauge2_default_accel: "6000"
|
|
|
|
# --- Gauge 4 ---
|
|
gauge3_name: Selsyn 4
|
|
gauge3_entity_name: Selsyn 4 Power
|
|
gauge3_min: "0.0"
|
|
gauge3_max: "7612.0"
|
|
gauge3_max_steps: "3780"
|
|
gauge3_unit: W
|
|
gauge3_step: "1.0"
|
|
gauge3_speed_step: "100"
|
|
gauge3_accel_step: "100"
|
|
gauge3_default_speed: "5000"
|
|
gauge3_default_accel: "6000"
|
|
|
|
# --- Timing ---
|
|
rezero_interval: 3600s
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Core ESPHome identity
|
|
# ---------------------------------------------------------------------------
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
friendly_name: ${device_friendly_name}
|
|
on_boot:
|
|
priority: -100
|
|
then:
|
|
- delay: 2s
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOMEALL\n"
|
|
- logger.log: "Boot: HOMEALL sent to Arduino"
|
|
- delay: 15s
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "POS?\n"
|
|
- logger.log: "Boot: POS? sent to Arduino"
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "CFG?\n"
|
|
- logger.log: "Boot: CFG? sent to Arduino"
|
|
|
|
esp32:
|
|
board: esp32-c3-devkitm-1
|
|
variant: ESP32C3
|
|
framework:
|
|
type: esp-idf
|
|
version: recommended
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Logging (set level: NONE in production)
|
|
# ---------------------------------------------------------------------------
|
|
|
|
logger:
|
|
level: DEBUG
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Native HA API — handles all entity registration, state sync, and commands.
|
|
# No manual discovery payloads needed.
|
|
# ---------------------------------------------------------------------------
|
|
|
|
api:
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# OTA — replaces ota.py / Gitea updater; managed from HA or esphome CLI
|
|
# ---------------------------------------------------------------------------
|
|
|
|
ota:
|
|
- platform: esphome
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# WiFi — replaces connect_wifi() + check_wifi() + all reconnect logic
|
|
# ---------------------------------------------------------------------------
|
|
|
|
wifi:
|
|
ssid: ${wifi_ssid}
|
|
password: ${wifi_password}
|
|
output_power: 15
|
|
ap:
|
|
ssid: "${device_name} Fallback"
|
|
password: !secret fallbackpassword
|
|
|
|
captive_portal:
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Arduino UART bridge
|
|
# ---------------------------------------------------------------------------
|
|
|
|
uart:
|
|
id: arduino_uart
|
|
tx_pin: ${arduino_tx_pin}
|
|
rx_pin: ${arduino_rx_pin}
|
|
baud_rate: ${arduino_baud}
|
|
# Uncomment to log raw Arduino traffic:
|
|
# debug:
|
|
# direction: BOTH
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Connectivity diagnostics
|
|
# ---------------------------------------------------------------------------
|
|
|
|
sensor:
|
|
- platform: wifi_signal
|
|
name: WiFi Signal
|
|
update_interval: 60s
|
|
entity_category: diagnostic
|
|
|
|
- platform: uptime
|
|
name: Uptime
|
|
entity_category: diagnostic
|
|
|
|
- platform: template
|
|
name: "${gauge0_name} Target"
|
|
lambda: |-
|
|
return id(gauge0_target_value);
|
|
unit_of_measurement: "${gauge0_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge1_name} Target"
|
|
lambda: |-
|
|
return id(gauge1_target_value);
|
|
unit_of_measurement: "${gauge1_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge2_name} Target"
|
|
lambda: |-
|
|
return id(gauge2_target_value);
|
|
unit_of_measurement: "${gauge2_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge3_name} Target"
|
|
lambda: |-
|
|
return id(gauge3_target_value);
|
|
unit_of_measurement: "${gauge3_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
entity_category: diagnostic
|
|
|
|
text_sensor:
|
|
- platform: wifi_info
|
|
ip_address:
|
|
name: IP Address
|
|
entity_category: diagnostic
|
|
ssid:
|
|
name: SSID
|
|
entity_category: diagnostic
|
|
|
|
- platform: template
|
|
id: arduino_last_message
|
|
name: Arduino Last Message
|
|
entity_category: diagnostic
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Gauge target numbers
|
|
# ---------------------------------------------------------------------------
|
|
|
|
number:
|
|
- platform: template
|
|
id: gauge0_target_number
|
|
name: "${gauge0_entity_name}"
|
|
unit_of_measurement: "${gauge0_unit}"
|
|
min_value: ${gauge0_min}
|
|
max_value: ${gauge0_max}
|
|
step: ${gauge0_step}
|
|
mode: slider
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge0_min}
|
|
set_action:
|
|
- lambda: |-
|
|
const float min_value = ${gauge0_min};
|
|
const float max_value = ${gauge0_max};
|
|
const int max_steps = ${gauge0_max_steps};
|
|
const float clamped = std::max(min_value, std::min(max_value, x));
|
|
int steps = 0;
|
|
if (max_value > min_value) {
|
|
const float fraction = (clamped - min_value) / (max_value - min_value);
|
|
steps = static_cast<int>(lroundf(fraction * max_steps));
|
|
}
|
|
id(gauge0_target_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SET 0 %d\n", steps);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_target_number
|
|
name: "${gauge1_entity_name}"
|
|
unit_of_measurement: "${gauge1_unit}"
|
|
min_value: ${gauge1_min}
|
|
max_value: ${gauge1_max}
|
|
step: ${gauge1_step}
|
|
mode: slider
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge1_min}
|
|
set_action:
|
|
- lambda: |-
|
|
const float min_value = ${gauge1_min};
|
|
const float max_value = ${gauge1_max};
|
|
const int max_steps = ${gauge1_max_steps};
|
|
const float clamped = std::max(min_value, std::min(max_value, x));
|
|
int steps = 0;
|
|
if (max_value > min_value) {
|
|
const float fraction = (clamped - min_value) / (max_value - min_value);
|
|
steps = static_cast<int>(lroundf(fraction * max_steps));
|
|
}
|
|
id(gauge1_target_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SET 1 %d\n", steps);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_target_number
|
|
name: "${gauge2_entity_name}"
|
|
unit_of_measurement: "${gauge2_unit}"
|
|
min_value: ${gauge2_min}
|
|
max_value: ${gauge2_max}
|
|
step: ${gauge2_step}
|
|
mode: slider
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge2_min}
|
|
set_action:
|
|
- lambda: |-
|
|
const float min_value = ${gauge2_min};
|
|
const float max_value = ${gauge2_max};
|
|
const int max_steps = ${gauge2_max_steps};
|
|
const float clamped = std::max(min_value, std::min(max_value, x));
|
|
int steps = 0;
|
|
if (max_value > min_value) {
|
|
const float fraction = (clamped - min_value) / (max_value - min_value);
|
|
steps = static_cast<int>(lroundf(fraction * max_steps));
|
|
}
|
|
id(gauge2_target_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SET 2 %d\n", steps);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_target_number
|
|
name: "${gauge3_entity_name}"
|
|
unit_of_measurement: "${gauge3_unit}"
|
|
min_value: ${gauge3_min}
|
|
max_value: ${gauge3_max}
|
|
step: ${gauge3_step}
|
|
mode: slider
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge3_min}
|
|
set_action:
|
|
- lambda: |-
|
|
const float min_value = ${gauge3_min};
|
|
const float max_value = ${gauge3_max};
|
|
const int max_steps = ${gauge3_max_steps};
|
|
const float clamped = std::max(min_value, std::min(max_value, x));
|
|
int steps = 0;
|
|
if (max_value > min_value) {
|
|
const float fraction = (clamped - min_value) / (max_value - min_value);
|
|
steps = static_cast<int>(lroundf(fraction * max_steps));
|
|
}
|
|
id(gauge3_target_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SET 3 %d\n", steps);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_speed_number
|
|
name: "${gauge0_name} Speed"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s"
|
|
min_value: 1
|
|
max_value: 20000
|
|
step: ${gauge0_speed_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge0_default_speed}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge0_speed_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SPEED 0 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_accel_number
|
|
name: "${gauge0_name} Acceleration"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s^2"
|
|
min_value: 1
|
|
max_value: 50000
|
|
step: ${gauge0_accel_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge0_default_accel}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge0_accel_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "ACCEL 0 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_speed_number
|
|
name: "${gauge1_name} Speed"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s"
|
|
min_value: 1
|
|
max_value: 20000
|
|
step: ${gauge1_speed_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge1_default_speed}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge1_speed_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SPEED 1 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_accel_number
|
|
name: "${gauge1_name} Acceleration"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s^2"
|
|
min_value: 1
|
|
max_value: 50000
|
|
step: ${gauge1_accel_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge1_default_accel}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge1_accel_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "ACCEL 1 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_speed_number
|
|
name: "${gauge2_name} Speed"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s"
|
|
min_value: 1
|
|
max_value: 20000
|
|
step: ${gauge2_speed_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge2_default_speed}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge2_speed_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SPEED 2 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_accel_number
|
|
name: "${gauge2_name} Acceleration"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s^2"
|
|
min_value: 1
|
|
max_value: 50000
|
|
step: ${gauge2_accel_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge2_default_accel}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge2_accel_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "ACCEL 2 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_speed_number
|
|
name: "${gauge3_name} Speed"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s"
|
|
min_value: 1
|
|
max_value: 20000
|
|
step: ${gauge3_speed_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge3_default_speed}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge3_speed_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "SPEED 3 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_accel_number
|
|
name: "${gauge3_name} Acceleration"
|
|
entity_category: diagnostic
|
|
unit_of_measurement: "steps/s^2"
|
|
min_value: 1
|
|
max_value: 50000
|
|
step: ${gauge3_accel_step}
|
|
mode: box
|
|
optimistic: true
|
|
restore_value: false
|
|
initial_value: ${gauge3_default_accel}
|
|
set_action:
|
|
- lambda: |-
|
|
const int clamped = std::max(1, static_cast<int>(lroundf(x)));
|
|
id(gauge3_accel_value) = clamped;
|
|
char cmd[24];
|
|
snprintf(cmd, sizeof(cmd), "ACCEL 3 %d\n", clamped);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# VFD controls
|
|
# ---------------------------------------------------------------------------
|
|
|
|
text:
|
|
- platform: template
|
|
id: vfd_display
|
|
name: VFD Display
|
|
mode: text
|
|
optimistic: true
|
|
restore_value: false
|
|
min_length: 0
|
|
max_length: 4
|
|
initial_value: ""
|
|
set_action:
|
|
- lambda: |-
|
|
std::string sanitized;
|
|
sanitized.reserve(4);
|
|
for (char c : x) {
|
|
const char uc = static_cast<char>(toupper(static_cast<unsigned char>(c)));
|
|
if ((uc >= '0' && uc <= '9') || (uc >= 'A' && uc <= 'F') || uc == '-') {
|
|
sanitized.push_back(uc);
|
|
if (sanitized.size() >= 4) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
id(vfd_text_value) = sanitized;
|
|
|
|
std::string cmd = "VFD";
|
|
std::string suffix;
|
|
if (id(vfd_decimal_point_on)) {
|
|
suffix += ".";
|
|
}
|
|
if (id(vfd_alarm_on)) {
|
|
suffix += "!";
|
|
}
|
|
|
|
if (!sanitized.empty()) {
|
|
cmd += " " + sanitized + suffix;
|
|
} else if (!suffix.empty()) {
|
|
cmd += " 0" + suffix;
|
|
}
|
|
cmd += "\n";
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd.c_str());
|
|
id(arduino_uart).write_str(cmd.c_str());
|
|
|
|
switch:
|
|
- platform: template
|
|
id: vfd_decimal_point
|
|
name: VFD Decimal Point
|
|
optimistic: true
|
|
restore_mode: ALWAYS_OFF
|
|
lambda: |-
|
|
return id(vfd_decimal_point_on);
|
|
turn_on_action:
|
|
- lambda: |-
|
|
id(vfd_decimal_point_on) = true;
|
|
std::string cmd = "VFD";
|
|
std::string suffix = ".";
|
|
if (id(vfd_alarm_on)) {
|
|
suffix += "!";
|
|
}
|
|
if (!id(vfd_text_value).empty()) {
|
|
cmd += " " + id(vfd_text_value) + suffix;
|
|
} else {
|
|
cmd += " 0" + suffix;
|
|
}
|
|
cmd += "\n";
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd.c_str());
|
|
id(arduino_uart).write_str(cmd.c_str());
|
|
turn_off_action:
|
|
- lambda: |-
|
|
id(vfd_decimal_point_on) = false;
|
|
std::string cmd = "VFD";
|
|
std::string suffix;
|
|
if (id(vfd_alarm_on)) {
|
|
suffix += "!";
|
|
}
|
|
if (!id(vfd_text_value).empty()) {
|
|
cmd += " " + id(vfd_text_value) + suffix;
|
|
} else if (!suffix.empty()) {
|
|
cmd += " 0" + suffix;
|
|
}
|
|
cmd += "\n";
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd.c_str());
|
|
id(arduino_uart).write_str(cmd.c_str());
|
|
|
|
- platform: template
|
|
id: vfd_alarm
|
|
name: VFD Alarm
|
|
optimistic: true
|
|
restore_mode: ALWAYS_OFF
|
|
lambda: |-
|
|
return id(vfd_alarm_on);
|
|
turn_on_action:
|
|
- lambda: |-
|
|
id(vfd_alarm_on) = true;
|
|
std::string cmd = "VFD";
|
|
std::string suffix;
|
|
if (id(vfd_decimal_point_on)) {
|
|
suffix += ".";
|
|
}
|
|
suffix += "!";
|
|
if (!id(vfd_text_value).empty()) {
|
|
cmd += " " + id(vfd_text_value) + suffix;
|
|
} else {
|
|
cmd += " 0" + suffix;
|
|
}
|
|
cmd += "\n";
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd.c_str());
|
|
id(arduino_uart).write_str(cmd.c_str());
|
|
turn_off_action:
|
|
- lambda: |-
|
|
id(vfd_alarm_on) = false;
|
|
std::string cmd = "VFD";
|
|
std::string suffix;
|
|
if (id(vfd_decimal_point_on)) {
|
|
suffix += ".";
|
|
}
|
|
if (!id(vfd_text_value).empty()) {
|
|
cmd += " " + id(vfd_text_value) + suffix;
|
|
} else if (!suffix.empty()) {
|
|
cmd += " 0" + suffix;
|
|
}
|
|
cmd += "\n";
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd.c_str());
|
|
id(arduino_uart).write_str(cmd.c_str());
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Gauge homing buttons
|
|
# ---------------------------------------------------------------------------
|
|
|
|
button:
|
|
- platform: template
|
|
name: "${gauge0_name} Rezero"
|
|
entity_category: diagnostic
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 0\n"
|
|
|
|
- platform: template
|
|
name: "${gauge1_name} Rezero"
|
|
entity_category: diagnostic
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 1\n"
|
|
|
|
- platform: template
|
|
name: "${gauge2_name} Rezero"
|
|
entity_category: diagnostic
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 2\n"
|
|
|
|
- platform: template
|
|
name: "${gauge3_name} Rezero"
|
|
entity_category: diagnostic
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 3\n"
|
|
|
|
- platform: template
|
|
name: Rezero All Gauges
|
|
entity_category: diagnostic
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOMEALL\n"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Periodic auto-rezero
|
|
# ---------------------------------------------------------------------------
|
|
|
|
interval:
|
|
- interval: 10ms
|
|
then:
|
|
- lambda: |-
|
|
while (id(arduino_uart).available()) {
|
|
uint8_t b;
|
|
id(arduino_uart).read_byte(&b);
|
|
if (b == '\n') {
|
|
std::string &buf = id(uart_rx_buf);
|
|
if (!buf.empty() && buf.back() == '\r') buf.pop_back();
|
|
if (!buf.empty()) ESP_LOGI("uart_rx", "RX: %s", buf.c_str());
|
|
if (!buf.empty() && buf != "OK" && buf != "PONG") {
|
|
if (buf.rfind("POS ", 0) == 0) {
|
|
int gid, cur, tgt, homed, hstate, sweep;
|
|
if (sscanf(buf.c_str(), "POS %d %d %d %d %d %d",
|
|
&gid, &cur, &tgt, &homed, &hstate, &sweep) == 6) {
|
|
float value = 0.0f;
|
|
if (gid == 0) {
|
|
value = ${gauge0_min} + (tgt / (float)${gauge0_max_steps}) * (${gauge0_max} - ${gauge0_min});
|
|
id(gauge0_target_value) = value;
|
|
id(gauge0_target_number).publish_state(value);
|
|
} else if (gid == 1) {
|
|
value = ${gauge1_min} + (tgt / (float)${gauge1_max_steps}) * (${gauge1_max} - ${gauge1_min});
|
|
id(gauge1_target_value) = value;
|
|
id(gauge1_target_number).publish_state(value);
|
|
} else if (gid == 2) {
|
|
value = ${gauge2_min} + (tgt / (float)${gauge2_max_steps}) * (${gauge2_max} - ${gauge2_min});
|
|
id(gauge2_target_value) = value;
|
|
id(gauge2_target_number).publish_state(value);
|
|
} else if (gid == 3) {
|
|
value = ${gauge3_min} + (tgt / (float)${gauge3_max_steps}) * (${gauge3_max} - ${gauge3_min});
|
|
id(gauge3_target_value) = value;
|
|
id(gauge3_target_number).publish_state(value);
|
|
}
|
|
}
|
|
} else if (buf.rfind("CFG ", 0) == 0) {
|
|
int gid, spd, acc;
|
|
if (sscanf(buf.c_str(), "CFG %d %d %d", &gid, &spd, &acc) == 3) {
|
|
if (gid == 0) {
|
|
id(gauge0_speed_value) = spd;
|
|
id(gauge0_accel_value) = acc;
|
|
id(gauge0_speed_number).publish_state(spd);
|
|
id(gauge0_accel_number).publish_state(acc);
|
|
} else if (gid == 1) {
|
|
id(gauge1_speed_value) = spd;
|
|
id(gauge1_accel_value) = acc;
|
|
id(gauge1_speed_number).publish_state(spd);
|
|
id(gauge1_accel_number).publish_state(acc);
|
|
} else if (gid == 2) {
|
|
id(gauge2_speed_value) = spd;
|
|
id(gauge2_accel_value) = acc;
|
|
id(gauge2_speed_number).publish_state(spd);
|
|
id(gauge2_accel_number).publish_state(acc);
|
|
} else if (gid == 3) {
|
|
id(gauge3_speed_value) = spd;
|
|
id(gauge3_accel_value) = acc;
|
|
id(gauge3_speed_number).publish_state(spd);
|
|
id(gauge3_accel_number).publish_state(acc);
|
|
}
|
|
}
|
|
} else {
|
|
id(arduino_last_message).publish_state(buf);
|
|
}
|
|
}
|
|
buf.clear();
|
|
} else if (id(uart_rx_buf).size() < 128) {
|
|
id(uart_rx_buf) += static_cast<char>(b);
|
|
}
|
|
}
|
|
- interval: 30s
|
|
then:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "POS?\n"
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "CFG?\n"
|
|
- interval: ${rezero_interval}
|
|
then:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOMEALL\n"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Gauge light state cache
|
|
# ---------------------------------------------------------------------------
|
|
|
|
globals:
|
|
- id: uart_rx_buf
|
|
type: std::string
|
|
restore_value: no
|
|
initial_value: '""'
|
|
- id: vfd_text_value
|
|
type: std::string
|
|
restore_value: no
|
|
initial_value: '""'
|
|
- id: vfd_decimal_point_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: vfd_alarm_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge0_target_value
|
|
type: float
|
|
restore_value: no
|
|
initial_value: ${gauge0_min}
|
|
- id: gauge1_target_value
|
|
type: float
|
|
restore_value: no
|
|
initial_value: ${gauge1_min}
|
|
- id: gauge2_target_value
|
|
type: float
|
|
restore_value: no
|
|
initial_value: ${gauge2_min}
|
|
- id: gauge3_target_value
|
|
type: float
|
|
restore_value: no
|
|
initial_value: ${gauge3_min}
|
|
- id: gauge0_speed_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge0_default_speed}
|
|
- id: gauge0_accel_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge0_default_accel}
|
|
- id: gauge1_speed_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge1_default_speed}
|
|
- id: gauge1_accel_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge1_default_accel}
|
|
- id: gauge2_speed_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge2_default_speed}
|
|
- id: gauge2_accel_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge2_default_accel}
|
|
- id: gauge3_speed_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge3_default_speed}
|
|
- id: gauge3_accel_value
|
|
type: int
|
|
restore_value: no
|
|
initial_value: ${gauge3_default_accel}
|
|
- id: gauge0_bl_r
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge0_bl_g
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge0_bl_b
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge1_bl_r
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge1_bl_g
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge1_bl_b
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge2_bl_r
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge2_bl_g
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge2_bl_b
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge3_bl_r
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge3_bl_g
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge3_bl_b
|
|
type: int
|
|
restore_value: no
|
|
initial_value: "0"
|
|
- id: gauge0_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge0_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge0_status_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge0_status_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge1_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge1_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge1_status_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge1_status_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge2_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge2_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge2_status_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge2_status_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge3_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge3_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge3_status_red_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
- id: gauge3_status_green_on
|
|
type: bool
|
|
restore_value: no
|
|
initial_value: "false"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Light outputs
|
|
# ---------------------------------------------------------------------------
|
|
|
|
output:
|
|
- platform: template
|
|
id: gauge0_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge0_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge0_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
|
|
- platform: template
|
|
id: gauge0_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge0_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge0_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_status_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge0_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_status_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge1_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge1_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge1_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_status_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge1_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_status_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge2_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge2_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge2_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_status_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge2_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_status_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge3_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge3_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_green_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge3_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_status_red_on) = state;
|
|
|
|
- platform: template
|
|
id: gauge3_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_status_green_on) = state;
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Native HA lights
|
|
# ---------------------------------------------------------------------------
|
|
|
|
light:
|
|
- platform: rgb
|
|
id: gauge0_backlight
|
|
name: "${gauge0_name} Backlight"
|
|
red: gauge0_backlight_red_output
|
|
green: gauge0_backlight_green_output
|
|
blue: gauge0_backlight_blue_output
|
|
default_transition_length: 0s
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 0 0-2 800 800 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 0 0-2 150 150 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 0 0-2 100 400 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 0 0-2 3000 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 0 0-2 1200 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge0_backlight).get_effect_name();
|
|
if (effect != "None" && !effect.empty()) return;
|
|
auto& rv = id(gauge0_backlight).remote_values;
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 0 0-2 %d %d %d\n",
|
|
rv.is_on() ? static_cast<int>(rv.get_red() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_green() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_blue() * rv.get_brightness() * 255.0f + 0.5f) : 0);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge0_red_indicator
|
|
name: "${gauge0_name} Red Indicator"
|
|
output: gauge0_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 0 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_red_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 0 3 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 0 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 0 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 0 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 0 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 0 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 0 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 0 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_green_indicator
|
|
name: "${gauge0_name} Green Indicator"
|
|
output: gauge0_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 0 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_green_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 0 4 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 0 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 0 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 0 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 0 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 0 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 0 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 0 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_status_red
|
|
name: "${gauge0_name} Status Red"
|
|
output: gauge0_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 0 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_status_red).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 0 5 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 0 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 0 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 0 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 0 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 0 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 0 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 0 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_status_green
|
|
name: "${gauge0_name} Status Green"
|
|
output: gauge0_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 0 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 0 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 0 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_status_green).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 0 6 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 0 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 0 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 0 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 0 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 0 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 0 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 0 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge1_backlight
|
|
name: "${gauge1_name} Backlight"
|
|
red: gauge1_backlight_red_output
|
|
green: gauge1_backlight_green_output
|
|
blue: gauge1_backlight_blue_output
|
|
default_transition_length: 0s
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 1 0-2 800 800 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 1 0-2 150 150 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 1 0-2 100 400 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 1 0-2 3000 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 1 0-2 1200 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge1_backlight).get_effect_name();
|
|
if (effect != "None" && !effect.empty()) return;
|
|
auto& rv = id(gauge1_backlight).remote_values;
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 1 0-2 %d %d %d\n",
|
|
rv.is_on() ? static_cast<int>(rv.get_red() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_green() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_blue() * rv.get_brightness() * 255.0f + 0.5f) : 0);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge1_red_indicator
|
|
name: "${gauge1_name} Red Indicator"
|
|
output: gauge1_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 1 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_red_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 1 3 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 1 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 1 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 1 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 1 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 1 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 1 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 1 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_green_indicator
|
|
name: "${gauge1_name} Green Indicator"
|
|
output: gauge1_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 1 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_green_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 1 4 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 1 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 1 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 1 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 1 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 1 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 1 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 1 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_status_red
|
|
name: "${gauge1_name} Status Red"
|
|
output: gauge1_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 1 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_status_red).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 1 5 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 1 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 1 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 1 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 1 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 1 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 1 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 1 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_status_green
|
|
name: "${gauge1_name} Status Green"
|
|
output: gauge1_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 1 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 1 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 1 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_status_green).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 1 6 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 1 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 1 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 1 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 1 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 1 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 1 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 1 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge2_backlight
|
|
name: "${gauge2_name} Backlight"
|
|
red: gauge2_backlight_red_output
|
|
green: gauge2_backlight_green_output
|
|
blue: gauge2_backlight_blue_output
|
|
default_transition_length: 0s
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 2 0-2 800 800 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 2 0-2 150 150 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 2 0-2 100 400 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 2 0-2 3000 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 2 0-2 1200 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge2_backlight).get_effect_name();
|
|
if (effect != "None" && !effect.empty()) return;
|
|
auto& rv = id(gauge2_backlight).remote_values;
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 2 0-2 %d %d %d\n",
|
|
rv.is_on() ? static_cast<int>(rv.get_red() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_green() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_blue() * rv.get_brightness() * 255.0f + 0.5f) : 0);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge2_red_indicator
|
|
name: "${gauge2_name} Red Indicator"
|
|
output: gauge2_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 2 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_red_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 2 3 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 2 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 2 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 2 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 2 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 2 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 2 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 2 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_green_indicator
|
|
name: "${gauge2_name} Green Indicator"
|
|
output: gauge2_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 2 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_green_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 2 4 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 2 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 2 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 2 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 2 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 2 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 2 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 2 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_status_red
|
|
name: "${gauge2_name} Status Red"
|
|
output: gauge2_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 2 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_status_red).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 2 5 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 2 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 2 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 2 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 2 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 2 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 2 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 2 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_status_green
|
|
name: "${gauge2_name} Status Green"
|
|
output: gauge2_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 2 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 2 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 2 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_status_green).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 2 6 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 2 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 2 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 2 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 2 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 2 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 2 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 2 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge3_backlight
|
|
name: "${gauge3_name} Backlight"
|
|
red: gauge3_backlight_red_output
|
|
green: gauge3_backlight_green_output
|
|
blue: gauge3_backlight_blue_output
|
|
default_transition_length: 0s
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 3 0-2 800 800 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 3 0-2 150 150 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[36];
|
|
snprintf(cmd, sizeof(cmd), "BLINK 3 0-2 100 400 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 3 0-2 3000 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[34];
|
|
snprintf(cmd, sizeof(cmd), "BREATHE 3 0-2 1200 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge3_backlight).get_effect_name();
|
|
if (effect != "None" && !effect.empty()) return;
|
|
auto& rv = id(gauge3_backlight).remote_values;
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 3 0-2 %d %d %d\n",
|
|
rv.is_on() ? static_cast<int>(rv.get_red() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_green() * rv.get_brightness() * 255.0f + 0.5f) : 0,
|
|
rv.is_on() ? static_cast<int>(rv.get_blue() * rv.get_brightness() * 255.0f + 0.5f) : 0);
|
|
ESP_LOGI("uart_tx", "TX: %s", cmd);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge3_red_indicator
|
|
name: "${gauge3_name} Red Indicator"
|
|
output: gauge3_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 3 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_red_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 3 3 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 3 3 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 3 3 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 3 3 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 3 3 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 3 3 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 3 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 3 3 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_green_indicator
|
|
name: "${gauge3_name} Green Indicator"
|
|
output: gauge3_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 3 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_green_indicator).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 3 4 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 3 4 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 3 4 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 3 4 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 3 4 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 3 4 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 3 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 3 4 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_status_red
|
|
name: "${gauge3_name} Status Red"
|
|
output: gauge3_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 3 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_status_red).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 3 5 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 3 5 800 800 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 3 5 150 150 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 3 5 100 400 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 3 5 3000 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 3 5 1200 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 3 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 3 5 255 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_status_green
|
|
name: "${gauge3_name} Status Green"
|
|
output: gauge3_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BLINK 3 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "BREATHE 3 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 3600s
|
|
lambda: |-
|
|
{ const char* cmd = "DFLASH 3 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_status_green).remote_values.is_on()) {
|
|
{ const char* cmd = "LED 3 6 0 0 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
{ const char* cmd = "BLINK 3 6 800 800 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Fast") {
|
|
{ const char* cmd = "BLINK 3 6 150 150 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Blink Alert") {
|
|
{ const char* cmd = "BLINK 3 6 100 400 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Slow") {
|
|
{ const char* cmd = "BREATHE 3 6 3000 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Breathe Fast") {
|
|
{ const char* cmd = "BREATHE 3 6 1200 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else if (effect == "Double Flash") {
|
|
{ const char* cmd = "DFLASH 3 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
} else {
|
|
{ const char* cmd = "LED 3 6 0 255 0\n"; ESP_LOGI("uart_tx", "TX: %s", cmd); id(arduino_uart).write_str(cmd); }
|
|
}
|