Call service only on touch release

Solves #1340
Solves #1822
This commit is contained in:
Edward Firmo
2024-02-28 05:25:16 +01:00
parent 45700b5fef
commit df6a565254
2 changed files with 17 additions and 20 deletions

View File

@@ -843,20 +843,22 @@ display:
lambda: |-
if (not id(is_uploading_tft)) {
timer_reset_all->execute(page_names[page_id]);
switch (page_id) {
case 10: // light
switch (component_id) {
case 34: // power_button
ha_call_service->execute("light.toggle", "", "", detailed_entity->state.c_str());
break;
}
break;
case 22: // fan
switch (component_id) {
case 17: // bt_oscillate
ha_call_service->execute("fan.oscillate", "", "", detailed_entity->state.c_str());
break;
}
if (!touch_event) { // Release touch only
switch (page_id) {
case 10: // light
switch (component_id) {
case 34: // power_button
ha_call_service->execute("light.toggle", "", "", detailed_entity->state.c_str());
break;
}
break;
case 22: // fan
switch (component_id) {
case 17: // bt_oscillate
ha_call_service->execute("fan.oscillate", "", "", detailed_entity->state.c_str());
break;
}
}
}
}