diff --git a/panel.yaml b/panel.yaml index cf94726..234a584 100644 --- a/panel.yaml +++ b/panel.yaml @@ -35,7 +35,6 @@ logger: # Enable Home Assistant API api: - ota: platform: esphome @@ -56,6 +55,14 @@ time: seconds: 0 then: - script.execute: time_update + +bluetooth_proxy: + active: False + +image: + - file: "media/grackle.png" + type: RGB + id: myimage script: - id: time_update @@ -107,24 +114,27 @@ sensor: entity_category: diagnostic text_sensor: - - platform: wifi_info - ip_address: - name: "IP Address" - id: ip_address - entity_category: diagnostic - on_value: - then: - - lvgl.label.update: - id: ip_address_label - text: - format: "%s" - args: [ 'id(ip_address).get_state().c_str()' ] - ssid: - name: "Connected SSID" - entity_category: diagnostic - mac_address: - name: "Mac Address" - entity_category: diagnostic + - platform: template + name: "Virtual Switch State" + id: virtual_switch_state + lambda: |- + if (id(virtual_switch).state) { + return esphome::optional("On"); + } else { + return esphome::optional("Off"); + } + - platform: template + name: "Virtual Switch State" + id: virtual_switch_state2 + lambda: |- + if (id(virtual_switch2).state) { + return esphome::optional("On"); + } else { + return esphome::optional("Off"); + } + + + color: # Create a Home Assistant blue color @@ -158,10 +168,6 @@ lvgl: transition_length: 5s - lvgl.pause: show_snow: true - #- lvgl.pause: - #- light.turn_off: - # id: display_backlight - # transition_length: 5s style_definitions: - id: style_line @@ -180,7 +186,6 @@ lvgl: button: text_font: roboto24 scroll_on_focus: true - #group: general radius: 25 width: 150 height: 109 @@ -210,27 +215,61 @@ lvgl: - button: height: 223 checkable: true - id: lv_button_1 + id: lv_button_virtual2 widgets: - label: text_font: light40 align: top_left - text: $lightbulb - id: lv_button_1_icon + text: "\U000F06B5" + id: lv_button_virtual_icon - label: align: bottom_left - text: "Center Light" + text: "Living Room" long_mode: dot on_click: - light.toggle: internal_light + - lambda: |- + lv_state_t state = lv_obj_get_state(id(lv_button_virtual2)); + if (state & LV_STATE_CHECKED) { + id(virtual_switch2).turn_on(); + } else { + id(virtual_switch2).turn_off(); + } + + + - button: + height: 223 + checkable: true + id: lv_button_virtual + widgets: + - label: + text_font: light40 + align: top_left + text: "\U000F06B5" + id: lv_button_virtual_icon2 + - label: + align: bottom_left + text: "Kitchen" + long_mode: dot + on_click: + - lambda: |- + lv_state_t state = lv_obj_get_state(id(lv_button_virtual)); + if (state & LV_STATE_CHECKED) { + id(virtual_switch).turn_on(); + } else { + id(virtual_switch).turn_off(); + } + + + - obj: widgets: - - label: - id: ip_address_label - align: CENTER - text: 'Not connected' - text_color: ha_blue - y: +10 + - label: + id: ip_address_label + align: CENTER + text: 'Not connected' + text_color: ha_blue + y: +10 + - meter: height: 200 width: 200 @@ -285,25 +324,27 @@ lvgl: width: 4 color: 0xA0A0A0 r_mod: -20 + - obj: widgets: - - label: - styles: date_style - id: day_label - y: -20 - text: !lambda |- - static const char * const day_names[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; - return day_names[id(time_comp).now().day_of_week-1]; - - label: - styles: date_style - id: date_label - y: +20 - text: !lambda |- - static const char * const mon_names[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; - static char date_buf[8]; - auto now = id(time_comp).now(); - snprintf(date_buf, sizeof(date_buf), "%s %2d", mon_names[now.month-1], now.day_of_month); - return date_buf; + - label: + styles: date_style + id: day_label + y: -20 + text: !lambda |- + static const char * const day_names[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"}; + return day_names[id(time_comp).now().day_of_week-1]; + - label: + styles: date_style + id: date_label + y: +20 + text: !lambda |- + static const char * const mon_names[] = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; + static char date_buf[8]; + auto now = id(time_comp).now(); + snprintf(date_buf, sizeof(date_buf), "%s %2d", mon_names[now.month-1], now.day_of_month); + return date_buf; + - obj: id: popup_obj hidden: true @@ -370,28 +411,7 @@ light: id: backlight restore_mode: ALWAYS_ON - - platform: binary - output: internal_relay_1 - name: Internal Light - id: internal_light - on_turn_on: - then: - - lvgl.widget.update: - id: lv_button_1_icon - text_color: 0xFFFF00 - - lvgl.widget.update: - id: lv_button_1 - state: - checked: true - on_turn_off: - then: - - lvgl.widget.update: - id: lv_button_1_icon - text_color: 0xB6B6B6 - - lvgl.widget.update: - id: lv_button_1 - state: - checked: false + #------------------------------------------- # Graphics and Fonts @@ -525,4 +545,29 @@ display: - 5 #b2 - 6 #b3 - 7 #b4 - - 15 #b5 \ No newline at end of file + - 15 #b5 + +switch: + - platform: template + name: "Virtual Switch" + id: virtual_switch + internal: false # Expose to Home Assistant + optimistic: true + on_turn_on: + - lambda: |- + lv_obj_add_state(id(lv_button_virtual), LV_STATE_CHECKED); + on_turn_off: + - lambda: |- + lv_obj_clear_state(id(lv_button_virtual), LV_STATE_CHECKED); + + - platform: template + name: "Virtual Switch2" + id: virtual_switch2 + internal: false # Expose to Home Assistant + optimistic: true + on_turn_on: + - lambda: |- + lv_obj_add_state(id(lv_button_virtual2), LV_STATE_CHECKED); + on_turn_off: + - lambda: |- + lv_obj_clear_state(id(lv_button_virtual2), LV_STATE_CHECKED);