Skip to content

Commit 7f8f95d

Browse files
committed
Fix icon in scene tab;
Fix indexing of tabs when a tab is hidden
1 parent bb39174 commit 7f8f95d

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

dev-sdl.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ substitutions:
3535

3636
tab_rooms_enabled: "1"
3737
tab_heating_set_temp_enabled: "1"
38-
tab_heating_details_enabled: "1"
38+
tab_heating_details_enabled: "0"
3939
tab_cover_enabled: "1"
4040
tab_scenes_enabled: "1"
41-
tab_info_enabled: "0"
41+
tab_info_enabled: "1"
4242

4343
# --------------------------------------------------------------------------
4444
# Room configuration
@@ -107,25 +107,27 @@ substitutions:
107107
# Scene/Script configuration
108108
# --------------------------------------------------------------------------
109109

110-
scene1_action_type: "scene.turn_on"
111-
scene1_entity_id: "scene.scene1"
112-
scene1_name: "Scene 1"
113-
scene1_icon: "$mdi_white_balance_sunny"
110+
111+
scene1_action_type: "script.turn_on"
112+
scene1_entity_id: "script.alexa_co2_elevata_soffitta"
113+
scene1_name: "Alexa CO2 Elevata"
114+
scene1_icon: "\U000F05A8"
114115

115116
scene2_action_type: "scene.turn_on"
116-
scene2_entity_id: "" # leave empty to hide the whole button
117-
scene2_name: "Scene 2"
118-
scene2_icon: "$mdi_bed"
117+
scene2_entity_id: ""
118+
scene2_name: "Riposino"
119+
scene2_icon: "\U000F05A8"
119120

120121
scene3_action_type: "scene.turn_on"
121122
scene3_entity_id: "" # leave empty to hide the whole button
122123
scene3_name: "Scene 3"
123-
scene3_icon: "$mdi_floor_lamp"
124+
scene3_icon: "\U000F05A8"
124125

125126
scene4_action_type: "scene.turn_on"
126127
scene4_entity_id: "" # leave empty to hide the whole button
127128
scene4_name: "Scene 4"
128-
scene4_icon: "$mdi_ceiling_light"
129+
scene4_icon: "\U000F05A8"
130+
129131

130132
# --------------------------------------------------------------------------
131133
# Everything below this line is not really meant to be overridden by the user, but you can if you want to

example-instance.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ packages:
6363
scene1_action_type: "scene.turn_on"
6464
scene1_entity_id: "scene.scene1"
6565
scene1_name: "Scene 1"
66-
scene1_icon: "$mdi_white_balance_sunny"
66+
scene1_icon: "\U000F05A8"
6767

6868
scene2_action_type: "scene.turn_on"
6969
scene2_entity_id: "" # leave empty to hide the whole button
7070
scene2_name: "Scene 2"
71-
scene2_icon: "$mdi_bed"
71+
scene2_icon: "\U000F05A8"
7272

7373
scene3_action_type: "scene.turn_on"
7474
scene3_entity_id: "" # leave empty to hide the whole button
7575
scene3_name: "Scene 3"
76-
scene3_icon: "$mdi_floor_lamp"
76+
scene3_icon: "\U000F05A8"
7777

7878
scene4_action_type: "scene.turn_on"
7979
scene4_entity_id: "" # leave empty to hide the whole button
8080
scene4_name: "Scene 4"
81-
scene4_icon: "$mdi_ceiling_light"
81+
scene4_icon: "\U000F05A8"
8282
ref: main # optional
8383
refresh: 1d # optional

include/scripts.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,38 +70,34 @@ script:
7070
auto* button_tab_info = lv_tabview_get_tab_button(id(tabview_main), idx_tab_info);
7171
7272
// A tabview is just a lv_obj with a list of buttons; please note that there is NO buttonmatrix used.
73-
// So to hide a whole tab we need to hide both:
74-
// 1) the tab content (which is a lv_obj)
75-
// 2) the corresponding button in the tabview's button list (which is a lv_btn)
73+
// So to hide a whole tab we hide the corresponding button in the tabview's button list (which is a lv_btn)
7674
// see https://lvgl.io/docs/open/9.5/API/widgets/tabview/lv_tabview_h.html
75+
//
76+
// Please note that the tab content itself should not be hidden with something like:
77+
// lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
78+
// because that would interfere with the indexing of the tabs
7779
if (tab_rooms_enabled_str == "0") {
7880
ESP_LOGI("script", "Hiding the 'Rooms' tab since tab_rooms_enabled is set to %s", tab_rooms_enabled_str.c_str());
79-
lv_obj_add_flag(id(tab_rooms), LV_OBJ_FLAG_HIDDEN);
8081
lv_obj_add_flag(button_tab_rooms, LV_OBJ_FLAG_HIDDEN);
8182
}
8283
if (tab_heating_set_temp_enabled_str == "0") {
8384
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());
84-
lv_obj_add_flag(id(tab_heating_set_temp), LV_OBJ_FLAG_HIDDEN);
8585
lv_obj_add_flag(button_tab_heating_set_temp, LV_OBJ_FLAG_HIDDEN);
8686
}
8787
if (tab_heating_details_enabled_str == "0") {
8888
ESP_LOGI("script", "Hiding the 'Heating Details' tab since tab_heating_details_enabled is set to %s", tab_heating_details_enabled_str.c_str());
89-
lv_obj_add_flag(id(tab_heating_details), LV_OBJ_FLAG_HIDDEN);
9089
lv_obj_add_flag(button_tab_heating_details, LV_OBJ_FLAG_HIDDEN);
9190
}
9291
if (tab_cover_enabled_str == "0") {
9392
ESP_LOGI("script", "Hiding the 'Cover' tab since tab_cover_enabled is set to %s", tab_cover_enabled_str.c_str());
94-
lv_obj_add_flag(id(tab_covers), LV_OBJ_FLAG_HIDDEN);
9593
lv_obj_add_flag(button_tab_covers, LV_OBJ_FLAG_HIDDEN);
9694
}
9795
if (tab_scenes_enabled_str == "0") {
9896
ESP_LOGI("script", "Hiding the 'Scenes' tab since tab_scenes_enabled is set to %s", tab_scenes_enabled_str.c_str());
99-
lv_obj_add_flag(id(tab_scenes), LV_OBJ_FLAG_HIDDEN);
10097
lv_obj_add_flag(button_tab_scenes, LV_OBJ_FLAG_HIDDEN);
10198
}
10299
if (tab_info_enabled_str == "0") {
103100
ESP_LOGI("script", "Hiding the 'Info' tab since tab_info_enabled is set to %s", tab_info_enabled_str.c_str());
104-
lv_obj_add_flag(id(tab_info), LV_OBJ_FLAG_HIDDEN);
105101
lv_obj_add_flag(button_tab_info, LV_OBJ_FLAG_HIDDEN);
106102
}
107103

include/sensors_import_health.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ sensor:
1414
unit_of_measurement: "count"
1515
accuracy_decimals: 0
1616
state_class: measurement
17-
update_interval: 30s
17+
update_interval: 300s
1818
on_value:
1919
- lvgl.label.update:
2020
id: lbl_invalid_ha_import_count
@@ -40,6 +40,8 @@ sensor:
4040
std::string num_rooms_str = to_string(${num_rooms});
4141
std::string tab_cover_enabled_str = to_string(${tab_cover_enabled});
4242
43+
// FIXME: add window contact sensors
44+
4345
// Room sensors.
4446
if (std::isnan(id(sensor_temp_${room1_id}).state)) invalid_count++;
4547
if (std::isnan(id(sensor_humidity_${room1_id}).state)) invalid_count++;

main.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,22 @@ substitutions:
114114
scene1_action_type: "scene.turn_on"
115115
scene1_entity_id: "scene.scene1"
116116
scene1_name: "Scene 1"
117-
scene1_icon: "$mdi_white_balance_sunny"
117+
scene1_icon: "\U000F05A8"
118118

119119
scene2_action_type: "scene.turn_on"
120120
scene2_entity_id: "" # leave empty to hide the whole button
121121
scene2_name: "Scene 2"
122-
scene2_icon: "$mdi_bed"
122+
scene2_icon: "\U000F05A8"
123123

124124
scene3_action_type: "scene.turn_on"
125125
scene3_entity_id: "" # leave empty to hide the whole button
126126
scene3_name: "Scene 3"
127-
scene3_icon: "$mdi_floor_lamp"
127+
scene3_icon: "\U000F05A8"
128128

129129
scene4_action_type: "scene.turn_on"
130130
scene4_entity_id: "" # leave empty to hide the whole button
131131
scene4_name: "Scene 4"
132-
scene4_icon: "$mdi_ceiling_light"
132+
scene4_icon: "\U000F05A8"
133133

134134
# --------------------------------------------------------------------------
135135
# Everything below this line is not really meant to be overridden by the user, but you can if you want to

0 commit comments

Comments
 (0)