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

@@ -1,7 +1,7 @@
substitutions: substitutions:
name: mbr-ha-remote name: mbr-ha-remote
friendly_name: "MBR HA Remote" friendly_name: "MBR HA Remote"
# Home Assistant entity IDs - UPDATE THESE TO MATCH YOUR SETUP # Home Assistant entity IDs - UPDATE THESE TO MATCH YOUR SETUP
light_1_entity: switch.pollys_light light_1_entity: switch.pollys_light
light_2_entity: switch.joshuas_light light_2_entity: switch.joshuas_light
@@ -72,9 +72,9 @@ display:
id: my_display id: my_display
lambda: |- lambda: |-
it.fill(Color(0x1A1A2E)); it.fill(Color(0x1A1A2E));
it.print(160, 20, id(title_font), Color(0xFFFFFF), TextAlign::TOP_CENTER, "Room Remote"); it.print(160, 20, id(title_font), Color(0xFFFFFF), TextAlign::TOP_CENTER, "Room Remote");
// Button 1: All Toggle (top-left) // Button 1: All Toggle (top-left)
if (id(all_state)) { if (id(all_state)) {
it.filled_rectangle(20, 50, 130, 80, Color(0x4CAF50)); it.filled_rectangle(20, 50, 130, 80, Color(0x4CAF50));
@@ -82,7 +82,7 @@ display:
it.filled_rectangle(20, 50, 130, 80, Color(0x424242)); it.filled_rectangle(20, 50, 130, 80, Color(0x424242));
} }
it.print(85, 90, id(button_font), Color(0xFFFFFF), TextAlign::CENTER, "Toggle All"); it.print(85, 90, id(button_font), Color(0xFFFFFF), TextAlign::CENTER, "Toggle All");
// Button 2: Light 1 (top-right) // Button 2: Light 1 (top-right)
if (id(light1_state)) { if (id(light1_state)) {
it.filled_rectangle(170, 50, 130, 80, Color(0x4CAF50)); it.filled_rectangle(170, 50, 130, 80, Color(0x4CAF50));
@@ -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:
@@ -268,7 +259,7 @@ text_sensor:
- lambda: 'id(light1_state) = (x == "on");' - lambda: 'id(light1_state) = (x == "on");'
- lambda: 'id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);' - lambda: 'id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);'
- component.update: my_display - component.update: my_display
- platform: homeassistant - platform: homeassistant
entity_id: ${light_2_entity} entity_id: ${light_2_entity}
id: ha_light2_state id: ha_light2_state

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: