Python LimitlessLED via RF

Check-in [1e1bbc1d62]
Login

Check-in [1e1bbc1d62]

Overview
Comment:Corrected color temperature inversion and max brightness bug
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1e1bbc1d628583658e734ec86e43475c5e1e5f4b85fbca7d6779565e73f3c333
User & Date: rkeene on 2020-04-29 23:31:15
Other Links: manifest | tags
Context
2020-04-29
23:46
Really fixed temperature inversion check-in: 7dcbe06115 user: rkeene tags: trunk
23:31
Corrected color temperature inversion and max brightness bug check-in: 1e1bbc1d62 user: rkeene tags: trunk
22:51
Updated with some corrections check-in: 9ade53d067 user: rkeene tags: trunk
Changes

Modified limitlessled_rf/__init__.py from [114a008632] to [4061ad1db9].

51
52
53
54
55
56
57
58
59


60
61
62
63
64
65
66
51
52
53
54
55
56
57


58
59
60
61
62
63
64
65
66







-
-
+
+







		},
		'cct': {
			'retries':  10,
			'delay':    0.5,
			'channels': [4, 39, 74],
			'syncword': [0x55AA, 0x050A],
			'brightness_range': [0, 9],
			'temperature_output_range': [0, 9],
			'temperature_input_range':  [3000, 9000],
			'temperature_output_range': [9, 0],
			'temperature_input_range':  [9000, 3000],
			'features': [
				'has_max_brightness',
				'has_brightness',
				'has_temperature',
				'is_white'
			],
			'button_map': {
438
439
440
441
442
443
444
445

446
447
448
449
450
451
452
438
439
440
441
442
443
444

445
446
447
448
449
450
451
452







-
+







		use_max_button = False
		if initial_value == target_range_max:
			if 'has_max_{}'.format(button_prefix) in self._config['features']:
				use_max_button = True

		if use_max_button:
			self._debug("[INITIAL] Going to max {}".format(button_prefix))
			getattr(self, "max_{}".format(button_prefix))(zone)
			getattr(self, "_max_{}".format(button_prefix))(zone)
		else:
			# Otherwise, step it
			for step in range(initial_steps):
				self._debug("[INITIAL] Stepping {} {}".format(button_prefix, initial_direction))
				self._send_button({'button': "{}_{}".format(button_prefix, initial_direction)})

		# Now that we have forced the value to the extreme, move in
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
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_low = self._config['temperature_input_range'][0]
		temperature_input_high = self._config['temperature_input_range'][1]
		temperature_output_low = self._config['temperature_output_range'][0]
		temperature_output_high = self._config['temperature_output_range'][1]
		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 < temperature_input_low:
			kelvins = temperature_input_low
		elif kelvins > temperature_input_high:
			kelvins = temperature_input_high
		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_low, temperature_input_high, temperature_output_low, temperature_output_high)
		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_low, temperature_output_high, zone)
			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',