@@ -39,53 +39,62 @@ script:
3939 - lambda : |-
4040 ESP_LOGI("script", "Running hide_unwanted_tabs script");
4141
42+ std::string tab_rooms_enabled_str = to_string(${tab_rooms_enabled});
43+ std::string tab_heating_set_temp_enabled_str = to_string(${tab_heating_set_temp_enabled});
44+ std::string tab_heating_details_enabled_str = to_string(${tab_heating_details_enabled});
4245 std::string tab_cover_enabled_str = to_string(${tab_cover_enabled});
4346 std::string tab_scenes_enabled_str = to_string(${tab_scenes_enabled});
4447 std::string tab_info_enabled_str = to_string(${tab_info_enabled});
45- std::string tab_heating_details_enabled_str = to_string(${tab_heating_details_enabled});
46- std::string tab_heating_set_temp_enabled_str = to_string(${tab_heating_set_temp_enabled});
47- std::string tab_rooms_enabled_str = to_string(${tab_rooms_enabled});
4848
49+ // if the order of the tabs is changed, please also update the index values below!
4950 const int idx_tab_rooms = 0;
5051 const int idx_tab_heating_set_temp = 1;
5152 const int idx_tab_heating_details = 2;
5253 const int idx_tab_covers = 3;
5354 const int idx_tab_scenes = 4;
5455 const int idx_tab_info = 5;
5556
56- // please note that hiding buttons in the tabview's button matrix does not seem to work with ESPHome 2026.04
57- auto *tab_buttons = lv_tabview_get_tab_btns(id(tabview_main));
58- lv_buttonmatrix_ctrl_t hidden_state = (lv_buttonmatrix_ctrl_t)(LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED);
57+ auto* button_tab_rooms = lv_tabview_get_tab_button(id(tabview_main), idx_tab_rooms);
58+ auto* button_tab_heating_set_temp = lv_tabview_get_tab_button(id(tabview_main), idx_tab_heating_set_temp);
59+ auto* button_tab_heating_details = lv_tabview_get_tab_button(id(tabview_main), idx_tab_heating_details);
60+ auto* button_tab_covers = lv_tabview_get_tab_button(id(tabview_main), idx_tab_covers);
61+ auto* button_tab_scenes = lv_tabview_get_tab_button(id(tabview_main), idx_tab_scenes);
62+ auto* button_tab_info = lv_tabview_get_tab_button(id(tabview_main), idx_tab_info);
5963
64+ // A tabview is just a lv_obj with a list of buttons; please note that there is NO buttonmatrix used.
65+ // So to hide a whole tab we need to hide both:
66+ // 1) the tab content (which is a lv_obj)
67+ // 2) the corresponding button in the tabview's button list (which is a lv_btn)
68+ // see https://lvgl.io/docs/open/9.5/API/widgets/tabview/lv_tabview_h.html
69+ if (tab_rooms_enabled_str == "0") {
70+ ESP_LOGI("script", "Hiding the 'Rooms' tab since tab_rooms_enabled is set to %s", tab_rooms_enabled_str.c_str());
71+ lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
72+ lv_obj_add_flag(button_tab_rooms, LV_OBJ_FLAG_HIDDEN);
73+ }
74+ if (tab_heating_set_temp_enabled_str == "0") {
75+ ESP_LOGI("script", "Hiding the 'Heating Set Temp' tab since tab_heating_set_temp_enabled is set to %s", tab_heating_set_temp_enabled_str.c_str());
76+ lv_obj_add_flag(id(tab_heating_set_temp), LV_OBJ_FLAG_HIDDEN);
77+ lv_obj_add_flag(button_tab_heating_set_temp, LV_OBJ_FLAG_HIDDEN);
78+ }
79+ if (tab_heating_details_enabled_str == "0") {
80+ ESP_LOGI("script", "Hiding the 'Heating Details' tab since tab_heating_details_enabled is set to %s", tab_heating_details_enabled_str.c_str());
81+ lv_obj_add_flag(id(tab_heating_details), LV_OBJ_FLAG_HIDDEN);
82+ lv_obj_add_flag(button_tab_heating_details, LV_OBJ_FLAG_HIDDEN);
83+ }
6084 if (tab_cover_enabled_str == "0") {
6185 ESP_LOGI("script", "Hiding the 'Cover' tab since tab_cover_enabled is set to %s", tab_cover_enabled_str.c_str());
6286 lv_obj_add_flag(id(tab_covers), LV_OBJ_FLAG_HIDDEN);
63- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_covers, hidden_state );
87+ lv_obj_add_flag(button_tab_covers, LV_OBJ_FLAG_HIDDEN );
6488 }
6589 if (tab_scenes_enabled_str == "0") {
6690 ESP_LOGI("script", "Hiding the 'Scenes' tab since tab_scenes_enabled is set to %s", tab_scenes_enabled_str.c_str());
6791 lv_obj_add_flag(id(tab_scenes), LV_OBJ_FLAG_HIDDEN);
68- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_scenes, hidden_state );
92+ lv_obj_add_flag(button_tab_scenes, LV_OBJ_FLAG_HIDDEN );
6993 }
7094 if (tab_info_enabled_str == "0") {
7195 ESP_LOGI("script", "Hiding the 'Info' tab since tab_info_enabled is set to %s", tab_info_enabled_str.c_str());
7296 lv_obj_add_flag(id(tab_info), LV_OBJ_FLAG_HIDDEN);
73- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_info, hidden_state);
74- }
75- if (tab_heating_details_enabled_str == "0") {
76- ESP_LOGI("script", "Hiding the 'Heating Details' tab since tab_heating_details_enabled is set to %s", tab_heating_details_enabled_str.c_str());
77- lv_obj_add_flag(id(tab_heating_details), LV_OBJ_FLAG_HIDDEN);
78- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_heating_details, hidden_state);
79- }
80- if (tab_heating_set_temp_enabled_str == "0") {
81- ESP_LOGI("script", "Hiding the 'Heating Set Temp' tab since tab_heating_set_temp_enabled is set to %s", tab_heating_set_temp_enabled_str.c_str());
82- lv_obj_add_flag(id(tab_heating_set_temp), LV_OBJ_FLAG_HIDDEN);
83- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_heating_set_temp, hidden_state);
84- }
85- if (tab_rooms_enabled_str == "0") {
86- ESP_LOGI("script", "Hiding the 'Rooms' tab since tab_rooms_enabled is set to %s", tab_rooms_enabled_str.c_str());
87- lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
88- lv_btnmatrix_set_btn_ctrl(tab_buttons, idx_tab_rooms, hidden_state);
97+ lv_obj_add_flag(button_tab_info, LV_OBJ_FLAG_HIDDEN);
8998 }
9099
91100 - id : sync_all_window_contact_ui
0 commit comments