-
Notifications
You must be signed in to change notification settings - Fork 82
Add power on method to call a service #190
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |
| __version__, | ||
| ) | ||
| from homeassistant.core import HomeAssistant, callback | ||
| from homeassistant.helpers import entity_registry as er | ||
| from homeassistant.helpers import config_validation as cv, entity_registry as er | ||
| from homeassistant.helpers.selector import ( | ||
| EntitySelector, | ||
| EntitySelectorConfig, | ||
|
|
@@ -50,6 +50,7 @@ | |
| CONF_PING_PORT, | ||
| CONF_POWER_ON_DELAY, | ||
| CONF_POWER_ON_METHOD, | ||
| CONF_POWER_ON_SERVICE_DATA, | ||
| CONF_SHOW_CHANNEL_NR, | ||
| CONF_SYNC_TURN_OFF, | ||
| CONF_SYNC_TURN_ON, | ||
|
|
@@ -100,6 +101,7 @@ | |
| POWER_ON_METHODS = { | ||
| PowerOnMethod.WOL.value: "WOL Packet (better for wired connection)", | ||
| PowerOnMethod.SmartThings.value: "SmartThings (better for wireless connection)", | ||
| PowerOnMethod.Service.value: "Service", | ||
| } | ||
|
|
||
| CONF_SHOW_ADV_OPT = "show_adv_opt" | ||
|
|
@@ -484,6 +486,18 @@ def _async_option_form(self): | |
| CONF_SYNC_TURN_ON, | ||
| description={"suggested_value": options.get(CONF_SYNC_TURN_ON, [])}, | ||
| ): EntitySelector(select_entities), | ||
| vol.Required( | ||
| CONF_POWER_ON_METHOD, | ||
| default=options.get( | ||
| CONF_POWER_ON_METHOD, str(PowerOnMethod.WOL.value) | ||
| ), | ||
| ): SelectSelector(_dict_to_select(POWER_ON_METHODS)), | ||
| vol.Required( | ||
| CONF_POWER_ON_SERVICE_DATA, | ||
| default=options.get( | ||
| CONF_POWER_ON_SERVICE_DATA, "{}" | ||
| ), | ||
| ): cv.string, | ||
|
Comment on lines
+489
to
+500
Owner
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. In this way we are going to provide a I suggest to add only the text field in the advanced option:
|
||
| vol.Required(CONF_SHOW_ADV_OPT, default=False): bool, | ||
| } | ||
|
|
||
|
|
@@ -501,12 +515,6 @@ def _async_option_form(self): | |
| CONF_SHOW_CHANNEL_NR, | ||
| default=options.get(CONF_SHOW_CHANNEL_NR, False), | ||
| ): bool, | ||
| vol.Required( | ||
| CONF_POWER_ON_METHOD, | ||
| default=options.get( | ||
| CONF_POWER_ON_METHOD, str(PowerOnMethod.WOL.value) | ||
| ), | ||
| ): SelectSelector(_dict_to_select(POWER_ON_METHODS)), | ||
| } | ||
|
|
||
| data_schema.update(opt_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.
Do not import cv only for
cv.string. Is enought usestr