-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add power on method to call a service #190
base: master
Are you sure you want to change the base?
Conversation
Could you rebase this? |
3d38af8
to
51c25df
Compare
Sure! Done. |
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, |
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.
In this way we are going to provide a SmartThings
option also if SmartThings
is not enabled (not good) and we also add a text field that should be useless in some cases. This will probably confuse "normal" user and cause false issues, because I'm trying to simplify option flow (I will introduce some changes shortly), I do not like very match this approach.
I suggest to add only the text field in the advanced option:
- if it contain some values, the power-on based on service will be used (may be you could also hide the power on method field in main form in this case)
- if empty, everything will normally
from homeassistant.helpers import entity_registry as er | ||
from homeassistant.helpers import config_validation as cv, entity_registry as er |
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 use str
Just to mention that Home Assistant official integrations with similar needs are adopting the trigger mechanism, where you can implement your own automation for. Example, triggers when the TV is requested to power on: platform: samsungtv.turn_on
entity_id: media_player.samsung_tv |
I want to call an HA service to power on the TV instead of using the WOL method provided. In my case, I am using HA in the Kubernetes environment where the WOL does not reach the LAN where the TV is, and instead of that, I use the
rest_command
service.I previously used the official integration, where I can configure
turn_on_action
to call that service. This MR will make it equivalent to that configuration. Even you could remove the WOL implementation, and the user could rely on the Wake On LAN HA integration by calling its service.