Fix oscillating handler in more info fan card (#18305) (#18306)

This commit is contained in:
Necroneco 2023-10-23 16:26:31 +08:00 committed by GitHub
parent 768344c3f7
commit b24e99c56c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,6 +87,9 @@ class MoreInfoFan extends LitElement {
_handleOscillating(ev) { _handleOscillating(ev) {
const newVal = ev.target.value === "true"; const newVal = ev.target.value === "true";
const oldVal = this.stateObj?.attributes.oscillating;
if (oldVal === newVal) return;
this.hass.callService("fan", "oscillate", { this.hass.callService("fan", "oscillate", {
entity_id: this.stateObj!.entity_id, entity_id: this.stateObj!.entity_id,