Skip to content

Commit

Permalink
Move p5 natural mode patch into appropriate section
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaruswill committed May 23, 2020
1 parent 9471bdd commit b30df29
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fan-xiaomi.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,20 +479,20 @@ Natural
activeElement.classList.remove('active')
}
// let direct_speed_int = Number(direct_speed)
let speedLevel = speed[speed.length - 1]
iconSpan.innerHTML = `<ha-icon icon="mdi:numeric-${speedLevel}-box-outline"></ha-icon>`

if (model === 'dmaker.fan.p5') { //p5 does not report direct_speed and natural_speed
// Natural mode
activeElement = fanboxa.querySelector('.var-natural')

//p5 does not report direct_speed and natural_speed
if (model === 'dmaker.fan.p5') {
if (mode === 'nature') {
natural_speed = true
} else if (mode === 'normal') {
natural_speed = false
}
}

let speedLevel = speed[speed.length - 1]
iconSpan.innerHTML = `<ha-icon icon="mdi:numeric-${speedLevel}-box-outline"></ha-icon>`

// Natural mode
activeElement = fanboxa.querySelector('.var-natural')
if (natural_speed) {
if (activeElement.classList.contains('active') === false) {
activeElement.classList.add('active')
Expand Down

0 comments on commit b30df29

Please sign in to comment.