From 92940d82f2bcfb17c7da16072b653bda1308e9b3 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Mon, 11 Mar 2024 18:43:44 +0100 Subject: [PATCH] Fix invalid call to `fan.oscillate` Solves #1873 --- esphome/nspanel_esphome_core.yaml | 6 +++--- nspanel_blueprint.yaml | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 7f8ef7e..6987819 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -878,7 +878,7 @@ display: switch (component_id) { case 17: // bt_oscillate if (!touch_event) { // Release - ha_call_service->execute("fan.oscillate", "", "", detailed_entity->state.c_str()); + ha_call_service->execute("fan.oscillate", "oscillating", "toggle", detailed_entity->state.c_str()); } break; } @@ -2016,9 +2016,9 @@ script: { {"type", "service_call"}, {"service", service}, - {"entity", entity}, {"key", key}, - {"value", value} + {"value", value}, + {"entity", entity} }); } } diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 474227d..32ae1a2 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -7722,12 +7722,13 @@ action: - alias: "fan.oscillate" conditions: - '{{ nspanel_event.service == "fan.oscillate" }}' + - '{{ nspanel_event.key == "oscillating" }}' sequence: - variables: oscillating: '{{ state_attr(nspanel_event.entity, "oscillating") | default(true) }}' - service: fan.oscillate data: - oscillating: '{{ not (oscillating if oscillating is boolean else true) }}' + oscillating: '{{ true if oscillating is boolean and not oscillating else false }}' target: entity_id: '{{ nspanel_event.entity }}' continue_on_error: true @@ -8527,6 +8528,11 @@ action: id: bt_oscillate txt: '{{ all_icons["autorenew"] if state_attr(fan_entity, "oscillating") | default(false) else all_icons["autorenew-off"] }}' continue_on_error: true + - service: '{{ nspanel.service.component.color }}' + data: + id: fan.bt_oscillate + color: '{{ nextion.color.grey_white }}' + continue_on_error: true - service: '{{ nspanel.service.component.visibility }}' data: ids: ["fan.bt_oscillate"]