Refactor logging level in voice assistant configuration: Change from WARN to DEBUG for improved troubleshooting

This commit is contained in:
Joshua King
2026-03-01 17:32:46 -05:00
parent b976b7f133
commit 9a91f775c9
2 changed files with 75 additions and 84 deletions

View File

@@ -119,6 +119,7 @@ touchscreen:
y_min: 340 y_min: 340
y_max: 3860 y_max: 3860
on_touch: on_touch:
# Wake backlight if off
- lambda: |- - lambda: |-
id(last_interaction_ms) = millis(); id(last_interaction_ms) = millis();
if (!id(backlight_is_on)) { if (!id(backlight_is_on)) {
@@ -126,23 +127,73 @@ touchscreen:
call.perform(); call.perform();
id(backlight_is_on) = true; id(backlight_is_on) = true;
} }
ESP_LOGD("touch", "Touch at x=%d, y=%d", touch.x, touch.y);
int tx = touch.x; # Button 1: Toggle All (top-left)
int ty = touch.y; - if:
ESP_LOGD("touch", "Touch at x=%d, y=%d", tx, ty); condition:
lambda: 'return touch.x >= 20 && touch.x <= 150 && touch.y >= 50 && touch.y <= 130;'
if (tx >= 20 && tx <= 150 && ty >= 50 && ty <= 130) { then:
id(touch_all) = true; - lambda: |-
} ESP_LOGD("touch", "Toggle All pressed");
else if (tx >= 170 && tx <= 300 && ty >= 50 && ty <= 130) { id(light1_state) = !id(light1_state);
id(touch_light1) = true; id(light2_state) = !id(light2_state);
} id(fan_state) = !id(fan_state);
else if (tx >= 20 && tx <= 150 && ty >= 150 && ty <= 230) { id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);
id(touch_light2) = true; - homeassistant.service:
} service: switch.toggle
else if (tx >= 170 && tx <= 300 && ty >= 150 && ty <= 230) { data:
id(touch_fan) = true; entity_id: ${light_1_entity}
} - homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_2_entity}
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${fan_entity}
- component.update: my_display
# Button 2: Polly's Light (top-right)
- if:
condition:
lambda: 'return touch.x >= 170 && touch.x <= 300 && touch.y >= 50 && touch.y <= 130;'
then:
- lambda: |-
ESP_LOGD("touch", "Polly's Light pressed");
id(light1_state) = !id(light1_state);
id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_1_entity}
- component.update: my_display
# Button 3: Joshua's Light (bottom-left)
- if:
condition:
lambda: 'return touch.x >= 20 && touch.x <= 150 && touch.y >= 150 && touch.y <= 230;'
then:
- lambda: |-
ESP_LOGD("touch", "Joshua's Light pressed");
id(light2_state) = !id(light2_state);
id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_2_entity}
- component.update: my_display
# Button 4: Ceiling Fan (bottom-right)
- if:
condition:
lambda: 'return touch.x >= 170 && touch.x <= 300 && touch.y >= 150 && touch.y <= 230;'
then:
- lambda: |-
ESP_LOGD("touch", "Ceiling Fan pressed");
id(fan_state) = !id(fan_state);
id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${fan_entity}
- component.update: my_display
# Backlight control # Backlight control
output: output:
@@ -180,18 +231,6 @@ globals:
- id: fan_state - id: fan_state
type: bool type: bool
initial_value: "false" initial_value: "false"
- id: touch_all
type: bool
initial_value: "false"
- id: touch_light1
type: bool
initial_value: "false"
- id: touch_light2
type: bool
initial_value: "false"
- id: touch_fan
type: bool
initial_value: "false"
- id: last_interaction_ms - id: last_interaction_ms
type: uint32_t type: uint32_t
initial_value: "0" initial_value: "0"
@@ -199,7 +238,7 @@ globals:
type: bool type: bool
initial_value: "true" initial_value: "true"
# Process touch events # Backlight timeout
interval: interval:
- interval: 100ms - interval: 100ms
then: then:
@@ -209,54 +248,6 @@ interval:
then: then:
- light.turn_off: backlight - light.turn_off: backlight
- lambda: 'id(backlight_is_on) = false;' - lambda: 'id(backlight_is_on) = false;'
- if:
condition:
lambda: 'return id(touch_all);'
then:
- lambda: 'id(touch_all) = false;'
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_1_entity}
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_2_entity}
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${fan_entity}
- component.update: my_display
- if:
condition:
lambda: 'return id(touch_light1);'
then:
- lambda: 'id(touch_light1) = false;'
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_1_entity}
- component.update: my_display
- if:
condition:
lambda: 'return id(touch_light2);'
then:
- lambda: 'id(touch_light2) = false;'
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${light_2_entity}
- component.update: my_display
- if:
condition:
lambda: 'return id(touch_fan);'
then:
- lambda: 'id(touch_fan) = false;'
- homeassistant.service:
service: switch.toggle
data:
entity_id: ${fan_entity}
- component.update: my_display
# Import states from Home Assistant # Import states from Home Assistant
text_sensor: text_sensor:

View File

@@ -24,7 +24,7 @@ esp32:
# Enable logging # Enable logging
logger: logger:
level: WARN level: DEBUG
# Enable Home Assistant API # Enable Home Assistant API
api: api: