Skip to content

Commit

Permalink
Support brightness in LightingSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Sep 8, 2024
1 parent 1da46b2 commit f461128
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pychonet/LightingSystem.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from pychonet.EchonetInstance import EchonetInstance
from pychonet.GeneralLighting import ENL_BRIGHTNESS
from pychonet.lib.epc_functions import _int

ENL_SCENE = 0xC0
ENL_SCENE_MAX = 0xC1


class LightingSystem(EchonetInstance):
EPC_FUNCTIONS = {
0xB0: _int, # Illuminance level setting
Expand All @@ -17,3 +19,21 @@ def __init__(self, host, api_connector=None, instance=0x1):
EchonetInstance.__init__(
self, host, self._eojgc, self._eojcc, instance, api_connector
)

"""
getBrightness get the brightness that has been set in the light
return: A string representing the configured brightness.
"""

def getBrightness(self):
return self.getMessage(ENL_BRIGHTNESS) # ['brightness']

"""
setBrightness set the temperature of the light
param temperature: A string representing the desired temperature.
"""

def setBrightness(self, brightness):
return self.setMessage(ENL_BRIGHTNESS, int(brightness))

0 comments on commit f461128

Please sign in to comment.