Python LimitlessLED via RF

Diff
Login

Diff

Differences From Artifact [d8bdeeb998]:

To Artifact [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