Python LimitlessLED via RF

Check-in [d7c22f39ac]
Login
Overview
Comment:Some old improvements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d7c22f39ac45a1489a3f40933144b26cd98d1eb9bc5143086f9989339d803bfb
User & Date: rkeene on 2023-09-10 16:40:29
Other Links: manifest | tags
Context
2023-09-10
17:15
limitlessled_rf v0.15 Leaf check-in: df5f777ef3 user: rkeene tags: trunk
16:40
Some old improvements check-in: d7c22f39ac user: rkeene tags: trunk
2020-08-27
21:57
Remove some debugging check-in: 8de9b26091 user: rkeene tags: trunk
Changes

Modified limitlessled_rf/__init__.py from [d8bdeeb998] to [79db6fc715].

583
584
585
586
587
588
589







590
591
592
593
594
595
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

		# If this remote has a "max" feature, use that instead of stepping
		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)
		else:
			# Otherwise, step it
			step_command = {'button': "{}_{}".format(button_prefix, initial_direction)}
			if zone is not None:
				step_command['zone'] = zone
			for step in range(initial_steps):




				self._debug("[INITIAL] Stepping {} {}".format(button_prefix, initial_direction))
				self._send_button(step_command)

		# Now that we have forced the value to the extreme, move in
		# steps from that value to the desired value
		if initial_value < target_value:
			final_steps = target_value - initial_value
		else:
			final_steps = initial_value - target_value

		step_command = {'button': "{}_{}".format(button_prefix, final_direction)}
		if zone is not None:
			step_command['zone'] = zone

		transition_delay = None
		if transition is not None and final_steps > 1:
			transition_delay = transition / (final_steps - 1)

		for step in range(final_steps):
			if step == (final_steps - 1):
				transition_delay = None

			self._debug("[FINAL] Stepping {} {} with a delay of {} (ms) afterwards".format(button_prefix, final_direction, transition_delay))
			self._send_button(step_command, post_delay = transition_delay)

		return True

	def _step_brightness(self, brightness, brightness_min, brightness_max, zone = None, transition = None):
		# For setting the brightness, set a change-overpoint at around
		# 75%, where below this value we will go to the dimmest and







>
>
>
>
>
>
>









>
>
>
>
|
|

<
<
<
<
<
<







|





|







583
584
585
586
587
588
589
590
591
592
593
594
595
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
633

		# If this remote has a "max" feature, use that instead of stepping
		use_max_button = False
		if initial_value == target_range_max:
			if 'has_max_{}'.format(button_prefix) in self._config['features']:
				use_max_button = True

		# Now that we have forced the value to the extreme, move in
		# steps from that value to the desired value
		if initial_value < target_value:
			final_steps = target_value - initial_value
		else:
			final_steps = initial_value - target_value

		if use_max_button:
			self._debug("[INITIAL] Going to max {}".format(button_prefix))
			getattr(self, "_max_{}".format(button_prefix))(zone)
		else:
			# Otherwise, step it
			step_command = {'button': "{}_{}".format(button_prefix, initial_direction)}
			if zone is not None:
				step_command['zone'] = zone
			for step in range(initial_steps):
				transition_delay = None
				if step == (initial_steps - 1) and transition is not None and final_steps > 1:
					transition_delay = transition / final_steps

				self._debug("[INITIAL] Stepping {} {} with a delay of {} (s) afterwards".format(button_prefix, initial_direction, transition_delay))
				self._send_button(step_command, post_delay = transition_delay)








		step_command = {'button': "{}_{}".format(button_prefix, final_direction)}
		if zone is not None:
			step_command['zone'] = zone

		transition_delay = None
		if transition is not None and final_steps > 1:
			transition_delay = transition / final_steps

		for step in range(final_steps):
			if step == (final_steps - 1):
				transition_delay = None

			self._debug("[FINAL] Stepping {} {} with a delay of {} (s) afterwards".format(button_prefix, final_direction, transition_delay))
			self._send_button(step_command, post_delay = transition_delay)

		return True

	def _step_brightness(self, brightness, brightness_min, brightness_max, zone = None, transition = None):
		# For setting the brightness, set a change-overpoint at around
		# 75%, where below this value we will go to the dimmest and