Python LimitlessLED via RF

Check-in [ba7cf6d824]
Login
Overview
Comment:More temperature corrections
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ba7cf6d8246c9f0ccf339d1ae318a1144c8ddc7991753a9567be3db78a88ec77
User & Date: rkeene on 2020-04-30 01:30:48
Other Links: manifest | tags
Context
2020-04-30
02:38
Send correct CRC for CCT check-in: 6ec60511f0 user: rkeene tags: trunk
01:30
More temperature corrections check-in: ba7cf6d824 user: rkeene tags: trunk
2020-04-29
23:46
Really fixed temperature inversion check-in: 7dcbe06115 user: rkeene tags: trunk
Changes

Modified limitlessled_rf/__init__.py from [c4643c5d3b] to [936b92f2e8].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
				'change_color_mode': 0x0D,
				'zone_set_brightness': 0x0E,
				'zone_set_color':  0x0F
			}
		},
		'cct': {
			'retries':  10,
			'delay':    0.5,
			'channels': [4, 39, 74],
			'syncword': [0x55AA, 0x050A],
			'brightness_range': [0, 9],
			'temperature_output_range': [9, 0],
			'temperature_input_range':  [3000, 6500],
			'features': [
				'has_max_brightness',
				'has_brightness',
				'has_temperature',
				'is_white'
			],
			'button_map': {







|



|
|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
				'change_color_mode': 0x0D,
				'zone_set_brightness': 0x0E,
				'zone_set_color':  0x0F
			}
		},
		'cct': {
			'retries':  10,
			'delay':    0.1,
			'channels': [4, 39, 74],
			'syncword': [0x55AA, 0x050A],
			'brightness_range': [0, 9],
			'temperature_output_range': [0, 9],
			'temperature_input_range':  [6500, 3000],
			'features': [
				'has_max_brightness',
				'has_brightness',
				'has_temperature',
				'is_white'
			],
			'button_map': {
596
597
598
599
600
601
602
603
604
605
606
607





608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
		# Press the button
		return self._send_button(message)

	def set_temperature(self, kelvins, zone = None):
		if 'has_temperature' not in self._config['features']:
			return False

		temperature_input_coldest = self._config['temperature_input_range'][0]
		temperature_input_warmest = self._config['temperature_input_range'][1]
		temperature_output_coldest = self._config['temperature_output_range'][0]
		temperature_output_warmest = self._config['temperature_output_range'][1]






		# Clamp the color temperature to something this remote supports
		if kelvins < min(temperature_input_warmest, temperature_input_coldest):
			kelvins = temperature_input_warmest
		elif kelvins > max(temperature_input_coldest, temperature_input_warmest):
			kelvins = temperature_input_coldest

		temperature = self._scale_int(kelvins, temperature_input_coldest, temperature_input_warmest, temperature_output_coldest, temperature_output_warmest)
		self._debug("Scaled kelvins={} to a temperature value of {}".format(kelvins, temperature))

		if 'can_set_temperature' in self._config['features']:
			return self._set_temperature(temperature, zone)
		else:
			return self._step_temperature(temperature, temperature_output_warmest, temperature_output_coldest, zone)

	def on(self, zone = None, try_hard = False):
		if zone is None:
			message = {'button': 'on'}
		else:
			message = {
				'button': 'zone_on',







|
|
|
|

>
>
>
>
>

|

|








|







596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
		# Press the button
		return self._send_button(message)

	def set_temperature(self, kelvins, zone = None):
		if 'has_temperature' not in self._config['features']:
			return False

		temperature_input_coldest = self._config['temperature_input_range'][0] # e.g. 6500
		temperature_input_warmest = self._config['temperature_input_range'][1] # e.g. 3000
		temperature_output_coldest = self._config['temperature_output_range'][0] # e.g. 0
		temperature_output_warmest = self._config['temperature_output_range'][1] # e.g. 9

		# If there is only one supported color temperature, we are already at that temperature
		# Make no adjustment to the temperature to account for small variances
		if temperature_input_coldest == temperature_input_warmest:
			return True

		# Clamp the color temperature to something this remote supports
		if kelvins < temperature_input_warmest:
			kelvins = temperature_input_warmest
		elif kelvins > temperature_input_coldest:
			kelvins = temperature_input_coldest

		temperature = self._scale_int(kelvins, temperature_input_coldest, temperature_input_warmest, temperature_output_coldest, temperature_output_warmest)
		self._debug("Scaled kelvins={} to a temperature value of {}".format(kelvins, temperature))

		if 'can_set_temperature' in self._config['features']:
			return self._set_temperature(temperature, zone)
		else:
			return self._step_temperature(temperature, temperature_output_coldest, temperature_output_warmest, zone)

	def on(self, zone = None, try_hard = False):
		if zone is None:
			message = {'button': 'on'}
		else:
			message = {
				'button': 'zone_on',