Refactor logging level in voice assistant configuration: Change from WARN to DEBUG for improved troubleshooting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
substitutions:
|
||||
name: mbr-ha-remote
|
||||
friendly_name: "MBR HA Remote"
|
||||
|
||||
|
||||
# Home Assistant entity IDs - UPDATE THESE TO MATCH YOUR SETUP
|
||||
light_1_entity: switch.pollys_light
|
||||
light_2_entity: switch.joshuas_light
|
||||
@@ -72,9 +72,9 @@ display:
|
||||
id: my_display
|
||||
lambda: |-
|
||||
it.fill(Color(0x1A1A2E));
|
||||
|
||||
|
||||
it.print(160, 20, id(title_font), Color(0xFFFFFF), TextAlign::TOP_CENTER, "Room Remote");
|
||||
|
||||
|
||||
// Button 1: All Toggle (top-left)
|
||||
if (id(all_state)) {
|
||||
it.filled_rectangle(20, 50, 130, 80, Color(0x4CAF50));
|
||||
@@ -82,7 +82,7 @@ display:
|
||||
it.filled_rectangle(20, 50, 130, 80, Color(0x424242));
|
||||
}
|
||||
it.print(85, 90, id(button_font), Color(0xFFFFFF), TextAlign::CENTER, "Toggle All");
|
||||
|
||||
|
||||
// Button 2: Light 1 (top-right)
|
||||
if (id(light1_state)) {
|
||||
it.filled_rectangle(170, 50, 130, 80, Color(0x4CAF50));
|
||||
@@ -119,6 +119,7 @@ touchscreen:
|
||||
y_min: 340
|
||||
y_max: 3860
|
||||
on_touch:
|
||||
# Wake backlight if off
|
||||
- lambda: |-
|
||||
id(last_interaction_ms) = millis();
|
||||
if (!id(backlight_is_on)) {
|
||||
@@ -126,23 +127,73 @@ touchscreen:
|
||||
call.perform();
|
||||
id(backlight_is_on) = true;
|
||||
}
|
||||
|
||||
int tx = touch.x;
|
||||
int ty = touch.y;
|
||||
ESP_LOGD("touch", "Touch at x=%d, y=%d", tx, ty);
|
||||
|
||||
if (tx >= 20 && tx <= 150 && ty >= 50 && ty <= 130) {
|
||||
id(touch_all) = true;
|
||||
}
|
||||
else if (tx >= 170 && tx <= 300 && ty >= 50 && ty <= 130) {
|
||||
id(touch_light1) = true;
|
||||
}
|
||||
else if (tx >= 20 && tx <= 150 && ty >= 150 && ty <= 230) {
|
||||
id(touch_light2) = true;
|
||||
}
|
||||
else if (tx >= 170 && tx <= 300 && ty >= 150 && ty <= 230) {
|
||||
id(touch_fan) = true;
|
||||
}
|
||||
ESP_LOGD("touch", "Touch at x=%d, y=%d", touch.x, touch.y);
|
||||
# Button 1: Toggle All (top-left)
|
||||
- if:
|
||||
condition:
|
||||
lambda: 'return touch.x >= 20 && touch.x <= 150 && touch.y >= 50 && touch.y <= 130;'
|
||||
then:
|
||||
- lambda: |-
|
||||
ESP_LOGD("touch", "Toggle All pressed");
|
||||
id(light1_state) = !id(light1_state);
|
||||
id(light2_state) = !id(light2_state);
|
||||
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: ${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
|
||||
output:
|
||||
@@ -180,18 +231,6 @@ globals:
|
||||
- id: fan_state
|
||||
type: bool
|
||||
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
|
||||
type: uint32_t
|
||||
initial_value: "0"
|
||||
@@ -199,7 +238,7 @@ globals:
|
||||
type: bool
|
||||
initial_value: "true"
|
||||
|
||||
# Process touch events
|
||||
# Backlight timeout
|
||||
interval:
|
||||
- interval: 100ms
|
||||
then:
|
||||
@@ -209,54 +248,6 @@ interval:
|
||||
then:
|
||||
- light.turn_off: backlight
|
||||
- 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
|
||||
text_sensor:
|
||||
@@ -268,7 +259,7 @@ text_sensor:
|
||||
- lambda: 'id(light1_state) = (x == "on");'
|
||||
- lambda: 'id(all_state) = id(light1_state) && id(light2_state) && id(fan_state);'
|
||||
- component.update: my_display
|
||||
|
||||
|
||||
- platform: homeassistant
|
||||
entity_id: ${light_2_entity}
|
||||
id: ha_light2_state
|
||||
|
||||
@@ -24,7 +24,7 @@ esp32:
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: WARN
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
|
||||
Reference in New Issue
Block a user