Skip to content

Commit

Permalink
Trying fix for color temperature. This build is working for me locall…
Browse files Browse the repository at this point in the history
…y. If the light is in xy colorMode and I set the temperature with the slider, it will change it to colorMode temperature and it will set the value given in slider.
  • Loading branch information
AnthonMS committed Jun 18, 2023
1 parent 599b616 commit 14d026e
Show file tree
Hide file tree
Showing 8 changed files with 1,705 additions and 18 deletions.
436 changes: 436 additions & 0 deletions dist/dev/my-cards.js

Large diffs are not rendered by default.

261 changes: 261 additions & 0 deletions dist/my-button.js

Large diffs are not rendered by default.

436 changes: 436 additions & 0 deletions dist/my-cards.js

Large diffs are not rendered by default.

219 changes: 219 additions & 0 deletions dist/my-slider-v2.js

Large diffs are not rendered by default.

343 changes: 343 additions & 0 deletions dist/my-slider.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/cards/extras/const.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const CARD_VERSION = '2.0.1'
export const SLIDER_VERSION = '3.0.3'
export const CARD_VERSION = '2.0.2'
export const SLIDER_VERSION = '3.0.4'
export const BUTTON_VERSION = '1.0.0'
export const BUTTON_COVER_VERSION = '0.0.1'
20 changes: 6 additions & 14 deletions src/cards/my-slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,13 @@ export class MySliderV2 extends LitElement {
// if (!this.showMin) {
// oldVal = oldVal - this.min // Subtracting savedMin to make slider 0 be far left
// }
console.debug('Math.abs((value - oldVal)) > this.step :', Math.abs((value - oldVal)) > this.step)
console.debug('value:', value)
console.debug('oldVal:', oldVal)
console.debug('this.step:', this.step)
if (entity.state === 'off' || Math.abs((value - oldVal)) > this.step) {
console.debug('DID MEET THE CRITERIA!')
}
else {
console.debug('DID NOT MEET THE CRITERIA! BECAUSE ITS EITHER ON ALREADY OR THE STEP WAS BELOW THRESHOLD! SUPPOSEDLY')

if (entity.state === 'off' || isNaN(oldVal) || Math.abs((value - oldVal)) > this.step) {
this.hass.callService("light", "turn_on", {
entity_id: entity.entity_id,
color_temp: value
})
}

this.hass.callService("light", "turn_on", {
entity_id: entity.entity_id,
color_temp: value
})
}
private _setHue(entity, value): void {
let oldVal = 0
Expand Down

0 comments on commit 14d026e

Please sign in to comment.