-
-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Allow toggle to accept parameters #4745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,46 @@ toggle: | |
| description: Duration in seconds it takes to get to next state | ||
| example: 60 | ||
|
|
||
| rgb_color: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't copy stuff. Make a comment of possibility
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How should I do this? |
||
| description: Color for the light in RGB-format | ||
| example: '[255, 100, 100]' | ||
|
|
||
| color_name: | ||
| description: A human readable color name | ||
| example: 'red' | ||
|
|
||
| xy_color: | ||
| description: Color for the light in XY-format | ||
| example: '[0.52, 0.43]' | ||
|
|
||
| color_temp: | ||
| description: Color temperature for the light in mireds (154-500) | ||
| example: '250' | ||
|
|
||
| white_value: | ||
| description: Number between 0..255 indicating level of white | ||
| example: '250' | ||
|
|
||
| brightness: | ||
| description: Number between 0..255 indicating brightness | ||
| example: 120 | ||
|
|
||
| profile: | ||
| description: Name of a light profile to use | ||
| example: relax | ||
|
|
||
| flash: | ||
| description: If the light should flash | ||
| values: | ||
| - short | ||
| - long | ||
|
|
||
| effect: | ||
| description: Light effect | ||
| values: | ||
| - colorloop | ||
| - random | ||
|
|
||
| hue_activate_scene: | ||
| description: Activate a hue scene stored in the hue hub | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -366,19 +366,20 @@ def async_turn_off(self, **kwargs): | |
| return self.hass.loop.run_in_executor( | ||
| None, ft.partial(self.turn_off, **kwargs)) | ||
|
|
||
| def toggle(self) -> None: | ||
| def toggle(self, **kwargs) -> None: | ||
| """Toggle the entity.""" | ||
| if self.is_on: | ||
| self.turn_off() | ||
| self.turn_off(**kwargs) | ||
| else: | ||
| self.turn_on() | ||
| self.turn_on(**kwargs) | ||
|
|
||
| def async_toggle(self): | ||
| def async_toggle(self, **kwargs): | ||
| """Toggle the entity. | ||
|
|
||
| This method must be run in the event loop and returns a coroutine. | ||
| """ | ||
| if self.is_on: | ||
| return self.async_turn_off() | ||
| return self.async_turn_off(**kwargs) | ||
| else: | ||
| return self.async_turn_on() | ||
| return self.async_turn_on(**kwargs) | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blank line at end of file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blank line at end of file |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove this, extend your Schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the schema from turn_on