Skip to content

Commit

Permalink
Merge pull request #71 from ian-craig/fix-led_on-before-attrs
Browse files Browse the repository at this point in the history
Move attrs declaration to top of updateUI
  • Loading branch information
ikaruswill authored Mar 9, 2022
2 parents f19a5a1 + 1642606 commit 03c247d
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 03c247d

Please sign in to comment.