esphome device updates

This commit is contained in:
root
2025-09-20 15:18:46 +12:00
parent a27b79fbd9
commit 1e1d0571d9
32 changed files with 3756 additions and 1188 deletions
+56 -2
View File
@@ -153,6 +153,60 @@ logger:
#esp8266_store_log_strings_in_flash: false
#tx_buffer_size: 64
##########################################################################################
# UART: Fan MCU / RF Remote Sniff (iFan02 -> ESP over UART0)
# - Uses GPIO3 (RX0) to listen to the fan microcontroller frames (433 MHz remote is decoded there)
# - 9600 8N1 is typical; if no frames appear, try 19200 (uncomment below)
# - If still nothing, some revisions route MCU TX to another pin; try rx_pin: GPIO13
##########################################################################################
uart:
id: ifan_uart
tx_pin: GPIO1 # ESP TX0 -> Fan MCU RX (not required for sniffing, but harmless)
rx_pin: GPIO3 # ESP RX0 <- Fan MCU TX (primary source for RF button frames)
baud_rate: 9600
#baud_rate: 19200 # <-- try this if you see no frames in logs
rx_buffer_size: 256
# NOTE: If no frames appear at either 9600 or 19200, try moving rx_pin to GPIO13 and reflash:
# rx_pin: GPIO13
##########################################################################################
# INTERVAL: Accumulate UART bytes and publish last frame to text sensor
# - Publishes after ~60ms of silence to group a single button press into one frame
##########################################################################################
interval:
- interval: 50ms
then:
- lambda: |-
static std::string frame;
static uint32_t last = 0;
uint8_t b;
while (id(ifan_uart).available()) {
if (id(ifan_uart).read_byte(&b)) {
char buf[4];
sprintf(buf, "%02X", b);
frame += buf;
frame += " ";
last = millis();
} else {
break;
}
}
if (!frame.empty() && (millis() - last > 60)) {
ESP_LOGI("ifan02", "MCU frame: %s", frame.c_str());
id(ifan_last_rf).publish_state(frame.c_str());
frame.clear();
}
##########################################################################################
# TEXT SENSORS: RF/MCU debug output (last frame seen)
# - Shows the last raw hex bytes received from the fan MCU when you press the RF remote
##########################################################################################
text_sensor:
- platform: template
id: ifan_last_rf
name: "iFan02 Remote Last Frame"
update_interval: never
##########################################################################################
# MQTT COMMANDS
# This adds device-specific MQTT command triggers to the common MQTT configuration.
@@ -371,11 +425,11 @@ fan:
# whenever the fan goes off→on (e.g. via HAs Fan switch):
on_turn_on:
- lambda: |-
// bump 01 if we were off
// bump 0->1 if we were off
if (id(speed_value) == 0) id(speed_value) = 1;
- fan.turn_on:
id: ifan02_fan
speed: !lambda 'return id(speed_value);'
- mqtt.publish:
topic: "${mqtt_local_status_topic}/speed/state"
payload: !lambda 'return to_string(id(speed_value));'
payload: !lambda 'return to_string(id(speed_value));'