Skip to content

Commit

Permalink
Asakuki diffuser: add named_color support
Browse files Browse the repository at this point in the history
The light on this device had the color disabled due to the format being
inconsistent, and replaced by a separate select entity.

The problem is this made the light white-only from HA point of view,
which should have used a different color mode.

Since HA is breaking backward compatibility with lights that use the color modes
incorrectly in 2025.3, this needs to be fixed by either changing to the
appropriate "brightness" mode instead of "white", or by adding color support
back in. Because we added named color support in the meantime, we are able
to do the latter.

Issue #2807
  • Loading branch information
make-all committed Jan 18, 2025
1 parent 62138b2 commit efa15e4
Showing 1 changed file with 56 additions and 34 deletions.
90 changes: 56 additions & 34 deletions custom_components/tuya_local/devices/asakuki_diffuser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ entities:
- dps_val: white
value: white
- dps_val: colour
value: Color
value: hs
- dps_val: colourfull
value: Mood
- id: 111
Expand All @@ -40,39 +40,60 @@ entities:
min: 0
max: 255
- id: 108
name: color_data
type: hex
format:
- name: r
bytes: 1
range:
min: 0
max: 255
- name: g
bytes: 1
range:
min: 0
max: 255
- name: b
bytes: 1
range:
min: 0
max: 255
- name: h
bytes: 2
range:
min: 0
max: 360
- name: s
bytes: 1
range:
min: 0
max: 100
- name: v
bytes: 1
range:
min: 0
max: 255
name: named_color
type: string
mapping:
- dps_val: "ff00000064ff"
value: red
- dps_val: "ffa5002764ff"
value: orange
- dps_val: "ffff003c64ff"
value: yellow
- dps_val: "008000786480"
value: green
- dps_val: "0000fff064ff"
value: blue
- dps_val: "4b008201136482"
value: indigo
- dps_val: "ee82ee012c2dee"
value: violet
- dps_val: "00ff007864ff"
value: lime
- dps_val: "ffc0cb015e19ff"
value: pink
- dps_val: "00ffff8464ff"
value: cyan
# type: hex

Check warning on line 66 in custom_components/tuya_local/devices/asakuki_diffuser.yaml

View workflow job for this annotation

GitHub Actions / lint

66:9 [comments-indentation] comment not indented like content
# - name: r
# bytes: 1
# range:
# min: 0
# max: 255
# - name: g
# bytes: 1
# range:
# min: 0
# max: 255
# - name: b
# bytes: 1
# range:
# min: 0
# max: 255
# - name: h
# bytes: 2 # format inconsistent, uses 1 byte when leading byte is 0

Check failure on line 83 in custom_components/tuya_local/devices/asakuki_diffuser.yaml

View workflow job for this annotation

GitHub Actions / lint

83:81 [line-length] line too long (81 > 80 characters)
# range:
# min: 0
# max: 360
# - name: s
# bytes: 1
# range:
# min: 0
# max: 100
# - name: v
# bytes: 1
# range:
# min: 0
# max: 255
- entity: select
name: Mood
icon: "mdi:palette"
Expand All @@ -90,6 +111,7 @@ entities:
value: Mood 3
- entity: select
name: Color
deprecated: light
icon: "mdi:palette"
category: config
dps:
Expand Down

0 comments on commit efa15e4

Please sign in to comment.