Skip to content

Commit

Permalink
Add fullcolorsupport to lightbulb
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbamann committed Oct 25, 2024
1 parent ba3b28e commit cd6e70e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyfritzhome/devicetypes/fritzhomedevicelightbulb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The light bulb device class."""

# -*- coding: utf-8 -*-

import logging
Expand All @@ -20,6 +21,7 @@ class FritzhomeDeviceLightBulb(FritzhomeDeviceBase):
color_temp = None
color_mode = None
supported_color_mode = None
fullcolorsupport = None

def _update_from_node(self, node):
super()._update_from_node(node)
Expand Down Expand Up @@ -58,6 +60,10 @@ def _update_lightbulb_from_node(self, node):
"supported_modes"
)

self.fullcolorsupport = colorcontrol_element.attrib.get(
"fullcolorsupport"
)

except ValueError:
pass

Expand Down Expand Up @@ -120,7 +126,7 @@ def set_color(self, hsv, duration=0):

def set_unmapped_color(self, hsv, duration=0):
"""Set unmapped HSV color (Free color selection)."""
if self.has_color:
if self.has_color and self.fullcolorsupport:
self._fritz.set_color(self.ain, hsv, duration, False)

def get_color_temps(self):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_fritzhomedevicelightbulb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_device_init(self):
assert device.state # Lightbulb is switched on
assert device.color_mode == "1"
assert device.supported_color_mode == "5"
assert device.fullcolorsupport
assert device.hue == 358
assert device.saturation == 180
assert device.color_temp is None
Expand Down Expand Up @@ -87,6 +88,7 @@ def test_device_init_color_temp_mode(self):
assert device.state # Lightbulb is switched on
assert device.color_mode == "4"
assert device.supported_color_mode == "5"
assert device.fullcolorsupport
assert device.hue is None
assert device.saturation is None
assert device.color_temp == 2800
Expand Down

0 comments on commit cd6e70e

Please sign in to comment.