Skip to content

Commit

Permalink
Move attrs declaration to top of updateUI
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-craig authored Mar 8, 2022
1 parent f19a5a1 commit 1642606
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fan-xiaomi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)';
Expand All @@ -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'],
Expand Down

0 comments on commit 1642606

Please sign in to comment.