Add power on method to call a service#190
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.
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.core import HomeAssistant, callback | ||
| 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.
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_commandservice.I previously used the official integration, where I can configure
turn_on_actionto 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.