From 1642606ef1e18f0eeaa13530f72f9e0e7ef10de7 Mon Sep 17 00:00:00 2001 From: Ian Craig Date: Tue, 8 Mar 2022 21:11:23 +0000 Subject: [PATCH] Move attrs declaration to top of updateUI --- fan-xiaomi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fan-xiaomi.js b/fan-xiaomi.js index b09ff99..1d10a89 100644 --- a/fan-xiaomi.js +++ b/fan-xiaomi.js @@ -552,6 +552,7 @@ class FanXiaomi extends HTMLElement { updateUI(hass) { const state = hass.states[this.config.entity]; + const attrs = state.attributes; if (state.state === 'unavailable') { this.card.querySelector('.var-title').textContent = this.config.name + ' (Disconnected)'; @@ -564,7 +565,6 @@ class FanXiaomi extends HTMLElement { hass.states[this.number_led_brightness_entity].state : attrs['led_brightness']) < 2; - const attrs = state.attributes; this.setUI(this.card.querySelector('.fan-xiaomi-panel'), { title: this.config.name || attrs['friendly_name'], natural_speed: attrs['natural_speed'],