2470 lines
82 KiB
YAML
2470 lines
82 KiB
YAML
substitutions:
|
|
# --- Device identity ---
|
|
device_name: gauge_controller
|
|
device_friendly_name: Selsyn Multi
|
|
device_area: Control Panels
|
|
|
|
# --- WiFi ---
|
|
wifi_ssid: MyNetwork
|
|
wifi_password: MyPassword
|
|
|
|
# --- Arduino UART bridge ---
|
|
arduino_tx_pin: GPIO17
|
|
arduino_rx_pin: GPIO16
|
|
arduino_baud: "38400"
|
|
|
|
# --- Gauge 1 ---
|
|
gauge0_entity_name: Selsyn 1 Power
|
|
gauge0_min: "0.0"
|
|
gauge0_max: "7300.0"
|
|
gauge0_max_steps: "4000"
|
|
gauge0_unit: W
|
|
gauge0_step: "1.0"
|
|
gauge0_speed_step: "100"
|
|
gauge0_accel_step: "100"
|
|
gauge0_default_speed: "5000"
|
|
gauge0_default_accel: "6000"
|
|
|
|
# --- Gauge 2 ---
|
|
gauge1_entity_name: Selsyn 2 Power
|
|
gauge1_min: "0.0"
|
|
gauge1_max: "7300.0"
|
|
gauge1_max_steps: "4000"
|
|
gauge1_unit: W
|
|
gauge1_step: "1.0"
|
|
gauge1_speed_step: "100"
|
|
gauge1_accel_step: "100"
|
|
gauge1_default_speed: "5000"
|
|
gauge1_default_accel: "6000"
|
|
|
|
# --- Gauge 3 ---
|
|
gauge2_entity_name: Selsyn 3 Power
|
|
gauge2_min: "0.0"
|
|
gauge2_max: "7300.0"
|
|
gauge2_max_steps: "4000"
|
|
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_entity_name: Selsyn 4 Power
|
|
gauge3_min: "0.0"
|
|
gauge3_max: "7300.0"
|
|
gauge3_max_steps: "4000"
|
|
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"
|
|
|
|
esp32:
|
|
board: esp32dev
|
|
framework:
|
|
type: arduino
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Logging (set level: NONE in production)
|
|
# ---------------------------------------------------------------------------
|
|
|
|
logger:
|
|
level: INFO
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 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}
|
|
ap:
|
|
ssid: "${device_name} Fallback"
|
|
password: "esphomefb"
|
|
|
|
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
|
|
on_data:
|
|
- lambda: |-
|
|
for (uint8_t b : x) {
|
|
if (b == '\n') {
|
|
std::string &buf = id(uart_rx_buf);
|
|
if (!buf.empty() && buf.back() == '\r') buf.pop_back();
|
|
if (!buf.empty() && buf != "OK" && buf != "PONG") {
|
|
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);
|
|
}
|
|
}
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 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_entity_name} Target"
|
|
lambda: |-
|
|
return id(gauge0_target_value);
|
|
unit_of_measurement: "${gauge0_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge1_entity_name} Target"
|
|
lambda: |-
|
|
return id(gauge1_target_value);
|
|
unit_of_measurement: "${gauge1_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge2_entity_name} Target"
|
|
lambda: |-
|
|
return id(gauge2_target_value);
|
|
unit_of_measurement: "${gauge2_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge3_entity_name} Target"
|
|
lambda: |-
|
|
return id(gauge3_target_value);
|
|
unit_of_measurement: "${gauge3_unit}"
|
|
accuracy_decimals: 1
|
|
update_interval: 5s
|
|
|
|
- platform: template
|
|
name: "${gauge0_entity_name} Speed"
|
|
lambda: |-
|
|
return id(gauge0_speed_value);
|
|
unit_of_measurement: "steps/s"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge0_entity_name} Acceleration"
|
|
lambda: |-
|
|
return id(gauge0_accel_value);
|
|
unit_of_measurement: "steps/s^2"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge1_entity_name} Speed"
|
|
lambda: |-
|
|
return id(gauge1_speed_value);
|
|
unit_of_measurement: "steps/s"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge1_entity_name} Acceleration"
|
|
lambda: |-
|
|
return id(gauge1_accel_value);
|
|
unit_of_measurement: "steps/s^2"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge2_entity_name} Speed"
|
|
lambda: |-
|
|
return id(gauge2_speed_value);
|
|
unit_of_measurement: "steps/s"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge2_entity_name} Acceleration"
|
|
lambda: |-
|
|
return id(gauge2_accel_value);
|
|
unit_of_measurement: "steps/s^2"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge3_entity_name} Speed"
|
|
lambda: |-
|
|
return id(gauge3_speed_value);
|
|
unit_of_measurement: "steps/s"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
- platform: template
|
|
name: "${gauge3_entity_name} Acceleration"
|
|
lambda: |-
|
|
return id(gauge3_accel_value);
|
|
unit_of_measurement: "steps/s^2"
|
|
accuracy_decimals: 0
|
|
update_interval: 5s
|
|
entity_category: config
|
|
|
|
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: box
|
|
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);
|
|
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: box
|
|
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);
|
|
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: box
|
|
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);
|
|
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: box
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_speed_number
|
|
name: "${gauge0_entity_name} Speed"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_accel_number
|
|
name: "${gauge0_entity_name} Acceleration"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_speed_number
|
|
name: "${gauge1_entity_name} Speed"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_accel_number
|
|
name: "${gauge1_entity_name} Acceleration"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_speed_number
|
|
name: "${gauge2_entity_name} Speed"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_accel_number
|
|
name: "${gauge2_entity_name} Acceleration"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_speed_number
|
|
name: "${gauge3_entity_name} Speed"
|
|
entity_category: config
|
|
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);
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_accel_number
|
|
name: "${gauge3_entity_name} Acceleration"
|
|
entity_category: config
|
|
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);
|
|
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";
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
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";
|
|
id(arduino_uart).write_str(cmd);
|
|
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";
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- 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";
|
|
id(arduino_uart).write_str(cmd);
|
|
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";
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Gauge homing buttons
|
|
# ---------------------------------------------------------------------------
|
|
|
|
button:
|
|
- platform: template
|
|
name: "${gauge0_entity_name} Rezero"
|
|
entity_category: config
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 0\n"
|
|
|
|
- platform: template
|
|
name: "${gauge1_entity_name} Rezero"
|
|
entity_category: config
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 1\n"
|
|
|
|
- platform: template
|
|
name: "${gauge2_entity_name} Rezero"
|
|
entity_category: config
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 2\n"
|
|
|
|
- platform: template
|
|
name: "${gauge3_entity_name} Rezero"
|
|
entity_category: config
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOME 3\n"
|
|
|
|
- platform: template
|
|
name: Rezero All Gauges
|
|
entity_category: config
|
|
on_press:
|
|
- uart.write:
|
|
id: arduino_uart
|
|
data: "HOMEALL\n"
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Periodic auto-rezero
|
|
# ---------------------------------------------------------------------------
|
|
|
|
interval:
|
|
- 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);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge1_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge2_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_red_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_r) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_green_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_g) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge3_backlight_blue_output
|
|
type: float
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_bl_b) = static_cast<int>(state * 255.0f + 0.5f);
|
|
char cmd[32];
|
|
snprintf(cmd, sizeof(cmd), "LED 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: template
|
|
id: gauge0_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 0 3 255 0 0\n" : "LED 0 3 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge0_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 0 4 0 255 0\n" : "LED 0 4 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge0_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_status_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 0 5 255 0 0\n" : "LED 0 5 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge0_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge0_status_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 0 6 0 255 0\n" : "LED 0 6 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge1_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 1 3 255 0 0\n" : "LED 1 3 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge1_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 1 4 0 255 0\n" : "LED 1 4 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge1_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_status_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 1 5 255 0 0\n" : "LED 1 5 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge1_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge1_status_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 1 6 0 255 0\n" : "LED 1 6 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge2_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 2 3 255 0 0\n" : "LED 2 3 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge2_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 2 4 0 255 0\n" : "LED 2 4 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge2_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_status_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 2 5 255 0 0\n" : "LED 2 5 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge2_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge2_status_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 2 6 0 255 0\n" : "LED 2 6 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge3_red_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 3 3 255 0 0\n" : "LED 3 3 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge3_green_indicator_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 3 4 0 255 0\n" : "LED 3 4 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge3_status_red_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_status_red_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 3 5 255 0 0\n" : "LED 3 5 0 0 0\n");
|
|
|
|
- platform: template
|
|
id: gauge3_status_green_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
id(gauge3_status_green_on) = state;
|
|
id(arduino_uart).write_str(state ? "LED 3 6 0 255 0\n" : "LED 3 6 0 0 0\n");
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Native HA lights
|
|
# ---------------------------------------------------------------------------
|
|
|
|
light:
|
|
- platform: rgb
|
|
id: gauge0_backlight
|
|
name: "${gauge0_entity_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: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge0_backlight).get_effect_name();
|
|
char cmd[36];
|
|
if (effect == "Blink Slow") {
|
|
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));
|
|
} else if (effect == "Blink Fast") {
|
|
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));
|
|
} else if (effect == "Blink Alert") {
|
|
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));
|
|
} else if (effect == "Breathe Slow") {
|
|
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));
|
|
} else if (effect == "Breathe Fast") {
|
|
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));
|
|
} else if (effect == "Double Flash") {
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
} else {
|
|
snprintf(cmd, sizeof(cmd), "LED 0 0-2 %d %d %d\n",
|
|
id(gauge0_bl_r), id(gauge0_bl_g), id(gauge0_bl_b));
|
|
}
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge0_red_indicator
|
|
name: "${gauge0_entity_name} Red Indicator"
|
|
output: gauge0_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 3 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 3 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 3 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 3 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 3 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 0 3 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_red_on)) {
|
|
id(arduino_uart).write_str("LED 0 3 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 0 3 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 0 3 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 0 3 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 0 3 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 0 3 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 0 3 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 0 3 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_green_indicator
|
|
name: "${gauge0_entity_name} Green Indicator"
|
|
output: gauge0_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 4 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 4 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 4 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 4 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 4 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 0 4 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_green_on)) {
|
|
id(arduino_uart).write_str("LED 0 4 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 0 4 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 0 4 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 0 4 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 0 4 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 0 4 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 0 4 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 0 4 0 255 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_status_red
|
|
name: "${gauge0_entity_name} Status Red"
|
|
output: gauge0_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 5 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 5 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 5 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 5 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 5 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 0 5 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_status_red_on)) {
|
|
id(arduino_uart).write_str("LED 0 5 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 0 5 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 0 5 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 0 5 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 0 5 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 0 5 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 0 5 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 0 5 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge0_status_green
|
|
name: "${gauge0_entity_name} Status Green"
|
|
output: gauge0_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 6 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 6 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 0 6 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 6 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 0 6 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 0 6 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge0_status_green_on)) {
|
|
id(arduino_uart).write_str("LED 0 6 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge0_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 0 6 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 0 6 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 0 6 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 0 6 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 0 6 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 0 6 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 0 6 0 255 0\n");
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge1_backlight
|
|
name: "${gauge1_entity_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: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge1_backlight).get_effect_name();
|
|
char cmd[36];
|
|
if (effect == "Blink Slow") {
|
|
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));
|
|
} else if (effect == "Blink Fast") {
|
|
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));
|
|
} else if (effect == "Blink Alert") {
|
|
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));
|
|
} else if (effect == "Breathe Slow") {
|
|
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));
|
|
} else if (effect == "Breathe Fast") {
|
|
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));
|
|
} else if (effect == "Double Flash") {
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
} else {
|
|
snprintf(cmd, sizeof(cmd), "LED 1 0-2 %d %d %d\n",
|
|
id(gauge1_bl_r), id(gauge1_bl_g), id(gauge1_bl_b));
|
|
}
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge1_red_indicator
|
|
name: "${gauge1_entity_name} Red Indicator"
|
|
output: gauge1_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 3 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 3 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 3 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 3 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 3 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 1 3 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_red_on)) {
|
|
id(arduino_uart).write_str("LED 1 3 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 1 3 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 1 3 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 1 3 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 1 3 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 1 3 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 1 3 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 1 3 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_green_indicator
|
|
name: "${gauge1_entity_name} Green Indicator"
|
|
output: gauge1_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 4 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 4 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 4 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 4 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 4 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 1 4 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_green_on)) {
|
|
id(arduino_uart).write_str("LED 1 4 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 1 4 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 1 4 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 1 4 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 1 4 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 1 4 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 1 4 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 1 4 0 255 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_status_red
|
|
name: "${gauge1_entity_name} Status Red"
|
|
output: gauge1_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 5 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 5 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 5 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 5 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 5 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 1 5 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_status_red_on)) {
|
|
id(arduino_uart).write_str("LED 1 5 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 1 5 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 1 5 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 1 5 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 1 5 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 1 5 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 1 5 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 1 5 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge1_status_green
|
|
name: "${gauge1_entity_name} Status Green"
|
|
output: gauge1_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 6 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 6 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 1 6 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 6 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 1 6 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 1 6 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge1_status_green_on)) {
|
|
id(arduino_uart).write_str("LED 1 6 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge1_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 1 6 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 1 6 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 1 6 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 1 6 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 1 6 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 1 6 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 1 6 0 255 0\n");
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge2_backlight
|
|
name: "${gauge2_entity_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: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge2_backlight).get_effect_name();
|
|
char cmd[36];
|
|
if (effect == "Blink Slow") {
|
|
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));
|
|
} else if (effect == "Blink Fast") {
|
|
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));
|
|
} else if (effect == "Blink Alert") {
|
|
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));
|
|
} else if (effect == "Breathe Slow") {
|
|
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));
|
|
} else if (effect == "Breathe Fast") {
|
|
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));
|
|
} else if (effect == "Double Flash") {
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
} else {
|
|
snprintf(cmd, sizeof(cmd), "LED 2 0-2 %d %d %d\n",
|
|
id(gauge2_bl_r), id(gauge2_bl_g), id(gauge2_bl_b));
|
|
}
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge2_red_indicator
|
|
name: "${gauge2_entity_name} Red Indicator"
|
|
output: gauge2_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 3 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 3 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 3 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 3 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 3 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 2 3 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_red_on)) {
|
|
id(arduino_uart).write_str("LED 2 3 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 2 3 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 2 3 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 2 3 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 2 3 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 2 3 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 2 3 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 2 3 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_green_indicator
|
|
name: "${gauge2_entity_name} Green Indicator"
|
|
output: gauge2_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 4 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 4 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 4 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 4 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 4 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 2 4 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_green_on)) {
|
|
id(arduino_uart).write_str("LED 2 4 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 2 4 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 2 4 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 2 4 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 2 4 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 2 4 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 2 4 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 2 4 0 255 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_status_red
|
|
name: "${gauge2_entity_name} Status Red"
|
|
output: gauge2_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 5 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 5 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 5 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 5 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 5 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 2 5 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_status_red_on)) {
|
|
id(arduino_uart).write_str("LED 2 5 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 2 5 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 2 5 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 2 5 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 2 5 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 2 5 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 2 5 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 2 5 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge2_status_green
|
|
name: "${gauge2_entity_name} Status Green"
|
|
output: gauge2_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 6 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 6 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 2 6 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 6 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 2 6 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 2 6 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge2_status_green_on)) {
|
|
id(arduino_uart).write_str("LED 2 6 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge2_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 2 6 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 2 6 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 2 6 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 2 6 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 2 6 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 2 6 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 2 6 0 255 0\n");
|
|
}
|
|
|
|
- platform: rgb
|
|
id: gauge3_backlight
|
|
name: "${gauge3_entity_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: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
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));
|
|
id(arduino_uart).write_str(cmd);
|
|
on_state:
|
|
- lambda: |-
|
|
auto effect = id(gauge3_backlight).get_effect_name();
|
|
char cmd[36];
|
|
if (effect == "Blink Slow") {
|
|
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));
|
|
} else if (effect == "Blink Fast") {
|
|
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));
|
|
} else if (effect == "Blink Alert") {
|
|
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));
|
|
} else if (effect == "Breathe Slow") {
|
|
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));
|
|
} else if (effect == "Breathe Fast") {
|
|
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));
|
|
} else if (effect == "Double Flash") {
|
|
snprintf(cmd, sizeof(cmd), "DFLASH 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
} else {
|
|
snprintf(cmd, sizeof(cmd), "LED 3 0-2 %d %d %d\n",
|
|
id(gauge3_bl_r), id(gauge3_bl_g), id(gauge3_bl_b));
|
|
}
|
|
id(arduino_uart).write_str(cmd);
|
|
|
|
- platform: binary
|
|
id: gauge3_red_indicator
|
|
name: "${gauge3_entity_name} Red Indicator"
|
|
output: gauge3_red_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 3 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 3 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 3 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 3 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 3 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 3 3 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_red_on)) {
|
|
id(arduino_uart).write_str("LED 3 3 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_red_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 3 3 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 3 3 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 3 3 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 3 3 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 3 3 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 3 3 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 3 3 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_green_indicator
|
|
name: "${gauge3_entity_name} Green Indicator"
|
|
output: gauge3_green_indicator_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 4 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 4 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 4 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 4 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 4 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 3 4 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_green_on)) {
|
|
id(arduino_uart).write_str("LED 3 4 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_green_indicator).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 3 4 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 3 4 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 3 4 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 3 4 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 3 4 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 3 4 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 3 4 0 255 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_status_red
|
|
name: "${gauge3_entity_name} Status Red"
|
|
output: gauge3_status_red_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 5 800 800 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 5 150 150 255 0 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 5 100 400 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 5 3000 255 0 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 5 1200 255 0 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 3 5 255 0 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_status_red_on)) {
|
|
id(arduino_uart).write_str("LED 3 5 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_status_red).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 3 5 800 800 255 0 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 3 5 150 150 255 0 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 3 5 100 400 255 0 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 3 5 3000 255 0 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 3 5 1200 255 0 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 3 5 255 0 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 3 5 255 0 0\n");
|
|
}
|
|
|
|
- platform: binary
|
|
id: gauge3_status_green
|
|
name: "${gauge3_entity_name} Status Green"
|
|
output: gauge3_status_green_output
|
|
restore_mode: ALWAYS_OFF
|
|
effects:
|
|
- lambda:
|
|
name: Blink Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 6 800 800 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 6 150 150 0 255 0\n");
|
|
- lambda:
|
|
name: Blink Alert
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BLINK 3 6 100 400 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Slow
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 6 3000 0 255 0\n");
|
|
- lambda:
|
|
name: Breathe Fast
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("BREATHE 3 6 1200 0 255 0\n");
|
|
- lambda:
|
|
name: Double Flash
|
|
update_interval: 750ms
|
|
lambda: |-
|
|
id(arduino_uart).write_str("DFLASH 3 6 0 255 0\n");
|
|
on_state:
|
|
- lambda: |-
|
|
if (!id(gauge3_status_green_on)) {
|
|
id(arduino_uart).write_str("LED 3 6 0 0 0\n");
|
|
return;
|
|
}
|
|
auto effect = id(gauge3_status_green).get_effect_name();
|
|
if (effect == "Blink Slow") {
|
|
id(arduino_uart).write_str("BLINK 3 6 800 800 0 255 0\n");
|
|
} else if (effect == "Blink Fast") {
|
|
id(arduino_uart).write_str("BLINK 3 6 150 150 0 255 0\n");
|
|
} else if (effect == "Blink Alert") {
|
|
id(arduino_uart).write_str("BLINK 3 6 100 400 0 255 0\n");
|
|
} else if (effect == "Breathe Slow") {
|
|
id(arduino_uart).write_str("BREATHE 3 6 3000 0 255 0\n");
|
|
} else if (effect == "Breathe Fast") {
|
|
id(arduino_uart).write_str("BREATHE 3 6 1200 0 255 0\n");
|
|
} else if (effect == "Double Flash") {
|
|
id(arduino_uart).write_str("DFLASH 3 6 0 255 0\n");
|
|
} else {
|
|
id(arduino_uart).write_str("LED 3 6 0 255 0\n");
|
|
}
|